Skip to main content

POST /trending/orders

Create a trending, reactions or other-services order for the end user. The price and discount are decided server-side from the user's account — they are never taken from the request.

The target is resolved and checked exactly as in resolve; the order is then placed with the chosen order type.

Use case​

The user picked a package — place the order and show them how to pay.

Headers​

HeaderRequiredDescription
AuthorizationyesBearer <accessToken>
x-user-idyesEnd-user id, 1–256 chars [A-Za-z0-9_-].
Content-Typeyesapplication/json
Idempotency-Keyno8–128 chars [A-Za-z0-9_-]. See below.

Body​

The target fields are the same as in resolve (service, provider, link, tokenAddress). On top of those:

FieldTypeRequiredDescription
orderTypeIdstringfor dex-trending, other-servicesOne of the ids resolve returned.
quantityintegernoother-services only. Integer within the package's bounds; defaults to its minimum. Ignored for dex-trending (always 1).
items{ orderTypeId, quantity }[]for reactions1–8 entries, no repeated orderTypeId, each orderTypeId one resolve returned, quantity an integer within the bounds resolve shows.
speedstringnoreactions only. One of the speeds from resolve; defaults to normal.

Response 201​

{
"order": {
"orderId": "…",
"providerOrderId": "…",
"items": [ { "orderTypeId": "…", "quantity": 100, "providerOrderId": "…" } ]
},
"target": {
"chain": "solana",
"pairAddress": "…",
"tokenAddress": "…",
"tokenName": "…",
"tokenSymbol": "…"
}
}

order is the order record, including providerOrderId (null when not assigned yet). items appears for reactions orders, each item with its own providerOrderId. Read orderId for every follow-up call; the remaining order fields (status, price, payment details) may gain fields over time.

Idempotency​

Send an Idempotency-Key so a retry after a timeout does not create a second order.

  • A retry with the same key returns the first response (same status and body) with the header Idempotent-Replayed: true.
  • Keys are scoped to your API client and the x-user-id, and kept for 24 hours.
  • 5xx and 429 responses are not stored; the next retry runs again.
  • If the first request is still running, the retry gets 409.
  • A malformed key gets 400.

Errors​

StatusMeaning
400Validation failed; target rejected (see resolve — issues / tokenInfo included); orderTypeId or quantity out of range; repeated items entry; invalid speed; malformed Idempotency-Key; or the order was rejected (message says why).
401 / 403Token missing, invalid, expired or revoked / API inactive.
403 / 409 / 429The order was refused; message says why.
409Also: a request with the same Idempotency-Key is still running.
429Per-client rate limit hit.
503Trending disabled or unavailable, or idempotency storage is unavailable (only when Idempotency-Key is sent).

Example​

curl -X POST "$BASE_URL/trending/orders" \
-H "Authorization: Bearer $ACCESS" \
-H "x-user-id: $USER_ID" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"service": "dex-trending",
"link": "https://dexscreener.com/solana/<pair>",
"orderTypeId": "<orderTypeId>"
}'

Reactions:

curl -X POST "$BASE_URL/trending/orders" \
-H "Authorization: Bearer $ACCESS" \
-H "x-user-id: $USER_ID" \
-H "Content-Type: application/json" \
-d '{
"service": "reactions",
"link": "https://dexscreener.com/solana/<pair>",
"items": [ { "orderTypeId": "<orderTypeId>", "quantity": 100 } ],
"speed": "normal"
}'