KeysenderhomeSupport help center home
IntegrationsPricingDemoSubmit a ticketTicket statusLog inStart free
KeysenderSupport home

The Keysender help center. Setup, connected channels, orders, and delivery, for digital product vendors.

Product

  • Integrations
  • Pricing
  • Demo
  • API

Resources

  • Help Center
  • Submit a ticket
  • Ticket status
  • Request an integration
  • Connect a supplier
  • Insights
  • Refer & earn
  • Contact sales

Legal

  • Privacy Policy
  • Terms & Conditions
  • Violation Report

Bought from a seller?

Keysender is the delivery platform, not the seller. If your order has not arrived or is not as described, contact the seller directly. They can help fastest.

Get help with your order →
© 2026 Keysender. Made in the USA.
Keysender is the delivery system, not the seller.
Back
Help CenterDevelopers and APIUploading and managing codes with the API

Uploading and managing codes with the API

Last updated Aug 26, 2026Developers and API

Reading this in another language? Use your browser's built-in translate option. Button and field names stay in English on purpose, to match what you see in Keysender.

Overview

Codes are the stock inside a database: the keys, licenses, vouchers, or files Keysender delivers when an order is paid. The Code endpoints let your software top up a database in bulk, check what is available or already used, flag a code to go out first, and remove a code that should never be sent.

TL;DR

  • Codes are the stock inside a database: text values or files, uploaded with POST /code.
  • Send at most 1,000 codes per request; anything past that is silently dropped.
  • List with GET /codes and filters, flip status/sendfirst with PUT /code, and remove an unused code with DELETE /code.

Before you start

Make sure you have:

  • A bearer token from POST /login and the base URL https://panel.keysender.com/api/v1.0.
  • The id of the database you are filling (see Managing inventory databases with the API).

A code has these fields: id, type (1 text, 2 file), value, status (0 available, 1 used), keyusage, sendfirst (1 to deliver before other codes), filename, and the optional unit_cost, currency, purchase_date, and expiration_date.

Steps

Upload text codes

  1. Send POST /code?database_id=123 with a JSON array of objects, one per code:
curl -X POST "https://panel.keysender.com/api/v1.0/code?database_id=123" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{"value": "AAAA-BBBB-CCCC"}, {"value": "DDDD-EEEE-FFFF", "unit_cost": 4.2, "currency": "EUR"}]'
  1. Send at most 1,000 codes per request. Codes beyond the first 1,000 in one request are not stored, and the response does not warn you, so batch larger uploads.
  2. The response is the array of stored codes with their new ids.

Upload a file as a code

  1. Send POST /code?database_id=123&name=manual.pdf with the raw file as the body and its real content type (for example Content-Type: application/pdf). Allowed types: PDF, JPG, PNG, GIF, TXT, CSV, TSV, XLS, MP3, EPUB. Maximum 80 MB.
  2. The response is an array with one code of type: 2 and filename set.

List codes

  1. Send GET /codes?database_id=123. Add page and pagesize (maximum 1000), and filter with filter=[{"status":0}] for available codes, [{"status":1}] for used ones, or [{"value":"AAAA"}] to find one.

Mark a code used, or send it first

  1. Send PUT /code with all three fields: {"id": 456, "status": 1, "sendfirst": 0}. Both status and sendfirst must be present even when only one changes.

Delete a code

  1. Send DELETE /code with {"id": 456}. Only an available code (status: 0) can be deleted; a used code stays for the order history.

Confirm it works

After an upload, GET /codes?database_id=123&filter=[{"status":0}] includes the new values, and the database's available count under Inventory in the panel has grown by the same number. With stock in place, record a sale against it with Creating transactions with the API.

Troubleshooting

Symptom Cause Action
Fewer codes stored than sent The request exceeded 1,000 codes Send the remainder in a new request
422 on the file upload The content type is not in the allowed list, or the file exceeds 80 MB Use an allowed type and stay under 80 MB
A delete is refused The code is already used Used codes stay for order history and cannot be removed

If it still is not working

Submit a ticket with the database id, the count you sent, and the response.

Frequently asked questions

How many codes can I upload in one request?

1,000. Codes beyond the first 1,000 in a single request are not stored and the response does not warn you, so split larger uploads into batches and count the ids you get back.

How do I upload a file instead of text codes?

Send POST /code with database_id and name in the query and the raw file as the body, with its real content type such as application/pdf. The response is one code of type 2 with the filename set.

Can I delete a code that has already been delivered?

No. Only codes with status 0 (available) can be deleted. A used code stays so the order history remains complete.

Related articles

Getting started with the Keysender APIConnecting your own app to KeysenderCreating transactions with the APIManaging inventory databases with the API
Back to Help Center
If this still is not workingSubmit a Ticket