Skip to content

Get a POS access token

View as Markdown

Exchanges the POS client id and client secret for a short-lived Bearer token with the client_credentials grant. Every other POS call sends this token in Authorization, the POS API key in X-API-Key, and a request signature.

Changes in 2026-09-27

POST /api/pos/v1/auth/token

Authentication

Secret key (Bearer)

Request body

NameTypeRequiredValuesDescription
grant_typestringyesclient_credentials
client_idstringyes
client_secretstringyes

Response 200

NameTypeRequiredValuesDescription
access_tokenstringyes
token_typestringyesBearer
expires_inintegeryes
terminal_sourcestringyesREGISTERED, REQUEST

Errors

CodeStatusMessage
POS-001401The POS client id or client secret is invalid.
curl -sS -X POST "https://sandbox-api.tappay.mn/api/pos/v1/auth/token" \
  -H "Content-Type: application/json" \
  -d '{"grant_type":"client_credentials","client_id":"YOUR_POS_CLIENT_ID","client_secret":"YOUR_POS_CLIENT_SECRET"}'

PosClient gets and refreshes this token for you — the example shows the raw HTTP call.

const res = await fetch('https://sandbox-api.tappay.mn/api/pos/v1/auth/token', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    grant_type: 'client_credentials',
    client_id: 'YOUR_POS_CLIENT_ID',
    client_secret: 'YOUR_POS_CLIENT_SECRET',
  }),
});
console.log(await res.text());

PosClient gets and refreshes this token for you — the example shows the raw HTTP call.

<?php
$body = json_encode([
    'grant_type' => 'client_credentials',
    'client_id' => 'YOUR_POS_CLIENT_ID',
    'client_secret' => 'YOUR_POS_CLIENT_SECRET',
]);
$ch = curl_init('https://sandbox-api.tappay.mn/api/pos/v1/auth/token');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
    ],
]);
echo curl_exec($ch);

PosClient gets and refreshes this token for you — the example shows the raw HTTP call.

import json, urllib.request, uuid

req = urllib.request.Request(
    'https://sandbox-api.tappay.mn/api/pos/v1/auth/token',
    data=json.dumps({
        'grant_type': 'client_credentials',
        'client_id': 'YOUR_POS_CLIENT_ID',
        'client_secret': 'YOUR_POS_CLIENT_SECRET',
    }).encode(),
    method='POST',
    headers={
        'Content-Type': 'application/json',
    },
)
print(urllib.request.urlopen(req).read().decode())
{
  "access_token": "YOUR_POS_ACCESS_TOKEN",
  "token_type": "Bearer",
  "expires_in": 3600,
  "terminal_source": "REGISTERED"
}

In the sandbox use the terminal T-SANDBOX-POS of the merchant M-SANDBOX-POS. For the full flow, read the POS terminal guide.