TgPay Crypto Withdrawals API
On-chain withdrawals from the app balance to external addresses, their fees and saved addresses.
On-chain withdrawals from the app balance to external addresses, their fees and saved addresses.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/tgpaycrypto-com:tgpaycrypto-com-withdrawals-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: TgPay Crypto Merchant Withdrawals API
version: '2026-11-16'
summary: Merchant payments API of the TgPay Crypto wallet (@tgpaycryptobot).
description: 'The Merchant API of TgPay Crypto (@tgpaycryptobot): create
invoices, refund them, send payouts and checks, withdraw the app
balance on-chain, exchange it between assets, issue withdrawal links,
manage recurring subscriptions, and receive signed webhooks. Human-readable documentation: https://docs.tgpaycrypto.com/crypto-pay-api-reference/
## Conventions
- **Authentication** — send your token in `TgPayCrypto-API-Token`. `TgCryptoPay-API-Token` and `Crypto-Pay-API-Token` are accepted aliases,
in that order. The first non-empty header wins. Full-access primary
tokens have every scope except `withdraw`; restricted tokens need the
operation''s scope, and only a restricted token can hold `withdraw`. - **Envelope** — application success is HTTP 200 with `{ok: true, result}`;
application errors are `{ok: false, error: {code, name}}`, with `code`
equal to the HTTP status. Branch on `error.name`. Transport/framework
rejections, such as malformed typed query parameters, may lack this envelope. - **Amounts** — requests use decimal strings in whole-coin or fiat units,
never JSON numbers. Crypto input is rounded to the asset''s minor unit,
with midpoint rounding away from zero; the result must be positive. Fiat input must represent a positive exact number of cents, at most
10^13 whole fiat units. Responses use fixed-point strings; balance and
fee amounts can be zero. `*_minor` values are integer strings. `getCurrencies` supplies asset decimals. Send exact asset precision. - **POST parameters** — JSON object, form-urlencoded body, or URL query
parameters; body values override query values, including null. Repeated
form/query keys use the last value. Multipart is rejected. Money-moving
methods have no GET aliases. Nested `items` and `recipients` must be
JSON arrays in a JSON body; JSON-encoded strings do not work for them. Required fields must be present after merging query and body. Optional null values generally behave as omitted; per-field rules apply. Integers accept integer strings; booleans also accept 1/0 and the strings
true/false, 1/0, yes/no, on/off (case-insensitive, surrounding whitespace ignored). Text limits are measured in UTF-16 code units by the server. - **Idempotency** — `spend_id` is required for transfers, batch items,
withdraw and exchange, optional for checks and refunds. Empty/null
optional keys disable replay. Keys are scoped per app and operation;
transfer, transferBatch and withdraw share a namespace, exchange has its
own. After validation and access gates, the same parsed request
replays its stored success. Different input returns `409 idempotency_conflict`;
an unfinished claim returns `409 idempotency_in_progress`. Amount strings
and recipient spelling are not normalized for the request hash: keep them
identical on retries. Replays are snapshots, not refreshed objects; use
list methods to obtain current status. createInvoice and plan creation
have no spend_id idempotency; createInvoice''s retry key is
`client_invoice_id`. - **Per-operation webhook and payload** — createInvoice, createCheck,
transfer, each transferBatch item and withdraw accept `webhook_url`
(a public HTTPS URL, up to 256 characters): every update of that
operation goes there instead of the app''s URL, regardless of the app''s
event selection. It is not returned in objects. createCheck, transfer,
transferBatch items and withdraw also accept `payload` (up to 4096
characters), echoed in the object and its webhooks. - **Pagination** — invoices, checks, transfers, withdrawals, exchanges and
withdrawal links default to offset 0, count 100; the server clamps
offset to at least 0 and count to 1..1000. Subscriptions clamp count to 1..500. These lists return `{items: [...]}`,
newest first. getSubscriptionPlans returns all plans without pagination. - **Timestamps** — ISO-8601 strings; nullable timestamps are explicitly null.'
servers:
- url: https://app.tgpaycrypto.com/pay/api
description: Production
- url: https://testnet.tgpaycrypto.com/pay/api
description: Testnet — coins with no value, its own bot @tgpaycrypto_testnet_bot and its own apps and tokens
security:
- apiToken: []
- apiTokenLegacy: []
- apiTokenCompat: []
tags:
- name: withdrawals
description: On-chain withdrawals from the app balance to external addresses, their fees and saved addresses.
paths:
/withdraw:
post:
tags:
- withdrawals
operationId: withdraw
summary: Withdraw the app balance to an external address
description: 'Scope: `withdraw` — only a restricted token that holds it; the primary
token never has it (`403 scope_required`). Rate limit: 30/min per app.
Shared outgoing-funds restrictions and the daily payout ceiling apply;
the payout mode does not.
Available only when the owner has turned on withdrawals through the
API for the app (which requires a daily payout limit); otherwise
`403 withdraw_disabled`. Two optional owner safeguards: saved
addresses only (pass `address_id`, see getWithdrawAddresses) and an
IP allowlist (`403 ip_not_allowed`). The network fee is charged on top
of the amount from the app balance; the amount must reach the
network''s minimum (getWithdrawFees). The owner''s own withdrawal rules
apply too: withdrawal limits, address screening and the owner''s
saved-addresses mode.
A new withdrawal returns `status: processing` with amount + fee on
hold. The final state arrives as `transfer_completed` (confirmed) or
`transfer_returned` (failed — amount and fee back on the app balance),
or poll getWithdrawals. spend_id shares the transfer namespace; a retry
replays the original response.
Specific errors: `403 withdraw_disabled`, `403 ip_not_allowed`,
`400 invalid_request` (missing parameter, both or neither of
`address_id` / `address`, `memo` with `address_id`),
`403 address_not_saved` (unknown `address_id`, or `address` under
saved-addresses-only), `409 address_pending` (saved address not usable
yet), `400 memo_unsupported`, `400 unknown_asset`, `404 unknown_network`,
`400 invalid_address`, `400 network_required`, `400 invalid_amount`,
`400 below_minimum`, `409 over_per_tx_limit` / `over_daily_limit`,
`409 over_unverified_daily_limit`, `409 insufficient_funds` (amount +
fee exceed the app balance), `403 address_not_allowlisted` /
`allowlist_pending`, `403 address_blocked` (screening),
`403 funds_under_review`, `403 pin_pending`, `403 daily_cap_exceeded`,
`503 withdrawals_paused` / `screening_unavailable` /
`withdraw_fee_unavailable` (retry later),
`409 idempotency_conflict` / `idempotency_in_progress`.'
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/WithdrawRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/WithdrawRequest'
responses:
'200':
description: OK — the payout object, status processing.
content:
application/json:
schema:
type: object
required:
- ok
- result
properties:
ok:
const: true
result:
$ref: '#/components/schemas/Withdrawal'
default:
$ref: '#/components/responses/Error'
parameters:
- name: asset
in: query
required: false
description: Alternative to this field in the body; body wins. Required-field rules apply after merging.
schema:
$ref: '#/components/schemas/WithdrawRequest/properties/asset'
- name: amount
in: query
required: false
description: Alternative to this field in the body; body wins. Required-field rules apply after merging.
schema:
$ref: '#/components/schemas/WithdrawRequest/properties/amount'
- name: spend_id
in: query
required: false
description: Alternative to this field in the body; body wins. Required-field rules apply after merging.
schema:
$ref: '#/components/schemas/WithdrawRequest/properties/spend_id'
- name: address_id
in: query
required: false
description: Alternative to this field in the body; body wins. Required-field rules apply after merging.
schema:
$ref: '#/components/schemas/WithdrawRequest/properties/address_id'
- name: address
in: query
required: false
description: Alternative to this field in the body; body wins. Required-field rules apply after merging.
schema:
$ref: '#/components/schemas/WithdrawRequest/properties/address'
- name: network
in: query
required: false
description: Alternative to this field in the body; body wins. Required-field rules apply after merging.
schema:
$ref: '#/components/schemas/WithdrawRequest/properties/network'
- name: memo
in: query
required: false
description: Alternative to this field in the body; body wins. Required-field rules apply after merging.
schema:
$ref: '#/components/schemas/WithdrawRequest/properties/memo'
- name: comment
in: query
required: false
description: Alternative to this field in the body; body wins. Required-field rules apply after merging.
schema:
$ref: '#/components/schemas/WithdrawRequest/properties/comment'
- name: payload
in: query
required: false
description: Alternative to this field in the body; body wins. Required-field rules apply after merging.
schema:
$ref: '#/components/schemas/WithdrawRequest/properties/payload'
- name: webhook_url
in: query
required: false
description: Alternative to this field in the body; body wins. Required-field rules apply after merging.
schema:
$ref: '#/components/schemas/WithdrawRequest/properties/webhook_url'
/getWithdrawals:
get:
tags:
- withdrawals
operationId: getWithdrawals
summary: List on-chain withdrawals
description: 'Scope: `read`. Newest first. The app''s on-chain payouts — withdraw calls
and the address payouts sent from the app''s Payouts screen alike — in
the withdraw result shape. Unparsable ids and unknown status words
match nothing.'
parameters:
- name: asset
in: query
schema:
type: string
description: Filter by asset code.
- name: withdrawal_ids
in: query
schema:
type: string
description: Comma-separated withdrawal_id UUIDs.
- name: spend_id
in: query
schema:
type: string
description: Exact match.
- name: status
in: query
schema:
type: string
enum:
- processing
- completed
- failed
description: Case-insensitive.
- name: offset
in: query
schema:
type: integer
default: 0
- name: count
in: query
schema:
type: integer
default: 100
minimum: 1
maximum: 1000
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
required:
- ok
- result
properties:
ok:
const: true
result:
type: object
required:
- items
properties:
items:
type: array
items:
$ref: '#/components/schemas/Withdrawal'
default:
$ref: '#/components/responses/Error'
/getWithdrawFees:
get:
tags:
- withdrawals
operationId: getWithdrawFees
summary: Withdrawal fees and minimums
description: 'Scope: `read`.
One row per enabled asset and network — the fee and minimum that
withdraw applies. Fees can change; read them again before a
withdrawal. Specific errors: `400 unknown_asset` (unknown `asset`
filter); an unknown `network` filter returns an empty array.'
parameters:
- name: asset
in: query
schema:
type: string
description: Only this asset.
- name: network
in: query
schema:
type: string
description: Only this network code (case-insensitive).
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
required:
- ok
- result
properties:
ok:
const: true
result:
type: array
items:
$ref: '#/components/schemas/WithdrawFee'
default:
$ref: '#/components/responses/Error'
/getWithdrawAddresses:
get:
tags:
- withdrawals
operationId: getWithdrawAddresses
summary: Saved withdrawal addresses
description: 'Scope: `read`. Oldest first.
The app''s saved withdrawal addresses, where a server reads the
`address_id` to pass to withdraw. Read-only: addresses are added and
removed in the app only, with the owner''s PIN or biometrics.'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
required:
- ok
- result
properties:
ok:
const: true
result:
type: object
required:
- saved_only
- items
properties:
saved_only:
type: boolean
description: True while the owner's saved-addresses-only safeguard is on.
items:
type: array
items:
$ref: '#/components/schemas/WithdrawAddress'
default:
$ref: '#/components/responses/Error'
components:
schemas:
AmountInput:
type: string
minLength: 1
maxLength: 40
description: Positive amount as a decimal string (not a JSON number). Surrounding whitespace and exponent notation are accepted. Crypto rounds to asset precision, midpoint away from zero, and must remain positive; fiat requires exact positive cents. Values must fit the server decimal parser and scaling arithmetic.
pattern: ^\s*\+?(?=[0-9.]*[1-9])(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?\s*$
WithdrawAddress:
type: object
properties:
address_id:
type: string
format: uuid
description: The id to pass to withdraw.
network:
type: string
address:
type: string
memo:
type:
- string
- 'null'
label:
type: string
description: The owner's name for the address; can be empty.
usable_at:
type: string
format: date-time
description: When the address can first be used.
usable:
type: boolean
description: False before usable_at — a withdrawal to it returns 409 address_pending.
required:
- address_id
- network
- address
- memo
- label
- usable_at
- usable
AmountMinor:
type: string
description: The integer minor-unit amount as a string (wei-scale values overflow the JS Number type).
examples:
- '10500000'
pattern: ^[0-9]+$
WithdrawRequest:
type: object
required:
- asset
- amount
- spend_id
properties:
asset:
type: string
minLength: 2
maxLength: 16
amount:
allOf:
- $ref: '#/components/schemas/AmountInput'
description: The amount to deliver; the network fee is charged on top from the app balance.
spend_id:
type: string
minLength: 1
maxLength: 64
description: Required idempotency key, shared with transfer.
address_id:
anyOf:
- type: string
maxLength: 64
description: A saved address (getWithdrawAddresses); required under saved-addresses-only. Exactly one of address_id / address.
- type: 'null'
address:
anyOf:
- type: string
maxLength: 128
description: The destination address. Exactly one of address_id / address.
- type: 'null'
network:
anyOf:
- type: string
maxLength: 16
description: Network code; needed when the address is valid on several of the asset's networks. A saved address uses its own network.
- type: 'null'
memo:
anyOf:
- type: string
maxLength: 128
description: Memo / tag for address; only networks that support one. Not allowed with address_id.
- type: 'null'
comment:
anyOf:
- type: string
maxLength: 1024
description: Your note, returned in the object and webhooks; not sent to the blockchain.
- type: 'null'
payload:
anyOf:
- $ref: '#/components/schemas/OperationPayload'
- type: 'null'
webhook_url:
anyOf:
- $ref: '#/components/schemas/OperationWebhookUrl'
- type: 'null'
ErrorEnvelope:
type: object
required:
- ok
- error
properties:
ok:
const: false
error:
type: object
required:
- code
- name
properties:
code:
type: integer
description: Duplicates the HTTP status (400/401/403/404/409/429/503/500).
name:
type: string
description: Machine-readable error name to branch on, e.g. "insufficient_funds".
Amount:
type: string
description: Non-negative fixed-point decimal string in whole-coin (or fiat) units, including zero balances and fees. Never a JSON number.
examples:
- '10.5'
pattern: ^[0-9]+(?:\.[0-9]+)?$
Withdrawal:
type: object
description: The payout object — an on-chain withdrawal from the app balance (withdraw, getWithdrawals, and the kind=withdrawal variant of transfer webhooks). Same envelope shape as Transfer plus chain fields; distinguish it by kind=withdrawal.
properties:
kind:
type: string
const: withdrawal
transfer_id:
type: integer
description: Numeric withdrawal id; a separate id namespace from user transfers. Use kind and hash to distinguish.
hash:
type: string
format: uuid
user_id:
type: 'null'
recipient_username:
type: 'null'
asset:
type: string
amount:
$ref: '#/components/schemas/Amount'
amount_minor:
$ref: '#/components/schemas/AmountMinor'
fee_minor:
allOf:
- $ref: '#/components/schemas/AmountMinor'
description: The network fee charged on top of the amount, in minor units.
spend_id:
type: string
comment:
type:
- string
- 'null'
status:
type: string
enum:
- processing
- completed
- failed
description: processing = held, delayed or broadcast; completed = confirmed on chain; failed = the hold (amount + fee) came back to the app balance.
created_at:
type:
- string
- 'null'
format: date-time
completed_at:
type:
- string
- 'null'
format: date-time
expires_at:
type: 'null'
invite_url:
type: 'null'
network:
type: string
address:
type: string
memo:
type:
- string
- 'null'
txid:
type:
- string
- 'null'
description: Null until the transaction is broadcast.
withdrawal_id:
type: string
format: uuid
withdrawal_status:
type: string
enum:
- pending
- delayed
- broadcast
- confirmed
- failed
- rejected
- cancelled
description: The detailed withdrawal state.
error:
type:
- string
- 'null'
description: Failure detail when status=failed; null otherwise.
payload:
type: string
description: Present only when the withdrawal was created with payload.
required:
- kind
- transfer_id
- hash
- user_id
- recipient_username
- asset
- amount
- amount_minor
- fee_minor
- spend_id
- comment
- status
- created_at
- completed_at
- expires_at
- invite_url
- network
- address
- memo
- txid
- withdrawal_id
- withdrawal_status
- error
OperationWebhookUrl:
type: string
maxLength: 256
description: This operation's own webhook address — an absolute public HTTPS URL, no embedded credentials, surrounding spaces trimmed. Every update of the operation goes here instead of the app's webhook URL, regardless of the app's event selection. An empty string means the app's URL. Not returned in objects. With a spend_id it is part of the compared request.
OperationPayload:
type: string
maxLength: 4096
description: Your own data, echoed in the object and its webhooks. An empty string means none.
WithdrawFee:
type: object
properties:
asset:
type: string
network:
type: string
fee:
allOf:
- $ref: '#/components/schemas/Amount'
description: The network fee charged on top of the amount.
fee_empty:
type:
- string
- 'null'
description: The fee to an address that was never used, on networks that charge more for it; null elsewhere.
fee_asset:
type: string
min_amount:
allOf:
- $ref: '#/components/schemas/Amount'
description: The smallest amount that can be withdrawn.
decimals:
type: integer
required:
- asset
- network
- fee
- fee_empty
- fee_asset
- min_amount
- decimals
responses:
Error:
description: 'Error — `{"ok": false, "error": {"code": <HTTP status>, "name":
"<machine_name>"}}` with the same HTTP status on the wire. See the
operation description for its specific error names and the API
description for the common ones.
'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
securitySchemes:
apiToken:
type: apiKey
in: header
name: TgPayCrypto-API-Token
description: The canonical token header. The token is shown once, at app creation or rotation.
apiTokenLegacy:
type: apiKey
in: header
name: TgCryptoPay-API-Token
description: The canonical header's name before 2026-09-07 — still accepted, so integrations built earlier keep working unchanged.
apiTokenCompat:
type: apiKey
in: header
name: Crypto-Pay-API-Token
description: Accepted token header alias. The first non-empty canonical/legacy/compatibility header wins, in that order.
externalDocs:
description: Merchant API reference (developer docs)
url: https://docs.tgpaycrypto.com/crypto-pay-api-reference/