---
agentTools:
  projectIndex: https://onebrick.readme.io/llms.txt
---

# Get Access Token

This page provides detailed information about the access token API used in the SNAP standard for QRIS creation and query.

## Request Parameters

[block:parameters]
{
  "data": {
    "h-0": "Key Parameters",
    "h-1": "Data Type",
    "h-2": "Description",
    "0-0": "Content-Type",
    "0-1": "String",
    "0-2": "String representing the content type (application/json)",
    "1-0": "X-CLIENT-KEY",
    "1-1": "String",
    "1-2": "Client's client_id",
    "2-0": "X-TIMESTAMP",
    "2-1": "datetime",
    "2-2": "Client's current local time in  yyyy-MM- ddTHH:mm:ss.SSSTZD format",
    "3-0": "X-SIGNATURE",
    "3-1": "string",
    "3-2": "Non-repudiation & integrity validation checking.  \n  \nGenerated by client and created using asymmetric  \nsignature SHA256withRSA algorithm  \n(Private_Key, stringToSign)  \nstringToSign = client ID + “|” + X-TIMESTAMP",
    "4-0": "grant_type",
    "4-1": "string",
    "4-2": "Must be `client_credentials`"
  },
  "cols": 3,
  "rows": 5,
  "align": [
    "left",
    "left",
    "left"
  ]
}
[/block]

## Response Parameters

| Key parameters  | Data type | Description                                                                                                       |
| :-------------- | :-------- | :---------------------------------------------------------------------------------------------------------------- |
| responseCode    | integer   | A code indicating the success or failure of the request, along with the associated reason.                        |
| responseMessage | string    | A detailed message providing further context on the response code.                                                |
| accessToken     | string    | An authorization token issued to the client for accessing protected resources.                                    |
| tokenType       | string    | Specifies the type of token returned (e.g., Bearer).                                                              |
| expiresIn       | integer   | The duration (in seconds) for which the access token is valid before expiring. It will be 900 seconds in default. |

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "SNAP",
    "version": "2"
  },
  "servers": [
    {
      "url": "https://sandbox.onebrick.io/v2/payments"
    }
  ],
  "security": [
    {}
  ],
  "paths": {
    "/acceptance/1.0/access-token/b2b": {
      "post": {
        "summary": "Get Access Token",
        "description": "This page provides detailed information about the access token API used in the SNAP standard for QRIS creation and query.",
        "operationId": "get-access-token-snap",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "String represents indicate the media type of the resource",
            "required": true,
            "schema": {
              "type": "string",
              "default": "application/json"
            }
          },
          {
            "name": "X-CLIENT-KEY",
            "in": "header",
            "description": "Client’s client_id",
            "required": true,
            "schema": {
              "type": "string",
              "default": "66a5fc3b-7c57-4e29-b097-88b5909aedcc"
            }
          },
          {
            "name": "X-TIMESTAMP",
            "in": "header",
            "description": "Client's current local time in yyyy-MM- ddTHH:mm:ss.SSSTZD format",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date",
              "default": "2024-11-11T18:44:33+07:00"
            }
          },
          {
            "name": "X-SIGNATURE",
            "in": "header",
            "description": "Non-Repudiation & Integrity check signature for the requesting",
            "required": true,
            "schema": {
              "type": "string",
              "default": "i10jpP3qxAU+K+YtHmqXTnd00tbAdloAMoJsi0W32T4mnGiaZB1JNtWm1DZetUXUE7+93VVn4L5F1YhqheElsjQBnaDmPUxDXWrT8cHakzKz/EYNGFhgnnGVokRLaBnDIP11ASFACt7P7dtTA3EFAoD65NbApyMmKkrPG8siQvyKylx5xHRCq2Zr3WNqWOP4MgCo862PNHNAapu54ikw3B9x1FW/BCTWlm0bzz51HXWvoneyF9boddKGjfDgFJYfVp58RJd8cgvqwCAV/+bzXzen0DqB9Yo2O3XCszD6yMVJz5dMvEkOwSyskILbJsSLa8JqRRh/j66jYLy8JBDOFg=="
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "grant_type"
                ],
                "properties": {
                  "grant_type": {
                    "type": "string",
                    "description": "Must be \"client_credentials\"",
                    "default": "client_credentials"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "value": "{\n  \"responseCode\": \"2007300\",\n  \"responseMessage\": \"Successful\",\n  \"accessToken\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNjQwIiwiZXhwIjoxNzMxNjYxODY4LCJuYmYiOjE3MzE2NjA5NjgsImlhdCI6MTczMTY2MDk2OH0.meLj72WwkmLTtMa47DUZDgs4EhbhWJbzgQhjTm0sUC4\",\n  \"tokenType\": \"Bearer\",\n  \"expiresIn\": \"900\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "responseCode": {
                      "type": "string",
                      "example": "2007300"
                    },
                    "responseMessage": {
                      "type": "string",
                      "example": "Successful"
                    },
                    "accessToken": {
                      "type": "string",
                      "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNjQwIiwiZXhwIjoxNzMxNjYxODY4LCJuYmYiOjE3MzE2NjA5NjgsImlhdCI6MTczMTY2MDk2OH0.meLj72WwkmLTtMa47DUZDgs4EhbhWJbzgQhjTm0sUC4"
                    },
                    "tokenType": {
                      "type": "string",
                      "example": "Bearer"
                    },
                    "expiresIn": {
                      "type": "string",
                      "example": "900"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Payload": {
                    "value": "{\n  \"responseCode\": \"4007302\",\n  \"responseMessage\": \"Invalid Mandatory Field\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "responseCode": {
                      "type": "string",
                      "example": "4007302"
                    },
                    "responseMessage": {
                      "type": "string",
                      "example": "Invalid Mandatory Field"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "examples": {
                  "Unauthorized": {
                    "value": "{\n  \"responseCode\": \"4017300\",\n  \"responseMessage\": \"Unauthorized X-SIGNATURE\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "responseCode": {
                      "type": "string",
                      "example": "4017300"
                    },
                    "responseMessage": {
                      "type": "string",
                      "example": "Unauthorized X-SIGNATURE"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "6736c09acf484e0030742e84:673304beec656f003058ee70"
}
```