cURL
curl --request POST \
--url https://nano-gpt.com/api/invitations/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 1,
"currency": "<string>",
"recipientName": "<string>",
"issuerName": "<string>",
"issuerNote": "<string>"
}
'import requests
url = "https://nano-gpt.com/api/invitations/create"
payload = {
"amount": 1,
"currency": "<string>",
"recipientName": "<string>",
"issuerName": "<string>",
"issuerNote": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 1,
currency: '<string>',
recipientName: '<string>',
issuerName: '<string>',
issuerNote: '<string>'
})
};
fetch('https://nano-gpt.com/api/invitations/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://nano-gpt.com/api/invitations/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 1,
'currency' => '<string>',
'recipientName' => '<string>',
'issuerName' => '<string>',
'issuerNote' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://nano-gpt.com/api/invitations/create"
payload := strings.NewReader("{\n \"amount\": 1,\n \"currency\": \"<string>\",\n \"recipientName\": \"<string>\",\n \"issuerName\": \"<string>\",\n \"issuerNote\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://nano-gpt.com/api/invitations/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 1,\n \"currency\": \"<string>\",\n \"recipientName\": \"<string>\",\n \"issuerName\": \"<string>\",\n \"issuerNote\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://nano-gpt.com/api/invitations/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 1,\n \"currency\": \"<string>\",\n \"recipientName\": \"<string>\",\n \"issuerName\": \"<string>\",\n \"issuerNote\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"insertId": "<string>",
"redeemCode": "<string>",
"url": "<string>",
"type": "invitation",
"amount": 123,
"currency": "<string>"
}<string><string><string>Endpoint Examples
Create Invitation
Create an invitation or referral link with an optional credit amount.
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 '
{
"amount": 1,
"currency": "<string>",
"recipientName": "<string>",
"issuerName": "<string>",
"issuerNote": "<string>"
}
'import requests
url = "https://nano-gpt.com/api/invitations/create"
payload = {
"amount": 1,
"currency": "<string>",
"recipientName": "<string>",
"issuerName": "<string>",
"issuerNote": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 1,
currency: '<string>',
recipientName: '<string>',
issuerName: '<string>',
issuerNote: '<string>'
})
};
fetch('https://nano-gpt.com/api/invitations/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://nano-gpt.com/api/invitations/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 1,
'currency' => '<string>',
'recipientName' => '<string>',
'issuerName' => '<string>',
'issuerNote' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://nano-gpt.com/api/invitations/create"
payload := strings.NewReader("{\n \"amount\": 1,\n \"currency\": \"<string>\",\n \"recipientName\": \"<string>\",\n \"issuerName\": \"<string>\",\n \"issuerNote\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://nano-gpt.com/api/invitations/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 1,\n \"currency\": \"<string>\",\n \"recipientName\": \"<string>\",\n \"issuerName\": \"<string>\",\n \"issuerNote\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://nano-gpt.com/api/invitations/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 1,\n \"currency\": \"<string>\",\n \"recipientName\": \"<string>\",\n \"issuerName\": \"<string>\",\n \"issuerNote\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"insertId": "<string>",
"redeemCode": "<string>",
"url": "<string>",
"type": "invitation",
"amount": 123,
"currency": "<string>"
}<string><string><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_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)
{
"insertId": "12345",
"redeemCode": "ABC123XY",
"url": "https://example.com/invite/ABC123XY",
"type": "invitation",
"amount": 10,
"currency": "USD"
}
| 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
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!"
}'
curl -X POST https://nano-gpt.com/api/invitations/create \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"type": "referralLink",
"issuerName": "John Smith"
}'
curl -X POST https://nano-gpt.com/api/invitations/create \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"recipientName": "Jane Doe"
}'
Authorizations
bearerAuthapiKeyAuth
Body
application/json
Invitation creation parameters
Response
Invitation created