API: Minting
API: Minting
API: Minting
The Minting API provides a single atomic gateway for submitting minting requests, along with lifecycle management for mint batches and units.
All RPCs require an authenticated session. Minting operations require a role with sufficient permissions for the target brand (typically admin or owner).
The primary entry point for minting. Performs preflight validation, enforces ERP batch linkage, and atomically creates a mint job + mint batch.
Request
Response (success)
Response (blocked)
Response (idempotent hit)
Parameters
Errors
Notes
commercial_status = ACTIVE and mint_readiness_status = READY._product_batch_id is provided:
status = READY._product_batch_id is null:
_lots must not be provided.Runs a preflight check against a product and batch to determine minting eligibility.
preflight_mint_batch is a standalone check. For submitting actual mint requests, use
submit_mint_request which absorbs preflight validation.
Request
Response (pass)
Errors
Deprecated. Use submit_mint_request instead. This RPC is retained for backward compatibility
only.
Creates a mint batch linked 1:1 to a completed preflight mint job. Gate check patched to accept QUEUED and PREFLIGHTED statuses.
Transitions a mint batch to a new lifecycle status with audit trail.
Status values: draft → minted → exported → printed → applied → voided
Paginated listing of mint batches for a brand with deterministic cursor-based pagination.
Request
Response
Parameters
Errors
Paginated listing of mint units for a brand, with optional batch filter and deterministic cursor-based pagination.
Request
Response
Parameters
Errors
Paginated listing of mint events (activity/audit) for a brand with deterministic cursor-based pagination and optional filters.
Request
Response
Parameters
Errors
Records a scan telemetry event. Will be called by the edge resolver in a future slice.
The async mint executor database engine. Claims a queued mint job, generates identities in bounded chunks, and advances statuses deterministically.
Request
Response (in-progress)
Response (completed)
Parameters
Mode behaviour
Status transitions: QUEUED → RESERVED → PROCESSING → COMPLETED (or FAILED)
Events emitted: mint_job_started, mint_units_created, mint_lots_confirmed, mint_job_completed, mint_job_failed
This RPC is the database engine only. The background runner that invokes it in a loop is handled by the platform’s job scheduler.
All minting mutation RPCs require an authenticated JWT. Anonymous or public execution is explicitly disallowed for the minting control plane.
Resolver endpoints are public and callable without authentication. They include internal tenant validation. No minting control-plane RPC is anonymously callable.
Returns aggregate KPI values for the minting dashboard.
Request
Response
Parameters
Calculation rules
Notes
list_mint_batches returns a wrapped object with the canonical key batches: { "ok": true, "batches": [...], "has_more": bool, "next_cursor": string|null }.list_mint_batches and list_mint_units include product_sku per record, avoiding N+1 queries. If the product is missing, product_sku is null.Returns a single mint batch by ID, including joined product metadata (product_sku, product_name).
Request
Response (success)
Parameters
Errors
Notes
product_name and product_sku in the response, avoiding N+1 queries.list_mint_units response uses canonical key units: { "ok": true, "units": [...] }.Paginated listing of payload packs (export artifacts) for a brand with deterministic cursor-based pagination.
Request
Response
Parameters
Errors
Notes
storage_path is returned as a relative path. No signed URLs are generated by the list endpoint.list_payload_packs response uses canonical key packs: { "ok": true, "packs": [...] }.Payload pack artifacts are stored in a private storage bucket. Downloads require authenticated access and use time-limited signed URLs.
storage_path may be null for packs in pending status. Always guard against null before
requesting a signed URL.
A brand-scoped global search RPC that returns a unified list of tokens, batches, exports, and products matching a query string.
Request
Response
Parameters
Matching rules
Notes
The platform exposes a brand-scoped global search surface powered by the search_brand_objects_v1 RPC.
query%). No fuzzy matching, no full-text search, and no leading-wildcard (%query%) patterns.has_brand_access. Cross-brand search is not possible.A Backend-For-Frontend edge function that combines minting submission and immediate execution into a single call.
POST /functions/v1/mint-api-v1
Requires a valid JWT in the Authorization: Bearer <token> header. The caller must have an owner or admin role for the target brand.
After a successful submit, the function performs exactly one bounded processing cycle (up to 20,000 units). The kicked field indicates whether this synchronous processing step succeeded.
kicked=false does not mean the job is lost. The platform’s background job scheduler runs on a regular schedule and will pick up any queued jobs. The synchronous kick is a latency optimisation, not a requirement for job completion.