Skip to main content
POST
/
invitations
/
create
cURL
curl --request POST \
  --url https://nano-gpt.com/api/invitations/create \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "invitation",
  "amount": 1,
  "currency": "<string>",
  "recipientName": "<string>",
  "issuerName": "<string>",
  "issuerNote": "<string>"
}
'
{
  "insertId": "<string>",
  "redeemCode": "<string>",
  "url": "<string>",
  "type": "invitation",
  "amount": 123,
  "currency": "<string>"
}

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_KEY or
  • Authorization: Bearer YOUR_API_KEY

Request

Headers

  • Content-Type: application/json
  • x-api-key: YOUR_API_KEY (required for API key auth)

Body

FieldTypeRequiredDescription
typestringNoEither "invitation" or "referralLink". Defaults to "invitation".
amountnumberNoCredit amount to include with the invitation. Must be non-negative. Ignored for referral links (always 0).
currencystringNoCurrency for the amount. Required if amount > 0. Use "USD" for US dollars.
recipientNamestringNoName of the invitation recipient.
issuerNamestringNoName of the person sending the invitation.
issuerNotestringNoPersonal note to include with the invitation.

Response

Success (200 OK)

{
  "insertId": "12345",
  "redeemCode": "ABC123XY",
  "url": "https://example.com/invite/ABC123XY",
  "type": "invitation",
  "amount": 10,
  "currency": "USD"
}
FieldTypeDescription
insertIdstringDatabase ID of the created invitation.
redeemCodestringUnique code the recipient uses to redeem the invitation.
urlstringFull URL to share with the recipient.
typestringThe invitation type ("invitation" or "referralLink").
amountnumberCredit amount attached to this invitation.
currencystring | nullCurrency of the amount, or null if amount is 0 (recipient chooses currency).

Errors

StatusBodyDescription
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 amount is 0 or not provided, the currency in the response is null, 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 redeemCode uses 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

curl -X POST https://nano-gpt.com/api/invitations/create \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "amount": 10,
    "currency": "USD",
    "recipientName": "Jane Doe",
    "issuerName": "John Smith",
    "issuerNote": "Welcome to the platform!"
  }'

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Invitation creation parameters

type
enum<string>

Either "invitation" or "referralLink". Defaults to "invitation".

Available options:
invitation,
referralLink
amount
number

Credit amount to include with the invitation. Must be non-negative. Ignored for referral links (always 0).

Required range: x >= 0
currency
string

Currency for the amount. Required if amount > 0.

recipientName
string

Name of the invitation recipient.

issuerName
string

Name of the person sending the invitation.

issuerNote
string

Personal note to include with the invitation.

Response

Invitation created

insertId
string
required

Database ID of the created invitation.

redeemCode
string
required

Unique code the recipient uses to redeem the invitation.

url
string<uri>
required

Full URL to share with the recipient.

type
enum<string>
required

The invitation type.

Available options:
invitation,
referralLink
amount
number
required

Credit amount attached to this invitation.

currency
string | null
required

Currency of the amount, or null if amount is 0.