Events
Create an invitation code
POST
/events/:eventId/entries/:entryId/invitation-codeCreate a referral invitation code from the authenticated user's own entry. Each entry has one code; if it already exists, that code is returned (after syncing its target ticket and redemption limit with the ticket's current invitation settings). No request body is required.
| Auth | Login required |
|---|
Path parameters
eventIdstringrequiredEvent ID.
entryIdstringrequiredThe authenticated user's own entry ID.
Notes
Returns 201 when a new code is created and 200 when an existing code is returned.
Codes can only be created for a published (PUBLISHED / PRIVATE) event from your own entry in the CONFIRMED or CHECKED_IN state. Specifying someone else's entry returns 403; a ticket without the invitation feature, or an entry at the generation limit, returns 400. Check canCreateInvitationCode on GET /events/:eventId/entries beforehand.
Response
| Field | Type | Description |
|---|---|---|
code | string | The invitation code (8 characters); pass it as invitationCode when registering. |
maxRedemptions | number | Maximum number of people who can be invited with this code. |
redeemedCount | number | Number of people already invited with this code. |
invitationLimitConfigured | boolean | Whether the ticket sets an invitation limit; when false the default of 1 applies. |
targetTicket | Ticket | The ticket invitees register with, including the invitation discount discountPercent / discountAmount (null when not set). |
Request
curl https://api.4s.link/events/EVENT_ID/entries/ENTRY_ID/invitation-code \-X POST \-H "Authorization: Bearer 4s_at_..."
Example response
{"code": "AB12CD34","maxRedemptions": 10,"redeemedCount": 0,"invitationLimitConfigured": true,"targetTicket": {"id": "t2b3c4d5-...","name": "招待参加","price": 3000,"paymentType": "PREPAID_STRIPE","discountPercent": 20,"discountAmount": null}}