On this page
API reference
NFTX swaps
Read space in the NFTX V4 vault and review a swap for one holder.
GET /v1/collections/:chainId/:collection/swap/:tokenId/options#
Read eligible output tokens for a Space Poggers V4 swap. Continue with the returned offset.
Path and query parameters#
| Name | Type | Required | Meaning | Default | Limits |
|---|---|---|---|---|---|
chainId |
integer | Yes | NFT chain ID. | — | 1 for this API. |
collection |
address | Yes | Selected Ethereum ERC-721 contract. | — | 20 bytes, 0x prefix. |
tokenId |
decimal string | Yes | NFT identifier. | — | Unsigned 256-bit integer unless specified. |
offset |
integer | No | Output page offset. | 0 | 0–1000000. |
Response fields#
| Field | Type | Meaning |
|---|---|---|
poolId, tokenIdIn, asOf, blockNumber |
strings and integer | Vault, input NFT, observation time and block. |
data, nextOffset |
array and integer or null | Output token IDs and image paths, and next offset. |
Cache. Cache-Control: no-store.
Limit. Chain reads, 60 per minute per visitor.
Errors#
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request |
A path, query or body field failed validation. |
| 404 | not_found |
The collection, feed or venue is unavailable on this site. |
| 429 | rate_limited |
The visitor limit was reached. Retry after 60 seconds. |
| 422 | unprocessable |
The current order, account or NFT did not pass the checks described above. |
| 502 | upstream_error |
A venue, chain read or simulation service could not return a usable result. |
Example request#
bash
curl https://marketplace.example/v1/collections/1/0x4a8b01e437c65fa8612e8b699266c0e0a98ff65c/swap/344/optionsjs
const response = await fetch("https://marketplace.example/v1/collections/1/0x4a8b01e437c65fa8612e8b699266c0e0a98ff65c/swap/344/options");
const result = await response.json();Example response#
json
{
"poolId": "v4",
"tokenIdIn": "344",
"asOf": 1796384870760,
"blockNumber": "26556588",
"data": [
{
"tokenId": "427",
"image": "/img/1/0x4a8b01e437c65fa8612e8b699266c0e0a98ff65c/427"
},
{
"tokenId": "591",
"image": "/img/1/0x4a8b01e437c65fa8612e8b699266c0e0a98ff65c/591"
},
…
],
"nextOffset": null
}POST /v1/collections/:chainId/:collection/swap/:tokenId/review#
Check ownership, current inventory and the simulated Space Poggers V4 swap. Premium listings are excluded.
Note. The holder’s wallet sends the required approval, then requests a fresh review for the swap call. The server never signs or sends. The example response uses the indexed holder.
Path and query parameters#
| Name | Type | Required | Meaning | Default | Limits |
|---|---|---|---|---|---|
chainId |
integer | Yes | NFT chain ID. | — | 1 for this API. |
collection |
address | Yes | Selected Ethereum ERC-721 contract. | — | 20 bytes, 0x prefix. |
tokenId |
decimal string | Yes | NFT identifier. | — | Unsigned 256-bit integer unless specified. |
Request body#
| Name | Type | Required | Meaning | Default | Limits |
|---|---|---|---|---|---|
owner |
address | Yes | Holder of the incoming NFT. | — | — |
tokenIdOut |
decimal string | Yes | Output token chosen from the options. | — | uint256. |
json
{
"owner": "0x1111111111111111111111111111111111111111",
"tokenIdOut": "427"
}Response fields#
| Field | Type | Meaning |
|---|---|---|
poolId, owner, tokenIdIn, tokenIdOut, blockNumber |
strings | Vault, holder, input and output NFTs and simulation block. |
protocolFeeWei |
decimal string | Protocol fee. |
approval |
object or null | Unsigned approval containing target, calldata, value and a human-readable label. |
transaction |
object or null | An unsigned call with chainId, target to, calldata data and value. |
Cache. Cache-Control: no-store.
Limit. Chain reads, 60 per minute per visitor.
Errors#
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request |
A path, query or body field failed validation. |
| 404 | not_found |
The collection, feed or venue is unavailable on this site. |
| 429 | rate_limited |
The visitor limit was reached. Retry after 60 seconds. |
| 422 | unprocessable |
The current order, account or NFT did not pass the checks described above. |
| 502 | upstream_error |
A venue, chain read or simulation service could not return a usable result. |
| 503 | upstream_error |
The response referenced a contract that the Worker blocks. |
Example request#
bash
curl \
-X POST \
-H 'Content-Type: application/json' \
--data '{"owner":"0x1111111111111111111111111111111111111111","tokenIdOut":"427"}' \
https://marketplace.example/v1/collections/1/0x4a8b01e437c65fa8612e8b699266c0e0a98ff65c/swap/344/reviewjs
const response = await fetch("https://marketplace.example/v1/collections/1/0x4a8b01e437c65fa8612e8b699266c0e0a98ff65c/swap/344/review", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"owner": "0x1111111111111111111111111111111111111111", "tokenIdOut": "427"})
});
const result = await response.json();Example response#
json
{
"poolId": "v4",
"owner": "0x1111111111111111111111111111111111111111",
"tokenIdIn": "344",
"tokenIdOut": "427",
"blockNumber": "26556608",
"protocolFeeWei": "0",
"approval": {
"chainId": 1,
"to": "0x4a8b01e437c65fa8612e8b699266c0e0a98ff65c",
"value": "0x0",
"label": "Approve Space Poggers #344 for NFTX Locker",
"data": "0x095ea7b3000000000000000000000000b4c5b5235b98114e9dc227b54e088c11680b23850000000000000000000000000000000000000000000000000000000000000158"
},
"transaction": null
}