Create Invitation
Create an invitation or referral link with an optional credit amount.
Documentation Index
Fetch the complete documentation index at: https://docs.nano-gpt.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Create an invitation or referral link with an optional credit amount. Invitation links can include a fixed credit amount, while referral links always have a zero amount.Authentication
This endpoint supports two authentication methods:- Session-based authentication (browser session cookie)
- API key authentication via request headers
API Key Headers
x-api-key: YOUR_API_KEYorAuthorization: Bearer YOUR_API_KEY
Request
Headers
Content-Type: application/jsonx-api-key: YOUR_API_KEY(required for API key auth)
Body
| Field | Type | Required | Description |
|---|---|---|---|
type | string | No | Either "invitation" or "referralLink". Defaults to "invitation". |
amount | number | No | Credit amount to include with the invitation. Must be non-negative. Ignored for referral links (always 0). |
currency | string | No | Currency for the amount. Required if amount > 0. Use "USD" for US dollars. |
recipientName | string | No | Name of the invitation recipient. |
issuerName | string | No | Name of the person sending the invitation. |
issuerNote | string | No | Personal note to include with the invitation. |
Response
Success (200 OK)
| Field | Type | Description |
|---|---|---|
insertId | string | Database ID of the created invitation. |
redeemCode | string | Unique code the recipient uses to redeem the invitation. |
url | string | Full URL to share with the recipient. |
type | string | The invitation type ("invitation" or "referralLink"). |
amount | number | Credit amount attached to this invitation. |
currency | string | null | Currency of the amount, or null if amount is 0 (recipient chooses currency). |
Errors
| Status | Body | Description |
|---|---|---|
| 400 | "Invalid request body" | Request body is not valid JSON. |
| 400 | "InvalidAmount" | The provided amount is negative. |
| 400 | "InsufficientBalance" | Your account balance is insufficient for the specified amount. |
| 401 | "Invalid session" | Session is missing required data. |
| 401 | "Unable to get session" | Authentication failed. |
| 500 | "Failed to create invitation" | Server error during invitation creation. |
Notes
- When
amountis 0 or not provided, thecurrencyin the response isnull, allowing the recipient to choose their preferred currency upon redemption. - Referral links always have an amount of 0, regardless of what value is passed.
- The
redeemCodeuses a URL-safe alphabet that avoids ambiguous characters (no 0, O, 1, l). - Ensure your account has sufficient balance before creating invitations with credit amounts.
Examples
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Invitation creation parameters
Either "invitation" or "referralLink". Defaults to "invitation".
invitation, referralLink Credit amount to include with the invitation. Must be non-negative. Ignored for referral links (always 0).
x >= 0Currency for the amount. Required if amount > 0.
Name of the invitation recipient.
Name of the person sending the invitation.
Personal note to include with the invitation.
Response
Invitation created
Database ID of the created invitation.
Unique code the recipient uses to redeem the invitation.
Full URL to share with the recipient.
The invitation type.
invitation, referralLink Credit amount attached to this invitation.
Currency of the amount, or null if amount is 0.