request.mjs, the HTTP script from the quickstart.
Load the profile
Call GET /private/client with thepublic-api:client:read scope. The response describes the token owner. For 403 api_user_disabled, check whether API access is enabled for the account. For api_admin_account_denied, check the exchanger’s restrictions for administrators. For scope_denied, check the key’s scopes. Configure API access
200 response for a key without balance access.
orders for the counts and api_token.scopes to inspect the current key’s access. With public-api:client:balance:read, balance contains available, hold, and currency. Handle null separately from an available balance of "0".
Display exchange history
Request the first page of paid and completed orders, newest first. The example URL already encodes the indexed parameters
filter[status][0] and filter[status][1].
result[]. Use the selected item’s tracking_id or public_id in the detail path. Store both as strings. The operation also accepts the internal positive id and returns the order directly in result. A missing order or an order belonging to another customer returns 404. If an identifier matches multiple orders for the same owner, the API returns 422 with a validation issue for order. Retry the read with the tracking_id from the list.
- Use
status.keyfor application logic and the localizedstatus.namefor display. The catalog returns status definitions inresult.statuses. - Use
filter[status]with a built-in status key or theactiveandfinalgroups. Usefilter[status_id]with numeric IDs for built-in statuses. Combining the two filters returns422. filter[currency]matches the currency code or export designation on either side of the route.filter[amount_min]andfilter[amount_max]apply to the amount the customer gives.- For a long history, start with
pagination=cursor&sort=-id. Passmeta.pagination.next_cursorunchanged on the next request and keep the same filters and sort order. Use page-based pagination to sort bycreated_at. Response format and pagination
Show published reviews
Call GET /private/reviews withpublic-api:reviews:read. For example, filter%5Brating%5D=5 returns reviews rated 5. result[] contains published reviews for orders eligible for public display. The order field is populated for the order owner. Other readers receive null.
filter[order_id] on the review list, use the order’s internal numeric id. A published record with a rating of 0 has no customer rating.
Submit a review for moderation
Take thetracking_id of an order you own and send a signed POST /private/reviews with public-api:reviews:write. If there is no tracking_id, pass public_id or the internal id as a string in order_id. Send one identifier of up to 64 characters. The name and text fields are required and limited to 40 and 200 characters. rating is optional. If you include it, send an integer from 1 to 5.
Save this example as review.json and substitute your own test order identifier.
review.json
201 response contains result.review.id, result.review.rating, and result.review.status.name: "moderation". The review appears in the feed after publication. A customer can submit one review per order. Submitting a review also publishes a review.created event.
If you lose the response, retry with the original body, the same Idempotency-Key, and a fresh signature. While the HTTP receipt is retained, a replay can return it with Idempotency-Replayed: true. After receipt expiry, the same order returns 422 if its review was already saved. The API also returns 422 when review submissions are disabled. An order belonging to another customer returns 404. Idempotency · Error codes