> ## Documentation Index
> Fetch the complete documentation index at: https://docs.singapay.id/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate OAuth access token

> Authenticate using client credentials (Basic Auth) and obtain a JWT access token for subsequent API calls. Basic Authentication automatically generates a string encoded in Base64 format by combining the client_id and client_secret with a colon separator.



## OpenAPI

````yaml https://biller-b2b.singapay.id/docs post /api/v1.0/access-token/b2b
openapi: 3.0.0
info:
  title: B2B Biller API
  description: >-
    API documentation for the B2B Biller service. Provides endpoints for bill
    payments (postpaid/prepaid), transaction management, balance checking, and
    authentication.
  version: 1.0.0
servers:
  - url: https://sandbox-biller-b2b.singapay.id
    description: Sandbox
  - url: https://biller-b2b.singapay.id
    description: Production
security: []
tags:
  - name: Authentication
    description: OAuth2 token generation
  - name: General
    description: Bill transaction listing, detail, balance, and utilities
  - name: Postpaid V1
    description: Postpaid bill inquiry and payment (V1)
  - name: Prepaid V1
    description: Prepaid inquiry and payment — PLN Token, Pulsa, Paket Data (V1)
  - name: Postpaid V2
    description: Postpaid bill inquiry and payment (V2)
  - name: Prepaid V2
    description: Prepaid inquiry, payment, and game topup (V2)
paths:
  /api/v1.0/access-token/b2b:
    post:
      tags:
        - Authentication
      summary: Generate OAuth access token
      description: >-
        Authenticate using client credentials (Basic Auth) and obtain a JWT
        access token for subsequent API calls. Basic Authentication
        automatically generates a string encoded in Base64 format by combining
        the client_id and client_secret with a colon separator.
      operationId: generateAccessToken
      parameters:
        - name: X-PARTNER-ID
          in: header
          description: Merchant API key
          required: true
          schema:
            type: string
        - name: Content-Type
          in: header
          description: Response format
          required: true
          schema:
            type: string
            default: Application/json
      requestBody:
        required: true
        content:
          application/json:
            schema:
              required:
                - grant_type
              properties:
                grant_type:
                  type: string
                  enum:
                    - client_credentials
                  example: client_credentials
              type: object
      responses:
        '200':
          description: Token generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessTokenSuccessResponse'
        '401':
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessTokenErrorResponse'
        '422':
          description: Missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccessTokenErrorResponse'
      security:
        - basicAuth: []
components:
  schemas:
    AccessTokenSuccessResponse:
      description: Successful access token response (uses laravel-responder format)
      required:
        - status
        - success
        - data
      properties:
        status:
          type: integer
          example: 200
        success:
          type: boolean
          example: true
        data:
          required:
            - access_token
            - token_type
            - expires_in
          properties:
            access_token:
              description: JWT access token
              type: string
              example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...
            token_type:
              type: string
              example: Bearer
            expires_in:
              description: Token TTL in seconds
              type: string
              example: '3600'
          type: object
      type: object
    AccessTokenErrorResponse:
      description: Access token error response (uses laravel-responder format)
      required:
        - status
        - success
        - error
      properties:
        status:
          type: integer
          example: 401
        success:
          type: boolean
          example: false
        error:
          properties:
            code:
              type: integer
              example: 401
            message:
              type: string
              example: Invalid credentials
          type: object
      type: object
  securitySchemes:
    basicAuth:
      type: http
      description: >-
        Basic authentication using Base64 encoded client_id:client_secret.
        Format: Authorization: Basic <base64(client_id:client_secret)>
      scheme: basic

````