Skip to main content
POST
Generate a lot or serial run

Authorizations

X-API-Key
string
header
required

Body

application/json

Request body for POST /lots/runs/.

template_id
string
required

Template to generate against (id as UUID or shortuuid).

gtin
string
required

GTIN of the product the generated lots belong to.

quantity
integer
required

How many identifiers to generate. Lots cap at 100,000; serial templates (target_field=serial) accept up to 10,000,000 and always run async.

Required range: 1 <= x <= 10000000
lot_id
string | null

Lot (id as UUID or shortuuid) the generated serials belong to. Optional for serial templates (target_field=serial, C-4103) — a serialized unit may be unbatched (its identity is the SGTIN, GTIN + serial); omit to mint serials with no lot. Ignored for lot templates.

tag
string | null

Scope tag — required when the template's scope_kind is tag.

Maximum string length: 128
force_async
boolean
default:false

Force the Celery async path even for a small batch (returns a queued run).

idempotency_key
string | null

Optional client request id. A repeat within 5 minutes returns the existing run.

Maximum string length: 128

Response

Created

A generation run and its outcome.

id
string
required

Run id (22-char shortuuid). Use in /lots/runs/{id}/ paths.

template_id
string
required

Template this run generated against.

template_version
integer
required

Template version pinned at generation time.

scope_key
string
required

Counter scope key derived from the template's scope_kind.

gtin
string
required

GTIN of the product the generated lots belong to.

quantity
integer
required

Number of identifiers requested.

status
enum<string>
required

Lifecycle state of the run.

Available options:
queued,
generating,
reserved,
committed,
discarded,
failed_collision
generated_ids
string[]
required

Denormalized list of identifiers rendered by this run.

soft_collision_count
integer
required

Random-source retries that resolved during generation.

hard_collisions
HardCollisionOut · object[]
required

Populated only on failed_collision runs; empty otherwise.

created
string<date-time>
required

Creation timestamp (ISO-8601).

first_id
string | null

First identifier in the reserved block; null until reserved.

last_id
string | null

Last identifier in the reserved block; null until reserved.

counter_state_before
integer | null

Counter value (post-reset) before this run advanced it.

counter_state_after
integer | null

Counter value after this run; null on failed_collision.

chunks_done
integer | null

Async progress: chunks written so far.

chunks_total
integer | null

Async progress: total chunks the run will write.

created_by_id
string | null

User id that created the run; null if the user was deleted.

queued_at
string<date-time> | null

When the async run was enqueued.

generating_started_at
string<date-time> | null

When the worker began generating.

committed_at
string<date-time> | null

When the run was committed.

discarded_at
string<date-time> | null

When the run was discarded.

failed_at
string<date-time> | null

When the run failed on a hard collision.

discard_mode
enum<string> | null

rollback or burn on a discarded run; null otherwise.

Available options:
rollback,
burn
discard_reason
string
default:""

Free-text reason recorded when the run was discarded.