Skip to main content
POST
/
auth
/
token
Generate Access Token
curl --request POST \
  --url https://api.fyatu.com/api/v3/auth/token \
  --header 'Content-Type: application/json' \
  --data '
{
  "appId": "A1B2C3D4E5F6G7H8",
  "secretKey": "your_secret_key_here",
  "grantType": "client_credentials"
}
'
import requests

url = "https://api.fyatu.com/api/v3/auth/token"

payload = {
"appId": "A1B2C3D4E5F6G7H8",
"secretKey": "your_secret_key_here",
"grantType": "client_credentials"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
appId: 'A1B2C3D4E5F6G7H8',
secretKey: 'your_secret_key_here',
grantType: 'client_credentials'
})
};

fetch('https://api.fyatu.com/api/v3/auth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fyatu.com/api/v3/auth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'appId' => 'A1B2C3D4E5F6G7H8',
'secretKey' => 'your_secret_key_here',
'grantType' => 'client_credentials'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.fyatu.com/api/v3/auth/token"

payload := strings.NewReader("{\n \"appId\": \"A1B2C3D4E5F6G7H8\",\n \"secretKey\": \"your_secret_key_here\",\n \"grantType\": \"client_credentials\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.fyatu.com/api/v3/auth/token")
.header("Content-Type", "application/json")
.body("{\n \"appId\": \"A1B2C3D4E5F6G7H8\",\n \"secretKey\": \"your_secret_key_here\",\n \"grantType\": \"client_credentials\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.fyatu.com/api/v3/auth/token")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"appId\": \"A1B2C3D4E5F6G7H8\",\n \"secretKey\": \"your_secret_key_here\",\n \"grantType\": \"client_credentials\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "status": 200,
  "message": "Token generated successfully",
  "data": {
    "accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBMUIyQzNENEU1RjZHN0g4IiwiYnVzIjoiTjFTMFczUThQMFYxRTVNNlE0UjNEOFo5IiwidHlwZSI6ImNvbGxlY3Rpb24iLCJzY29wZXMiOlsiY29sbGVjdDp3cml0ZSIsImNvbGxlY3Q6cmVhZCIsInBheW91dDp3cml0ZSIsInBheW91dDpyZWFkIl0sImlhdCI6MTczNjA3NTgwMCwiZXhwIjoxNzM2MTYyMjAwLCJqdGkiOiJqd3RfOWYzZTJhMWI0YzVkNjdlOCJ9.xK2pM7nV3wL8qR5tY0sF4gH9jB6eA1cD3uW2iZ8vX0mN",
    "tokenType": "Bearer",
    "expiresIn": 86400,
    "expiresAt": "2026-01-06T10:30:00+00:00",
    "appType": "collection",
    "scopes": [
      "collect:write",
      "collect:read",
      "payout:write",
      "payout:read"
    ]
  },
  "meta": {
    "requestId": "req_9f3e2a1b4c5d67e8",
    "timestamp": "2026-01-05T10:30:00+00:00"
  }
}
{
"success": false,
"status": 400,
"message": "Validation failed",
"error": {
"code": "VALIDATION_ERROR",
"details": [
{
"field": "appId",
"message": "AppId is required"
}
]
},
"meta": {
"requestId": "req_abc123def456",
"timestamp": "2026-01-05T10:30:00+00:00"
}
}
{
"success": false,
"status": 401,
"message": "Invalid credentials. Secret key mismatch.",
"error": {
"code": "AUTH_INVALID_CREDENTIALS"
},
"meta": {
"requestId": "req_abc123def456",
"timestamp": "2026-01-05T10:30:00+00:00"
}
}
Getting Your Credentials: Login to FYATU Dashboard → Business Console → Select App → Settings → API Keys & Credentials

Overview

Exchange your app credentials (appId and secretKey) for a JWT access token. This token is required to authenticate all other V3 API requests.

Token Details

PropertyValue
Token TypeJWT (HS256)
Expiry24 hours (86400 seconds)
Refresh WindowUp to 5 minutes after expiry

Scopes by App Type

ScopeDescription
collect:writeCreate checkout sessions, process payments
collect:readView collection transactions
payout:writeSend payouts
payout:readView payout transactions

Using the Token

Once you have an access token, include it in the Authorization header for all API requests:
curl -X GET https://api.fyatu.com/api/v3/collections \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Error Codes

CodeDescription
VALIDATION_ERRORMissing or invalid request parameters
AUTH_INVALID_CREDENTIALSApp not found or secret key mismatch
AUTH_APP_INACTIVEApp is suspended or archived
Store tokens securely and track the expiresAt timestamp. Refresh tokens proactively before they expire to ensure uninterrupted API access.

Body

application/json
appId
string
required

Your app ID (16 characters)

Minimum string length: 8
Example:

"DD123FR45446CECES"

secretKey
string
required

Your app secret key

Minimum string length: 16
Example:

"your_secret_key_here"

grantType
enum<string>
default:client_credentials
required

OAuth grant type (must be 'client_credentials')

Available options:
client_credentials
Example:

"client_credentials"

Response

Token generated successfully

success
boolean
Example:

true

status
integer
Example:

200

message
string
Example:

"Token generated successfully"

data
object
meta
object