Get an access token
A system that signs in with OAuth 2.0 Client Credentials exchanges its client ID and client secret for an access token. Call the API with Authorization: Bearer <access_token> until the token expires.
Changes in 2026-09-27This operation is not available in this version.
POST /api/v1/oauth/tokenSince 2026-09-27
Authentication
Secret key (Bearer)
Request body
| Name | Type | Required | Values | Description |
|---|---|---|---|---|
grant_type | string | yes | client_credentials | |
client_id | string | no | ||
client_secret | string | no | ||
scope | string | no |
Response 200
| Name | Type | Required | Values | Description |
|---|---|---|---|---|
access_token | string | yes | ||
token_type | string | yes | Bearer | |
expires_in | integer | yes | ||
scope | string | no |
Errors
| Code | Status | Message |
|---|---|---|
VAL-001 | 400 | The request failed validation. |
KEY-005 | 401 | This client system is disabled, so the request is not accepted. |
KEY-006 | 401 | The client system's inbound method does not allow this kind of credential. |
KEY-009 | 401 | The client ID or client secret is invalid. |
curl -sS -X POST "https://api.tappay.mn/api/v1/oauth/token" \
-H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
-H "TapPay-Version: 2026-09-27" \
-H "Idempotency-Key: $(openssl rand -hex 16)" \
-H "Content-Type: application/json" \
-d '{"grant_type":"client_credentials","client_id":"YOUR_CLIENT_ID","client_secret":"YOUR_CLIENT_SECRET"}'import { TapPay } from '@tappay-mn/node';
const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const result = await tappay.oauth.token({
body: {
grant_type: 'client_credentials',
client_id: 'YOUR_CLIENT_ID',
client_secret: 'YOUR_CLIENT_SECRET',
},
});
console.log(JSON.stringify(result));<?php
require 'vendor/autoload.php';
use TapPay\TapPay;
$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$result = $tappay->oauth->token([
'body' => [
'grant_type' => 'client_credentials',
'client_id' => 'YOUR_CLIENT_ID',
'client_secret' => 'YOUR_CLIENT_SECRET',
],
]);
echo json_encode($result);import json
import tappay
client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
result = client.oauth.token({
"body": {
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
},
})
print(json.dumps(result)){
"access_token": "YOUR_ACCESS_TOKEN",
"token_type": "Bearer",
"expires_in": 3600
}
Read Get started for the authentication methods.