This is the end-to-end path for a store, marketplace, or back office that Keysender does not connect to natively: your software records each sale through the API and Keysender delivers the code. It takes four calls to go from a fresh API key to a buyer holding a working code, and the same calls run every day after that.
Make sure you have:
If your platform is one Keysender already connects to, use that integration instead; see Connected channels. Guides for popular automation platforms are being published as those integrations are released.
POST /login with api_key and api_secret, store the access_token, and send it as Authorization: Bearer ... on every call. Details: Get started with the Keysender API.POST /database with name, sku, and type: 0. Use your own product code as the sku; a repeat call with the same SKU returns the same database, so you can run it on every sync. Details: Manage inventory databases with the API.POST /code?database_id=... with an array of {"value": "..."} objects, 1,000 per request at most. Details: Upload and manage codes with the API.POST /transaction/addcustom with payer, quantity, database_id, amount, currency, and name. Keysender picks the codes, sends them with your template, and spends a credit.id against your order immediately. There is no deduplication: a retried call delivers again. Details: Create transactions with the API.GET /transaction/{id}/inventory shows exactly which codes went out, and Transactions in the panel shows the same sale.GET /logout when you retire a token.429, wait and retry with the same body only for reads, never for addcustom.id you receive. It is the only handle you have on a delivery.A test order placed in your own system ends with a delivery email in the buyer's inbox, a transaction under Transactions in the panel, and the database's available count one lower.
quantity_sent on the transaction, the database's available count, and the credit balance.id to make retries safe.401 mid-way: the token expired or was logged out; log in again and continue.id and the time of the calls.When Keysender does not connect natively to the store or marketplace you sell on. For channels it does connect to, the built-in integration records the sale and delivers without any code on your side.
Four: log in, create the product's database, upload codes, and record the sale with /transaction/addcustom. After that, only the sale call runs per order, plus code uploads as stock is replenished.
Never place the API secret in a browser, mobile app, or public repository; never retry a transaction call that already returned 200; and never log in before every request when one token will do.