Freeport Seller API

Go-live checklist

Everything on this page is written somewhere else in these guides or in the reference. It is gathered here in the order you meet it, for the day your software moves from a sandbox key to a live one. Each line says what to check, and most link to the page that explains it.

Keys and access

  • Live access is approved. You apply from Integrations with a sentence about what your software does, and an operator reads your account. Live keys need a second factor on the account and are minted behind a fresh code. See Getting started.
  • Each live key has only the scopes its software uses. A key keeps the scopes it was minted with. A route whose scope the key lacks answers 403 insufficient_scope and names the scope. disputes:write is a scope of its own and is not part of orders:write, because it gives money back. See Keys, scopes and limits.
  • Each machine and tool has a key of its own. Up to twenty keys can be live at once, so one can be revoked without touching the rest, and a revoked key ends within seconds everywhere. A key can carry a list of addresses and an expiry from the moment it is minted. See Keys, scopes and limits.
  • What is shown once has been kept. A key is shown when it is minted and never again. So is a signing secret. A webhook endpoint's secret is shown when the endpoint is created and again only when it is rotated.
  • Signing is decided for each key. A bearer key is enough for most tools. If a key is switched to signed requests, every request with it must carry Freeport-Timestamp and Freeport-Signature, and an unsigned one is refused with 401 signature_required. A signature is accepted once, inside a five-minute window. See Signing requests.

The sandbox and production

  • The sandbox is running. It is switched on when a seller asks for API access, and until it is, sandbox-api.freeport.gg does not answer. Write to support@freeport.gg to have it started. See The sandbox.
  • The whole path has run there. Prove the key with GET /v1/ping, read the catalog, put a listing up, add a webhook endpoint, then buy from yourself with POST /v1/sandbox/orders, accept, deliver and confirm as the buyer. If your software moves disputes, rehearse the buyer's half as well. The Postman collection has a request for every step. See Getting started and Disputes.
  • The host and the key are the only difference. The sandbox is https://sandbox-api.freeport.gg/v1 with fp_test_ keys, and production is https://api.freeport.gg/v1 with fp_live_ keys. A key on the wrong host is refused before any lookup, with 401 wrong_environment.
  • Nothing calls /v1/sandbox/* on production. Those routes answer 404 sandbox_only anywhere but the sandbox, and act only as the synthetic buyer.
  • Nothing depends on an id read once from the sandbox. The sandbox can be rebuilt at any time, without notice, and its catalog's ids change when it is while its slugs do not. Build a crosswalk of your own names once with POST /v1/catalog/resolve and store the slugs. See Listings and stock sync.
  • You know what production does with money. The first table in Getting started says what each environment does with a payment, and so whether a live key receives orders yet. Read it on the day you go live; it is the one place that says.

Webhooks and their signatures

  • The endpoint is an address we will deliver to. It is HTTPS, on port 443 or none. A URL with another port, with credentials or a fragment, that does not resolve, or that resolves to a private, loopback or link-local address is refused with 400 unsafe_url. You can have five endpoints. See Webhooks.
  • Every delivery is verified before it is trusted. Compute HMAC-SHA256 with the endpoint's secret over ${t}.${body}, where t is the timestamp from Freeport-Signature and body is the raw bytes exactly as received, not re-serialised. Accept the delivery if any v1 value equals your result, compared in constant time, and refuse a t more than five minutes from now.
  • A secret rotation does not drop deliveries. For a day after POST /v1/webhooks/{id}/rotate-secret each delivery carries two v1 values, one for each secret, so a handler that accepts any of them is switched over without a gap.
  • The handler answers quickly and works afterwards. Any 2xx will do. A delivery waits ten seconds for an answer and never follows a redirect, so a 3xx is a failed attempt.
  • The handler deduplicates on Freeport-Event-Id. The same event never arrives under another id. A failed attempt is retried after one minute, five, thirty, two hours, six, twelve, then daily, ten attempts in all.
  • The handler does not rely on order. Ordering across events is not guaranteed. An event that changes an order's state carries seq, and the order is fetched on receipt rather than trusting the body's state to be the latest.
  • A disabled endpoint is a case you have planned for. An endpoint that has accepted nothing for three days is disabled at its next failed attempt, with an email to the account and a row in the audit log. Re-enable it from the console once it is fixed, and replay what it missed from the delivery log.
  • You have decided what your software does when the platform acts on the account. account.trading_status_changed says the account was suspended or reinstated, account.selling_changed says its listings were hidden from buyers or returned, and account.lane_selling_changed says the same of one category. Resuming after missed orders is done by a person in the seller dashboard, never by a key. Each event's fields are under Events in the reference.

Idempotency

  • Every write you might retry carries an Idempotency-Key. Any string up to 200 characters that you will not reuse for a different request. A retry with the same key gets the first answer back with Idempotent-Replayed: true, for a day. See Keys, scopes and limits.
  • Your retry loop knows every answer a key can give. A 4xx refusal releases the key, so a corrected request under the same key runs. One refusal does change the order: a 409 payment_not_taken on an accept means the buyer's payment could not be taken and the order has ended, so there is nothing to send again. The other answers are these:
AnswerWhat it meansWhat to do
422 idempotency_key_reusedThe same key on a different body or path.Fix the retry loop. The API is telling you of the bug before it costs anything.
400 idempotency_key_invalidThe key is empty or longer than 200 characters.Fix how the key is made. The write did not run.
409 idempotency_in_progressThe first request under that key is still being answered.Retry in a moment and you get its response.
Idempotent-Body: omitted, under the first answer's statusThe first answer was too large to keep.The write completed. Read the resource.
409 idempotency_outcome_unknownThe first attempt ended in a 5xx, or never reported its outcome.The write may have landed before the failure. Check whether it did, then use a new key.
503 idempotency_unavailableThe key could not be checked.Send the request again with the same key.

Rate limits

  • You know your budgets. They are per key, per minute, sliding, in four buckets: reads, writes, bulk (syncs and code uploads) and chat. A new seller gets the base budget, and standard and trusted sellers get two and three times it. The base figures are under Conventions in the reference.
  • The client reads the budget and waits out a 429. Every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset, and a 429 rate_limited carries Retry-After in seconds. Retrying inside the window only spends more of the next one.
  • Nothing polls the order feed in a loop. Webhooks are the best way to hear about an order. Failing that, poll GET /v1/orders/changes with If-None-Match every few seconds: a 304 costs nothing on either side, and a 200 means it is time to read the feed. See Orders and chat.
  • A sheet of stock goes as a sync. A stock sync lands up to a thousand lines a call and applies as one decision in the background, and its calls spend the bulk budget. See Listings and stock sync.

Errors

  • The client switches on the code. Every refusal is { "error": { "code", "message", "requestId" } }. The code is stable, the message is for a person, and the request id is what to quote to support at support@freeport.gg, so keep it with every refusal you log. See Errors, limits and support.
  • The refusals that end a key are told apart from the rest. 401 key_revoked and key_expired mean the key is over and another has to be minted. 401 signature_required, signature_invalid, signature_stale and signature_replayed mean the key is set to signed requests and this request did not pass. 403 account_suspended means reads still work and writes that start something do not.
  • A refused order move is read, not guessed at. A move the order's state forbids is a 409 illegal_transition with the order's current state in the body, so a tool that raced a buyer's cancel learns what happened in one round trip.
  • A validation refusal is read field by field. A 400 validation_failed carries details naming each field and rule that failed.

Then go live

Mint the live key from Integrations behind a fresh code, put it and https://api.freeport.gg/v1 where your software reads its configuration, and call GET /v1/ping. The answer names your key, its scopes and its environment.