Distributions API
Distributions are the mechanisms for allocating access to products within an experience. Fanfare supports three distribution types: Queues (first-come, first-served), Draws (lottery/raffle), and Auctions (competitive bidding).Distribution Types Overview
| Type | Mechanism | Use Case |
|---|---|---|
| Queue | First-come | Product launches, limited releases |
| Draw | Random selection | Raffles, fair allocation, high-demand items |
| Auction | Highest bidder | Collectibles, unique items, premium access |
Queues
Queues provide first-come, first-served access to products.Create Queue
POST /api/v1/queues
Authentication
- Secret key required
Request Body
Response
Example
List Queues
GET /api/v1/queues
Get Queue
GET /api/v1/queues/:id
Update Queue
PUT /api/v1/queues/:id
Delete Queue
DELETE /api/v1/queues/:id
Draws
Draws (lotteries) provide random selection from a pool of entrants.Create Draw
POST /api/v1/draws
Request Body
Response
Example
List Draws
GET /api/v1/draws
Get Draw
GET /api/v1/draws/:id
Update Draw
PUT /api/v1/draws/:id
Delete Draw
DELETE /api/v1/draws/:id
Auctions
Auctions allow competitive bidding for products.Create Auction
POST /api/v1/auctions
Request Body
Response
Example
List Auctions
GET /api/v1/auctions
Get Auction
GET /api/v1/auctions/:id
Update Auction
PUT /api/v1/auctions/:id
Delete Auction
DELETE /api/v1/auctions/:id
Distribution Status
Distributions go through the following status lifecycle:Queue Status
| Status | Description |
|---|---|
| DRAFT | Queue created but no times set |
| SCHEDULED | Open/close times set, waiting to open |
| OPEN | Accepting entries, admitting consumers |
| CLOSED | No longer accepting entries |
| COMPLETED | All admitted consumers completed |
Draw Status
| Status | Description |
|---|---|
| DRAFT | Draw created but no times set |
| SCHEDULED | Times set, waiting for entry period |
| OPEN | Accepting entries |
| CLOSED | Entry period ended, awaiting draw |
| DRAWN | Winners selected |
| COMPLETED | All winners have claimed or expired |
Auction Status
| Status | Description |
|---|---|
| DRAFT | Auction created but no times set |
| SCHEDULED | Times set, waiting for bidding to start |
| OPEN | Accepting bids |
| CLOSED | Bidding ended, awaiting settlement |
| SETTLED | Winner confirmed, payment processed |
Timing Configuration
Time Zones
All distributions support time zone configuration:Scheduling Events
When timing fields (openAt, closeAt, drawAt, settleAt) are updated, distribution update events are automatically published for processing.
Common Fields
All distribution types share these common fields:| Field | Type | Description |
|---|---|---|
id | string | Unique distribution ID |
organizationId | string | Owning organization |
sequenceId | string | Parent sequence/experience |
name | string | Display name |
timeZone | string | IANA time zone |
status | string | Current status |
openAt | string (ISO 8601) | When participation opens |
closeAt | string (ISO 8601) | When participation closes |
encryptionSeed | string | Seed for consumer position encoding |
metadata | object | Custom metadata |
createdAt | string (ISO 8601) | Creation timestamp |
updatedAt | string (ISO 8601) | Last update timestamp |
Error Responses
| Status | Error | Description |
|---|---|---|
| 400 | Validation failed | Invalid request data |
| 401 | Authentication required | Missing or invalid credentials |
| 404 | Queue/Draw/Auction not found | Distribution does not exist |
| 409 | Cannot update closed distribution | Distribution already closed |