POST
/
account
/
getAccessToken
Get Access Token
curl --request POST \
  --url https://api.onekhusa.com/sandbox/v1/account/getAccessToken \
  --header 'Content-Type: application/json' \
  --header 'X-Merchant-Account-Number: <x-merchant-account-number>' \
  --header 'X-Organisation-Id: <x-organisation-id>' \
  --data '{
  "apiKey": "abc123def456ghi789jkl012mno345",
  "apiSecret": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz",
  "organisationId": "FYH0NTVW0DXK",
  "merchantAccountNumber": 35253486
}'
{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwOi8vb25la2h1c2Evc2FuZGJveC92MS9hcGkiLCJhdWQiOiJodHRwOi8vb25la2h1c2Evc2FuZGJveC92MS9hcGkiLCJleHAiOjE3MzUyODgwMDB9.signature",
  "expiresOn": "2024-12-26T10:00:00.000Z",
  "expiryInMinutes": 5
}

Headers

X-Organisation-Id
string
required

The organization identifier

X-Merchant-Account-Number
string
required

The merchant account number

Accept-Language
string
default:en

Preferred language for the response

Body

application/json

Request payload for authenticating client API keys and retrieving access token

apiKey
string
required

The client API key

Example:

"client_key_12345"

apiSecret
string
required

The client API secret (45 characters)

Required string length: 45
Example:

"abc123def456ghi789jkl012mno345pqr678stu901vwx234yz"

organisationId
string
required

The organization identifier

Example:

"org_001"

merchantAccountNumber
integer
required

Required string length: 8

Required range: 10000000 <= x <= 99999999
Example:

35253486

Response

200 - application/json

Successfully retrieved access token when credentials are valid

Response payload containing the JWT access token and expiration details

accessToken
string
required

JWT token for API authentication

Example:

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjUwMDAiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjUwMDAiLCJleHAiOjE3MzUyODgwMDB9.signature"

expiresOn
string<date-time>
required

Token expiration timestamp

Example:

"2024-12-26T10:00:00.000Z"

expiryInMinutes
integer
required

Token validity duration in minutes (always 1)

Example:

1