Important announcement: API v3 launch! Review the changes and update your integrations by Dec 1, 2025 before old API shutdown
API guide v3
LogoLogo
Release notes
  • Welcome to Coinsbuy docs
  • Get started
    • Sign up and sign in
    • Explore the Web interface
    • Create a wallet
    • Configure security settings and access permissions
    • Set up integrations
    • Use Helpdesk to get assistance
  • User guide
    • Wallet management
      • Wallets
      • Transfers
      • Deposits
      • Payouts
      • Events
      • Callbacks
    • Custody
      • Wallets
      • Requests
      • History
    • Staking
      • TRX staking
    • Rates
    • Swaps
      • Wallets
      • Swap
      • History
  • How-tos
    • Manage your profile and system
      • How to sign up
      • How to change your password
      • How to enable 2FA
      • How to whitelist IP addresses
      • How to access the API
      • How to enable additional AML check
    • Manage your wallets
      • How to create a wallet
      • How to grant access to your wallet
      • How to manage user roles
      • How to restrict access to your wallet
      • How to generate a report on wallet balances
      • How to set withdrawal thresholds
    • Manage your assets
      • How to create a deposit
      • How to create a payout
      • How to create a bank withdrawal
      • How to create an internal transfer
      • How to select the optimal blockchain fee
      • How to speed up your payout by changing the blockchain fee
      • How to whitelist a payout address
      • How to swap funds
      • How to top up or withdraw funds from your Custody wallet
  • API guide
    • API overview
    • Authentication
    • Wallet methods
    • Transfer methods
    • Deposit methods
    • Payout methods
    • Currency methods
    • Rate methods
  • API guide v2 [DEPRECATED]
    • API overview
    • Authentication
    • Wallet methods
    • Transfer methods
    • Deposit methods
    • Payout methods
    • Currency methods
    • Rate methods
  • References
    • Key terms
    • User roles
    • Transfer types
    • Currency codes
    • Block explorer list
    • Address types
    • Useful links
  • Troubleshooting
    • Error: No active account found with the given credentials
    • Error: Invalid 2FA code
    • Error: You IP is not whitelisted
    • Unresolved deposits
    • Missing deposits
    • Canceled transfers
    • Unconfirmed transfers
  • Release notes
Powered by GitBook
On this page
  • Obtain token
  • Request
  • Response

Was this helpful?

  1. API guide

Authentication

Obtain token

Request

POST [base]/token

Name
Type
Required
Description

client_id

string

Yes

Your API key.

client_secret

string

Yes

Your API secret.

Request example

curl --location '{base_url}/token/' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
  "data": {
    "type": "auth-token",
    "attributes": {
      "client_id": "<Your API key>",
      "client_secret": "<Your API secret>"
    }
  }
}'
import requests

url = '[base]/token/'

headers = {
  'content-type': 'application/vnd.api+json',
}

data = {
  'data': {
    'type': 'auth-token',
    'attributes': {
      'client_id': '<Your API key>',
      'client_secret': '<Your API secret>',
    }
  }
}

requests.post(url, headers=headers, json=data)
<?php

use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;

$client = new GuzzleHttp\Client();
try {
  $res = $client->post('[base]/token/', [
    'json' => [
      'data' => [
        'type' => 'auth-token',
        'attributes' => [
          'client_id' => '<Your API key>',
          'client_secret' => '<Your API secret>',
        ],
      ],
    ],
    'headers' => [
      'Content-Type' => 'application/vnd.api+json',
    ],
  ]);
echo $res->getBody();
} catch (RequestException $e) {}

Response

Name
Type
Description

access

string

Your access token. It has an expiry time and after expiration should be refreshed by resending the request.

expires_in

number

The lifetime of the token, in seconds.

token_type

string

Always `"Bearer"`.

Response example

{
  "data": {
    "type": "auth-token",
    "id": "0",
    "attributes": {
      "access": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjMy...",
      "expires_in": 3599,
      "token_type": "Bearer"
    }
  }
}

Response codes

HTTP code
Description
Suggested action

200

OK

—

400

No active account found with the given credentials

Resend the request with the correct credentials.

429

Too many requests

Try again later.

4xx

Incorrect request

Resend the request with the correct parameters.

5хх

—

Server error

Try again later.

PreviousAPI overviewNextWallet methods

Last updated 11 days ago

Was this helpful?