unPLUGDevelopers

Management API · Offers

Create a code batch Coming soon

POST/v1/offers/{id}/code_batches

Generates single-use codes for a unique_codes offer. Each code is the prefix, a dash and 6 random letters and digits. Large batches take a few seconds: the batch starts as generating and becomes ready.

Permissions: Secret key with offers:write.

Request headers#

  • Idempotency-Keystring
    Any string up to 255 characters; use a UUID v4. Kept 24 hours per key (or member) and endpoint. Same key and body replays the first response with Idempotent-Replayed: true.
    Max Length 255

Path parameters#

  • idstring (uuid)Required

Request body#

  • prefixstringRequired
    Letters and digits, for example HOLIDAY.
  • quantityintegerRequired
    Number of codes.

Response fields#

Returns 201 with CodeBatch

  • idstring (uuid)
  • offer_idstring (uuid)
  • prefixstring
  • quantityinteger
  • statusstring
  • created_atstring (date-time)

Error descriptions#

400Bad request
invalid_param

A prefix with characters other than letters and digits, or a quantity under 1.

400Bad request
invalid_request

The offer's distribution isn't unique_codes.

409Conflict
invalid_state

The offer has ended.

Any endpoint can also return the common errors.