API reference
Tokens
The tokens you can sweep on each chain: the listed ones, which you may turn off, and any other ERC-20 you enable by its address. How they are checked and counted: Tokens.
List tokens
Section titled “List tokens”GET/v1/tokens
The tokens you can sweep on each chain, or could: first the base tokens, which every account may sweep unless it
turns one off (the chain’s native coin, then the tokens Portuna lists on the chain), then the tokens you added
yourself, oldest first. A sweep is accepted only for a token that is active here. Each token shows what you
pay for it (tariff) and its conventional cost (baseline); a token of your own also what the check found
when you added it.
Parameters
Section titled “Parameters”| Name | In | Type | Description |
|---|---|---|---|
chain_id | query | ChainID | Only this chain. |
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Your tokens on every chain, or on the one asked for. Returns the fields below. |
400 | invalid_query: a query parameter is not valid; message says which. |
401 | unauthorized: no API key, an unknown one or a revoked one. |
403 | partner_disabled: your account is disabled. |
Response body
Section titled “Response body”| Field | Type | Description |
|---|---|---|
tokens required | array of Token |
Example request
Section titled “Example request”curl "https://api-testnet.portuna.io/v1/tokens?chain_id=11155111" \ -H "Authorization: Bearer $PORTUNA_API_KEY"Example response
Section titled “Example response”{ "tokens": [ { "chain_id": 11155111, "token": "native", "symbol": "ETH", "decimals": 18, "source": "preset", "status": "active", "tariff": { "kind": "base", "rule": "gas_markup", "rate_bps": 1000, "since": null, "valid_until": null, "next_rate_bps": null }, "baseline": { "transfer_gas": null, "conventional_gas": { "new": 21000, "existing": 21000 }, "version": null, "method": "fork", "measured_at": null, "block": null, "status": "measured", "next": null } }, { "chain_id": 11155111, "token": "USDT", "address": "0x3809a97a7a25C8bA577027c0AE2D81a09cdA1a2f", "symbol": "USDT", "decimals": 6, "source": "preset", "status": "active", "tariff": { "kind": "base", "rule": "conventional_share", "rate_bps": 7000, "since": null, "valid_until": null, "next_rate_bps": null }, "baseline": { "transfer_gas": 32633, "conventional_gas": { "new": 237233, "existing": 53633 }, "version": null, "method": "fork", "measured_at": null, "block": null, "status": "measured", "next": null } }, { "chain_id": 11155111, "token": "0x12ad3a32eF68aC3C8798a4782c8CF543204078e6", "address": "0x12ad3a32eF68aC3C8798a4782c8CF543204078e6", "symbol": "ODD", "name": "Odd Token", "decimals": 18, "source": "custom", "status": "refused", "reason": "failing", "provider": { "status": "testnet" }, "check": { "result": "ok", "method": "simulate", "checked_at": "2026-10-10T16:05:45Z" }, "warnings": [ { "code": "testnet", "message": "testnet: providers know no contracts here; compare the address with the issuer's source" } ], "tariff": { "kind": "custom_default", "rule": "conventional_share", "rate_bps": 8000, "since": null, "valid_until": null, "next_rate_bps": null }, "baseline": { "transfer_gas": 41870, "conventional_gas": { "new": 246470, "existing": 62870 }, "version": 1, "method": "simulate", "measured_at": "2026-10-10T16:05:45Z", "block": 9405112, "status": "measured", "next": null }, "created_at": "2026-10-10T16:05:47Z" }, { "chain_id": 11155111, "token": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "address": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "symbol": "EURX", "name": "Example Euro", "decimals": 18, "source": "custom", "status": "active", "provider": { "status": "testnet" }, "check": { "result": "ok", "method": "simulate", "checked_at": "2026-10-11T09:12:28Z" }, "warnings": [ { "code": "testnet", "message": "testnet: providers know no contracts here; compare the address with the issuer's source" } ], "tariff": { "kind": "custom_default", "rule": "conventional_share", "rate_bps": 8000, "since": null, "valid_until": null, "next_rate_bps": null }, "baseline": { "transfer_gas": 34512, "conventional_gas": { "new": 239112, "existing": 55512 }, "version": 1, "method": "simulate", "measured_at": "2026-10-11T09:12:28Z", "block": 9412345, "status": "measured", "next": null }, "created_at": "2026-10-11T09:12:30Z" } ]}Enable a token
Section titled “Enable a token”POST/v1/tokens
Turns a base token you turned off on again, the native coin ("address": "native") included, or adds any other
ERC-20 by its contract address, on testnets and on mainnet. A token of your own is added after the same check
as POST /v1/tokens/check, and only with confirm: true: you confirm that you compared its card with the
issuer’s site or a block explorer. Portuna does not vouch for a token you add; it checks what it can on the
chain, and runs the token the way your sweeps will move it.
A token whose transfer costs more than 80,000 gas is swept at once, priced at 80,000 until Portuna has reviewed
its conventional cost (baseline.status: review). Adding a token that was refused checks it again and starts
its count of failed sweeps anew, except a token turned off after 5 failed sweeps, which only support turns on
again.
Whatever a token’s calls return, a sweep of it counts only what the token’s own Transfer event from the
deposit address to the hot wallet says: a token that keeps a fee on transfers is swept at the amount that
arrived, and one that reports success without a Transfer event fails with transfer_not_confirmed. A
token of your own whose sweeps fail on chain 5 times in a row for the token’s fault is refused (failing),
and you get a token.refused event.
Request body
Section titled “Request body”| Field | Type | Description |
|---|---|---|
chain_id required | ChainID | The chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key. |
address required | string | The token’s contract address, or native for the chain’s coin. |
confirm | boolean | Required, as true, to add a token of your own: you compared its card (POST /v1/tokens/check) with the issuer’s site or a block explorer. Not needed for a base token. |
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | The token was added already, or is a base token, or was added again after a refusal. Returns Token. |
201 | The token is added. Returns Token. |
400 | invalid_json: the body is not JSON, is over 64 KiB or has unknown fields. |
401 | unauthorized: no API key, an unknown one or a revoked one. |
403 | partner_disabled: your account is disabled. |
409 | too_many_tokens: you have 100 tokens of your own on this chain; remove one first. token_needs_support: the token was turned off after 5 sweeps in a row failed because of it; contact support to have it turned on. |
422 | unknown_chain; invalid_address; confirmation_required: a token of your own needs confirm: true. The refusals of POST /v1/tokens/check. |
429 | rate_limited: too many checks of tokens on your account, or on the chain right now; try again after the seconds of Retry-After. |
503 | chain_unavailable: the chain’s node did not respond to the check; try again later. token_check_unavailable: tokens cannot be added on this chain for now. |
Example request
Section titled “Example request”curl -X POST "https://api-testnet.portuna.io/v1/tokens" \ -H "Authorization: Bearer $PORTUNA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 11155111, "address": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "confirm": true}'Example response
Section titled “Example response”{ "chain_id": 11155111, "token": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "address": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "symbol": "EURX", "name": "Example Euro", "decimals": 18, "source": "custom", "status": "active", "provider": { "status": "testnet" }, "check": { "result": "ok", "method": "simulate", "checked_at": "2026-10-11T09:12:28Z" }, "warnings": [ { "code": "testnet", "message": "testnet: providers know no contracts here; compare the address with the issuer's source" } ], "tariff": { "kind": "custom_default", "rule": "conventional_share", "rate_bps": 8000, "since": null, "valid_until": null, "next_rate_bps": null }, "baseline": { "transfer_gas": 34512, "conventional_gas": { "new": 239112, "existing": 55512 }, "version": 1, "method": "simulate", "measured_at": "2026-10-11T09:12:28Z", "block": 9412345, "status": "measured", "next": null }, "created_at": "2026-10-11T09:12:30Z"}Check a token
Section titled “Check a token”POST/v1/tokens/check
Checks a token by its contract address without adding it, and returns its card: what the contract says of itself, what CoinGecko or DefiLlama know of the address (on mainnet; providers know no testnet contracts), how a test sweep went, warnings, and the tariff and conventional cost it would get. Compare the card with the issuer’s site or a block explorer before you add the token.
The check runs on the chain as it is, in a simulation, sending nothing: the address must have contract code,
must not be an account delegated with EIP-7702 nor a Portuna contract, decimals() must return 0 to 36,
balanceOf must read a stored balance, and a transfer must work and emit a Transfer event. Then it runs your
sweep’s own path, the gas wallet calling the batcher and the deposit address delegated to its delegate, for one
deposit address and for three in one batch, and measures the token’s transfer for its conventional cost. A token
whose code makes it fail for good (balance_not_stored, no_transfer_event, sweep_incompatible,
invalid_decimals) is blocked for every account at once. A token that refuses transfers for now
(transfer_fails) is not, and may be checked again later.
Request body
Section titled “Request body”| Field | Type | Description |
|---|---|---|
chain_id required | ChainID | The chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key. |
address required | string | The token’s contract address, or native for the chain’s coin. |
confirm | boolean | Ignored here. |
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | The token’s card. Returns TokenCard. |
400 | invalid_json: the body is not JSON, is over 64 KiB or has unknown fields. |
401 | unauthorized: no API key, an unknown one or a revoked one. |
403 | partner_disabled: your account is disabled. |
422 | unknown_chain; invalid_address; token_blocked: Portuna blocked this token, and nobody can sweep it (details.category, details.public_note). The token failed a check: not_a_contract (no code at the address), delegated_account (an account delegated with EIP-7702), own_contract (a Portuna contract), invalid_decimals (decimals() fails or returns more than 36), balance_not_stored (balanceOf reads no stored balance: a fake), no_transfer_event (a transfer emits no Transfer event, so nothing would confirm a sweep), transfer_fails (the token refuses transfers now; details.cause is its reason) or sweep_incompatible (transfers work, your sweep cannot move the token; details.cause: item_gas, a sweep needs more than the 300,000 gas a batch gives an item; balance_hidden, the token shows a delegated address no balance; tx_origin, plain transfers work and your sweep does not, most likely as the token wants the sender to be the transaction’s origin, which Portuna looks into; sender_code, it refuses a sender with code; batch_limit, it moves one address of a batch but not several). |
429 | rate_limited: too many checks of tokens on your account, or on the chain right now; try again after the seconds of Retry-After. |
503 | chain_unavailable: the chain’s node did not respond to the check; try again later. token_check_unavailable: tokens cannot be added on this chain for now. |
Example request
Section titled “Example request”curl -X POST "https://api-testnet.portuna.io/v1/tokens/check" \ -H "Authorization: Bearer $PORTUNA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "chain_id": 11155111, "address": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9"}'Example response
Section titled “Example response”{ "chain_id": 11155111, "address": "0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "testnet": true, "explorer_url": "https://sepolia.etherscan.io/token/0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9", "source": "custom", "status": "new", "contract": { "symbol": "EURX", "name": "Example Euro", "decimals": 18, "total_supply": "1000000000000000000000000", "proxy": "", "implementation": null, "hints": [] }, "provider": { "status": "testnet" }, "check": { "result": "ok", "method": "simulate", "transfer_gas": 34512, "sweep_gas": 19804, "fee_bps": 0, "dust": false, "block": 9412345, "checked_at": "2026-10-11T09:12:28Z" }, "warnings": [ { "code": "testnet", "message": "testnet: providers know no contracts here; compare the address with the issuer's source" } ], "tariff": { "kind": "custom_default", "rule": "conventional_share", "rate_bps": 8000, "since": null, "valid_until": null, "next_rate_bps": null }, "baseline": { "transfer_gas": 34512, "conventional_gas": { "new": 239112, "existing": 55512 }, "version": 1, "method": "simulate", "measured_at": "2026-10-11T09:12:28Z", "block": 9412345, "status": "measured", "next": null }}Disable a token
Section titled “Disable a token”DELETE/v1/tokens/{chain_id}/{address}
Turns a base token off for your account, the native coin included, or removes a token you added yourself. Its
sweeps that are still queued are rejected with token_disabled; those already sent end as they will.
POST /v1/tokens turns it on again.
Parameters
Section titled “Parameters”| Name | In | Type | Description |
|---|---|---|---|
chain_id required | path | ChainID | The chain. |
address required | path | string | The token’s contract address, or native for the chain’s coin. |
Responses
Section titled “Responses”| Status | Description |
|---|---|
204 | The token is turned off. |
401 | unauthorized: no API key, an unknown one or a revoked one. |
403 | partner_disabled: your account is disabled. |
404 | not_found: there is no such object in your account. |
409 | token_needs_support: the token was turned off after 5 sweeps in a row failed because of it, and stays in your list until support has looked at it. |
Example request
Section titled “Example request”curl -X DELETE "https://api-testnet.portuna.io/v1/tokens/11155111/0xd8bb299F465D010157B980D87C7A5ae3Ea9cA8d9" \ -H "Authorization: Bearer $PORTUNA_API_KEY"