POST /v1/cell-token
Exchange an API Key for a restricted Cell token
API Keys only; MCP OAuth is not accepted. Requires orders:read. Returns only orders:read/buy/sell/cancel granted by the parent Key. Each token binds one enabled chain and Cell, lasts at most 60 seconds and cannot outlive the Key. Revocation, rotation or narrowing prevents new grants; existing tokens expire within 60 seconds. Already accepted orders remain active. Cache tokens in memory and refresh before expiry. Cell enforces the signed IP allowlist. Direct status and SSE read all orders belonging to this account on that Cell; cancellation may affect existing account orders.
所需 Scope:orders:read 请求体 application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
chain | enum ("solana" | "bsc" | "robinhood") | ✓ | Chain whose enabled Cell will receive the token. Each chain requires a separate token. |
响应
200 — Restricted token; Cache-Control: no-store.
| 字段 | 类型 | 必填 | 约束 | 说明 |
|---|---|---|---|---|
data | object | ✓ | Response payload. | |
data.token | string | ✓ | Short-lived restricted bearer JWT. Send to the returned gateway in Authorization, never a URL. | |
data.expires_at | string | ✓ | UTC expiration, at most 60 seconds after issue and no later than the API Key expiry. Refresh before expiry. | |
data.cell_id | string | ✓ | pattern: ^[a-z0-9-]{1,32}$ | The single Cell audience bound into this token. |
data.gateway_url | string | ✓ | Configured HTTPS gateway for direct order operations. | |
data.scopes | array<enum ("orders:read" | "orders:buy" | "orders:sell" | "orders:cancel")> | ✓ | Order grants inherited from the API Key. Read and cancel apply to all owned account orders on this Cell. | |
meta | object | ✓ | Request id, plus paging fields when this operation is a list. | |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
401 — unauthorized (missing/invalid/revoked/expired Bearer token)
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
403 — insufficient_scope / ip_not_allowed
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
429 — rate_limited (Retry-After response header set)
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
500 — internal_error
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
curl -X POST "https://api.apm.fun/v1/cell-token" \
-H "Authorization: Bearer apm_live_<prefix>.<secret>" \
-H "Content-Type: application/json" \
-d '{
"chain": "solana"
}' {
"data": {
"token": "string",
"expires_at": "2026-01-15T09:30:00Z",
"cell_id": "cfg_8f2a1c9b",
"gateway_url": "string",
"scopes": [
"orders:read"
]
},
"meta": {
"request_id": "cfg_8f2a1c9b"
}
}