access_code.generated
Bulk-generate job completes.
Batch-level only — fires once per generation job, not per code. A 10,000-code batch produces one event.
When this fires
A bulk-generation run for access codes completes. The batch is materialized in the database and is now redeemable.
Required ability
project-access-code:view — token must carry this at mint time to subscribe an endpoint to this event.
Payload
{
"id": "evt_01HX...",
"type": "access_code.generated",
"created_at": "2026-05-18T10:05:00Z",
"api_version": "2026-05-01",
"project_id": "7f3d1c92-8b45-4e6a-9d21-5c8e0a4b6f13",
"data": {
"plan_id": "c4e82f16-93a7-4d5b-b81c-6e0f27a94d3b",
"plan_name": "Premium Monthly",
"count": 250,
"expires_at": "2026-08-18T00:00:00Z"
}
}Field reference
| Field | Type | Notes |
|---|---|---|
id | string ULID | Unique event id, prefixed evt_. Use for idempotent processing. |
type | string | Always access_code.generated for this event. |
created_at | ISO 8601 timestamp | Server-side emission time. |
api_version | string | Webhook API contract version. |
project_id | string UUID | Project this event belongs to. |
data.plan_id | string UUID | Plan the codes are scoped to. |
data.plan_name | string | Plan display name at generation time. |
data.count | integer | Number of codes in the batch. |
data.expires_at | ISO 8601 timestamp, nullable | Common expiry timestamp for all codes in the batch. null when the batch was generated with no expiry. |
Caveats
- Codes themselves are never delivered through this event. The batch is delivered to the creator's Telegram chat as a CSV document or as one message per code, depending on the export type chosen at generation; to fetch them programmatically use
GET /v1/projects/{project}/plans/{plan}/access-codes. - There is no batch identifier in the payload. Correlate a run by
plan_idpluscreated_at, or list codes viaGET /v1/projects/{project}/plans/{plan}/access-codes. - Per-code redemption fires
access_code.redeemed; per-code expiry firesaccess_code.expired.
Related events
access_code.redeemed— fires per code on redemption.access_code.expired— fires per code on expiry.- Access code events overview — back to family overview.
How is this guide?