Links and coupons

Embed
Preview of the card
<a href="https://referalli.com/docs/ref-links-and-coupons"><img src="https://referalli.com/docs/_api/public/orgs/07f432f4-34b9-46a7-aaad-c0e395d2e4f9/spaces/2bf4f614-3630-4fbf-85f9-5ecafa6b7d97/pages/5ce66147-93cf-4edc-9067-e0741f967fb6/social-card.svg?v=3e7ae33eec8b" alt="Links and coupons" width="600" height="315"></a>
GEThttps://referalli.com/v1/links
List links

Tracked links with their short URL and click count, filtered by programId and/or partnerId.

Auth: an API key with links:read (or full), or a session of any role.

Parameters
programIdstringquery
partnerIdstringquery
limitintegerquery
Items per page, 1 to 100 (default 50). From API version 2026-11-01; ignored under 2026-10-21, where lists are a capped plain array.
= 50
starting_afterstringquery
A cursor: the id of an item (the previous page's next_cursor); returns the items after it. From API version 2026-11-01; ignored under 2026-10-21, where lists are a capped plain array.
ending_beforestringquery
A cursor: returns the items before this item id (the previous page). Not with starting_after. From API version 2026-11-01; ignored under 2026-10-21, where lists are a capped plain array.
created[gte]stringquery
Only items created at or after this time (ISO 8601), on lists of timestamped records. From API version 2026-11-01; ignored under 2026-10-21, where lists are a capped plain array.
created[lte]stringquery
Only items created at or before this time (ISO 8601), on lists of timestamped records. From API version 2026-11-01; ignored under 2026-10-21, where lists are a capped plain array.
referalli-versionstringheader
The API version to run the request under (2026-10-21, 2026-11-01). Default: the API key's pinned version, else 2026-10-21. The header name from before the rename is still accepted; this name wins when both are sent.
2026-10-21 | 2026-11-01
x-org-idstringheader
With a session: the org to act in (the user must be a member). Not used with API keys, which belong to one org.
referalli-modestringheader
test runs a session request against the org's test data. With an API key it must match the key's mode (400 mode_mismatch otherwise). The header name from before the rename is still accepted.
live | test
Code samples
cURL
curl -X GET "https://referalli.com/v1/links?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=" \
  -H "referalli-version: <value>" \
  -H "x-org-id: <value>" \
  -H "referalli-mode: <value>"
TypeScript
const res = await fetch('https://referalli.com/v1/links?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=', {
  method: 'GET',
  headers: {
    'referalli-version': '<value>',
    'x-org-id': '<value>',
    'referalli-mode': '<value>',
  },
});
const data = await res.json();
Python
import requests

res = requests.request(
    "GET",
    "https://referalli.com/v1/links?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=",
    headers={
    "referalli-version": "<value>",
    "x-org-id": "<value>",
    "referalli-mode": "<value>",
    },
)
data = res.json()
Go
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://referalli.com/v1/links?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=", nil)
	req.Header.Set("referalli-version", "<value>")
	req.Header.Set("x-org-id", "<value>")
	req.Header.Set("referalli-mode", "<value>")
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)
	fmt.Println(string(body))
}
PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://referalli.com/v1/links?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['referalli-version: <value>', 'x-org-id: <value>', 'referalli-mode: <value>']);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Ruby
require 'net/http'
require 'uri'

uri = URI('https://referalli.com/v1/links?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=')
req = Net::HTTP::Get.new(uri)
req['referalli-version'] = '<value>'
req['x-org-id'] = '<value>'
req['referalli-mode'] = '<value>'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(req)
end
puts res.body
Java
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpRequest.BodyPublishers;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://referalli.com/v1/links?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D="))
    .header("referalli-version", "<value>")
    .header("x-org-id", "<value>")
    .header("referalli-mode", "<value>")
    .GET()
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Responses
200 A page of the list. Under API version 2026-10-21 the body is the plain array instead.
Example
{
  "object": "string",
  "data": [
    {
      "id": "string",
      "programId": "string",
      "partnerId": "string",
      "code": "string",
      "destinationUrl": "string",
      "shortUrl": "string",
      "clicks": 0,
      "createdAt": "2024-01-01T00:00:00Z"
    }
  ],
  "has_more": true,
  "next_cursor": "string"
}
Schema
objectstringrequired
dataLink[]required
Show child parameters
idstringrequired
programIdstringrequired
partnerIdstringrequired
codestringrequired
Lowercase; matched case-insensitively.
destinationUrlstringrequired
shortUrlstringrequired
Absolute link, on the org's verified link domain when it has one.
clicksintegerrequired
createdAtstringrequired
has_morebooleanrequired
Whether another page follows; pass next_cursor as starting_after to get it.
next_cursorstringrequired
400 The request is invalid. error.code is one of:
Example
{
  "error": {
    "code": "validation_error",
    "message": "the body or query failed validation, an unknown field was sent, the body is not valid json, or a session call has no `x-org-id`",
    "details": [
      {
        "code": "invalid_format",
        "path": [
          "destinationUrl"
        ],
        "message": "Invalid URL"
      }
    ],
    "docs_url": "https://referalli.com/docs/errors-and-limits#validation_error"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
401 Missing or invalid credentials. error.code is one of:
Example
{
  "error": {
    "code": "unauthorized",
    "message": "no credentials, an unknown, revoked or expired api key or session, or a signature that did not verify",
    "docs_url": "https://referalli.com/docs/errors-and-limits#unauthorized"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
403 Authenticated, but not allowed. error.code is one of:
Example
{
  "error": {
    "code": "forbidden",
    "message": "the wrong role, a key without the needed scope (the message names it), not a member, a suspended org, or a publishable key from an origin it does not allow",
    "docs_url": "https://referalli.com/docs/errors-and-limits#forbidden"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
404 No such resource. error.code is one of:
Example
{
  "error": {
    "code": "not_found",
    "message": "the resource does not exist in this org (ids from other orgs look the same), a referenced id does not exist, a list cursor is not in the list, or the endpoint does not exist",
    "docs_url": "https://referalli.com/docs/errors-and-limits#not_found"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
429 Rate limited. error.code is one of:
Example
{
  "error": {
    "code": "rate_limited",
    "message": "an endpoint limit or the per-key quota was exceeded",
    "docs_url": "https://referalli.com/docs/errors-and-limits#rate_limited"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
500 Unexpected server error. error.code is one of:
Example
{
  "error": {
    "code": "internal_error",
    "message": "retry with backoff",
    "requestId": "req_8f2c1d4e5a6b7c8d",
    "docs_url": "https://referalli.com/docs/errors-and-limits#internal_error"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
default Any other error, in the same envelope.
Example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {},
    "requestId": "string",
    "docs_url": "string"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
POSThttps://referalli.com/v1/links
Create a tracked link

Creates a partner's tracked link in a program. code (letters, digits, -; stored lowercase) is unique per org and generated when omitted. Returns the shortUrl to share, on the org's verified link domain when it has one. 409 when the code is taken. Audited.

Auth: an API key with links:write (or full), or a session with role owner, admin.

Parameters
Idempotency-Keystringheader
Any unique string up to 255 printable ASCII characters (a UUID). A retry with the same key within 24 hours gets the first response again (with idempotent-replayed: true) and nothing runs twice. The same key on a different request is 422 idempotency_key_reused; while the first is still running, 409 idempotency_in_progress.
x-org-idstringheader
With a session: the org to act in (the user must be a member). Not used with API keys, which belong to one org.
referalli-modestringheader
test runs a session request against the org's test data. With an API key it must match the key's mode (400 mode_mismatch otherwise). The header name from before the rename is still accepted.
live | test
Request body application/json
programIdstringrequired
partnerIdstringrequired
codestring
destinationUrlstringrequired
{
  "programId": "string",
  "partnerId": "string",
  "code": "string",
  "destinationUrl": "string"
}
Code samples
cURL
curl -X POST "https://referalli.com/v1/links" \
  -H "Idempotency-Key: <value>" \
  -H "x-org-id: <value>" \
  -H "referalli-mode: <value>" \
  -H "Content-Type: application/json" \
  -d '{"programId":"string","partnerId":"string","code":"string","destinationUrl":"string"}'
TypeScript
const res = await fetch('https://referalli.com/v1/links', {
  method: 'POST',
  headers: {
    'Idempotency-Key': '<value>',
    'x-org-id': '<value>',
    'referalli-mode': '<value>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"programId":"string","partnerId":"string","code":"string","destinationUrl":"string"}),
});
const data = await res.json();
Python
import requests

res = requests.request(
    "POST",
    "https://referalli.com/v1/links",
    headers={
    "Idempotency-Key": "<value>",
    "x-org-id": "<value>",
    "referalli-mode": "<value>",
    "Content-Type": "application/json",
    },
    json={"programId": "string", "partnerId": "string", "code": "string", "destinationUrl": "string"},
)
data = res.json()
Go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	req, _ := http.NewRequest("POST", "https://referalli.com/v1/links", strings.NewReader(`{"programId":"string","partnerId":"string","code":"string","destinationUrl":"string"}`))
	req.Header.Set("Idempotency-Key", "<value>")
	req.Header.Set("x-org-id", "<value>")
	req.Header.Set("referalli-mode", "<value>")
	req.Header.Set("Content-Type", "application/json")
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)
	fmt.Println(string(body))
}
PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://referalli.com/v1/links');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Idempotency-Key: <value>', 'x-org-id: <value>', 'referalli-mode: <value>', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"programId":"string","partnerId":"string","code":"string","destinationUrl":"string"}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Ruby
require 'net/http'
require 'uri'

uri = URI('https://referalli.com/v1/links')
req = Net::HTTP::Post.new(uri)
req['Idempotency-Key'] = '<value>'
req['x-org-id'] = '<value>'
req['referalli-mode'] = '<value>'
req['Content-Type'] = 'application/json'
req.body = '{"programId":"string","partnerId":"string","code":"string","destinationUrl":"string"}'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(req)
end
puts res.body
Java
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpRequest.BodyPublishers;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://referalli.com/v1/links"))
    .header("Idempotency-Key", "<value>")
    .header("x-org-id", "<value>")
    .header("referalli-mode", "<value>")
    .header("Content-Type", "application/json")
    .method("POST", BodyPublishers.ofString("{\"programId\":\"string\",\"partnerId\":\"string\",\"code\":\"string\",\"destinationUrl\":\"string\"}"))
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Responses
200 OK
Example
{
  "id": "string",
  "programId": "string",
  "partnerId": "string",
  "code": "string",
  "destinationUrl": "string",
  "shortUrl": "string"
}
Schema
idstringrequired
programIdstringrequired
partnerIdstringrequired
codestringrequired
destinationUrlstringrequired
shortUrlstring
400 The request is invalid. error.code is one of:
Example
{
  "error": {
    "code": "validation_error",
    "message": "the body or query failed validation, an unknown field was sent, the body is not valid json, or a session call has no `x-org-id`",
    "details": [
      {
        "code": "invalid_format",
        "path": [
          "destinationUrl"
        ],
        "message": "Invalid URL"
      }
    ],
    "docs_url": "https://referalli.com/docs/errors-and-limits#validation_error"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
401 Missing or invalid credentials. error.code is one of:
Example
{
  "error": {
    "code": "unauthorized",
    "message": "no credentials, an unknown, revoked or expired api key or session, or a signature that did not verify",
    "docs_url": "https://referalli.com/docs/errors-and-limits#unauthorized"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
403 Authenticated, but not allowed. error.code is one of:
Example
{
  "error": {
    "code": "forbidden",
    "message": "the wrong role, a key without the needed scope (the message names it), not a member, a suspended org, or a publishable key from an origin it does not allow",
    "docs_url": "https://referalli.com/docs/errors-and-limits#forbidden"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
404 No such resource. error.code is one of:
Example
{
  "error": {
    "code": "not_found",
    "message": "the resource does not exist in this org (ids from other orgs look the same), a referenced id does not exist, a list cursor is not in the list, or the endpoint does not exist",
    "docs_url": "https://referalli.com/docs/errors-and-limits#not_found"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
409 The request conflicts with the current state. error.code is one of:
Example
{
  "error": {
    "code": "conflict",
    "message": "a unique value is taken, or the action would break a rule (the message says which)",
    "docs_url": "https://referalli.com/docs/errors-and-limits#conflict"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
422 The request cannot be processed as sent. error.code is one of:
Example
{
  "error": {
    "code": "idempotency_key_reused",
    "message": "the `idempotency-key` was used for a different request",
    "docs_url": "https://referalli.com/docs/errors-and-limits#idempotency_key_reused"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
429 Rate limited. error.code is one of:
Example
{
  "error": {
    "code": "rate_limited",
    "message": "an endpoint limit or the per-key quota was exceeded",
    "docs_url": "https://referalli.com/docs/errors-and-limits#rate_limited"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
500 Unexpected server error. error.code is one of:
Example
{
  "error": {
    "code": "internal_error",
    "message": "retry with backoff",
    "requestId": "req_8f2c1d4e5a6b7c8d",
    "docs_url": "https://referalli.com/docs/errors-and-limits#internal_error"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
default Any other error, in the same envelope.
Example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {},
    "requestId": "string",
    "docs_url": "string"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
GEThttps://referalli.com/v1/links/{id}/qr
Get a link's QR code

An SVG QR code for the link's short URL.

Auth: an API key with links:read (or full), or a session of any role.

Parameters
idstringpathrequired
x-org-idstringheader
With a session: the org to act in (the user must be a member). Not used with API keys, which belong to one org.
referalli-modestringheader
test runs a session request against the org's test data. With an API key it must match the key's mode (400 mode_mismatch otherwise). The header name from before the rename is still accepted.
live | test
Code samples
cURL
curl -X GET "https://referalli.com/v1/links/{id}/qr" \
  -H "x-org-id: <value>" \
  -H "referalli-mode: <value>"
TypeScript
const res = await fetch('https://referalli.com/v1/links/{id}/qr', {
  method: 'GET',
  headers: {
    'x-org-id': '<value>',
    'referalli-mode': '<value>',
  },
});
const data = await res.json();
Python
import requests

res = requests.request(
    "GET",
    "https://referalli.com/v1/links/{id}/qr",
    headers={
    "x-org-id": "<value>",
    "referalli-mode": "<value>",
    },
)
data = res.json()
Go
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://referalli.com/v1/links/{id}/qr", nil)
	req.Header.Set("x-org-id", "<value>")
	req.Header.Set("referalli-mode", "<value>")
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)
	fmt.Println(string(body))
}
PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://referalli.com/v1/links/{id}/qr');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['x-org-id: <value>', 'referalli-mode: <value>']);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Ruby
require 'net/http'
require 'uri'

uri = URI('https://referalli.com/v1/links/{id}/qr')
req = Net::HTTP::Get.new(uri)
req['x-org-id'] = '<value>'
req['referalli-mode'] = '<value>'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(req)
end
puts res.body
Java
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpRequest.BodyPublishers;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://referalli.com/v1/links/{id}/qr"))
    .header("x-org-id", "<value>")
    .header("referalli-mode", "<value>")
    .GET()
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Responses
200 QR code for the short link.
"string"
400 The request is invalid. error.code is one of:
Example
{
  "error": {
    "code": "validation_error",
    "message": "the body or query failed validation, an unknown field was sent, the body is not valid json, or a session call has no `x-org-id`",
    "details": [
      {
        "code": "invalid_format",
        "path": [
          "destinationUrl"
        ],
        "message": "Invalid URL"
      }
    ],
    "docs_url": "https://referalli.com/docs/errors-and-limits#validation_error"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
401 Missing or invalid credentials. error.code is one of:
Example
{
  "error": {
    "code": "unauthorized",
    "message": "no credentials, an unknown, revoked or expired api key or session, or a signature that did not verify",
    "docs_url": "https://referalli.com/docs/errors-and-limits#unauthorized"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
403 Authenticated, but not allowed. error.code is one of:
Example
{
  "error": {
    "code": "forbidden",
    "message": "the wrong role, a key without the needed scope (the message names it), not a member, a suspended org, or a publishable key from an origin it does not allow",
    "docs_url": "https://referalli.com/docs/errors-and-limits#forbidden"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
404 No such resource. error.code is one of:
Example
{
  "error": {
    "code": "not_found",
    "message": "the resource does not exist in this org (ids from other orgs look the same), a referenced id does not exist, a list cursor is not in the list, or the endpoint does not exist",
    "docs_url": "https://referalli.com/docs/errors-and-limits#not_found"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
429 Rate limited. error.code is one of:
Example
{
  "error": {
    "code": "rate_limited",
    "message": "an endpoint limit or the per-key quota was exceeded",
    "docs_url": "https://referalli.com/docs/errors-and-limits#rate_limited"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
500 Unexpected server error. error.code is one of:
Example
{
  "error": {
    "code": "internal_error",
    "message": "retry with backoff",
    "requestId": "req_8f2c1d4e5a6b7c8d",
    "docs_url": "https://referalli.com/docs/errors-and-limits#internal_error"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
default Any other error, in the same envelope.
Example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {},
    "requestId": "string",
    "docs_url": "string"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
GEThttps://referalli.com/v1/coupons
List coupon codes

Coupon codes, filtered by programId and/or partnerId.

Auth: an API key with links:read (or full), or a session of any role.

Parameters
programIdstringquery
partnerIdstringquery
limitintegerquery
Items per page, 1 to 100 (default 50). From API version 2026-11-01; ignored under 2026-10-21, where lists are a capped plain array.
= 50
starting_afterstringquery
A cursor: the id of an item (the previous page's next_cursor); returns the items after it. From API version 2026-11-01; ignored under 2026-10-21, where lists are a capped plain array.
ending_beforestringquery
A cursor: returns the items before this item id (the previous page). Not with starting_after. From API version 2026-11-01; ignored under 2026-10-21, where lists are a capped plain array.
created[gte]stringquery
Only items created at or after this time (ISO 8601), on lists of timestamped records. From API version 2026-11-01; ignored under 2026-10-21, where lists are a capped plain array.
created[lte]stringquery
Only items created at or before this time (ISO 8601), on lists of timestamped records. From API version 2026-11-01; ignored under 2026-10-21, where lists are a capped plain array.
referalli-versionstringheader
The API version to run the request under (2026-10-21, 2026-11-01). Default: the API key's pinned version, else 2026-10-21. The header name from before the rename is still accepted; this name wins when both are sent.
2026-10-21 | 2026-11-01
x-org-idstringheader
With a session: the org to act in (the user must be a member). Not used with API keys, which belong to one org.
referalli-modestringheader
test runs a session request against the org's test data. With an API key it must match the key's mode (400 mode_mismatch otherwise). The header name from before the rename is still accepted.
live | test
Code samples
cURL
curl -X GET "https://referalli.com/v1/coupons?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=" \
  -H "referalli-version: <value>" \
  -H "x-org-id: <value>" \
  -H "referalli-mode: <value>"
TypeScript
const res = await fetch('https://referalli.com/v1/coupons?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=', {
  method: 'GET',
  headers: {
    'referalli-version': '<value>',
    'x-org-id': '<value>',
    'referalli-mode': '<value>',
  },
});
const data = await res.json();
Python
import requests

res = requests.request(
    "GET",
    "https://referalli.com/v1/coupons?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=",
    headers={
    "referalli-version": "<value>",
    "x-org-id": "<value>",
    "referalli-mode": "<value>",
    },
)
data = res.json()
Go
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://referalli.com/v1/coupons?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=", nil)
	req.Header.Set("referalli-version", "<value>")
	req.Header.Set("x-org-id", "<value>")
	req.Header.Set("referalli-mode", "<value>")
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)
	fmt.Println(string(body))
}
PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://referalli.com/v1/coupons?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['referalli-version: <value>', 'x-org-id: <value>', 'referalli-mode: <value>']);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Ruby
require 'net/http'
require 'uri'

uri = URI('https://referalli.com/v1/coupons?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D=')
req = Net::HTTP::Get.new(uri)
req['referalli-version'] = '<value>'
req['x-org-id'] = '<value>'
req['referalli-mode'] = '<value>'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(req)
end
puts res.body
Java
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpRequest.BodyPublishers;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://referalli.com/v1/coupons?programId=&partnerId=&limit=&starting_after=&ending_before=&created%5Bgte%5D=&created%5Blte%5D="))
    .header("referalli-version", "<value>")
    .header("x-org-id", "<value>")
    .header("referalli-mode", "<value>")
    .GET()
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Responses
200 A page of the list. Under API version 2026-10-21 the body is the plain array instead.
Example
{
  "object": "string",
  "data": [
    {
      "id": "string",
      "programId": "string",
      "partnerId": "string",
      "code": "string",
      "createdAt": "2024-01-01T00:00:00Z"
    }
  ],
  "has_more": true,
  "next_cursor": "string"
}
Schema
objectstringrequired
dataCoupon[]required
Show child parameters
idstringrequired
programIdstringrequired
partnerIdstringrequired
codestringrequired
createdAtstringrequired
has_morebooleanrequired
Whether another page follows; pass next_cursor as starting_after to get it.
next_cursorstringrequired
400 The request is invalid. error.code is one of:
Example
{
  "error": {
    "code": "validation_error",
    "message": "the body or query failed validation, an unknown field was sent, the body is not valid json, or a session call has no `x-org-id`",
    "details": [
      {
        "code": "invalid_format",
        "path": [
          "destinationUrl"
        ],
        "message": "Invalid URL"
      }
    ],
    "docs_url": "https://referalli.com/docs/errors-and-limits#validation_error"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
401 Missing or invalid credentials. error.code is one of:
Example
{
  "error": {
    "code": "unauthorized",
    "message": "no credentials, an unknown, revoked or expired api key or session, or a signature that did not verify",
    "docs_url": "https://referalli.com/docs/errors-and-limits#unauthorized"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
403 Authenticated, but not allowed. error.code is one of:
Example
{
  "error": {
    "code": "forbidden",
    "message": "the wrong role, a key without the needed scope (the message names it), not a member, a suspended org, or a publishable key from an origin it does not allow",
    "docs_url": "https://referalli.com/docs/errors-and-limits#forbidden"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
404 No such resource. error.code is one of:
Example
{
  "error": {
    "code": "not_found",
    "message": "the resource does not exist in this org (ids from other orgs look the same), a referenced id does not exist, a list cursor is not in the list, or the endpoint does not exist",
    "docs_url": "https://referalli.com/docs/errors-and-limits#not_found"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
429 Rate limited. error.code is one of:
Example
{
  "error": {
    "code": "rate_limited",
    "message": "an endpoint limit or the per-key quota was exceeded",
    "docs_url": "https://referalli.com/docs/errors-and-limits#rate_limited"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
500 Unexpected server error. error.code is one of:
Example
{
  "error": {
    "code": "internal_error",
    "message": "retry with backoff",
    "requestId": "req_8f2c1d4e5a6b7c8d",
    "docs_url": "https://referalli.com/docs/errors-and-limits#internal_error"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
default Any other error, in the same envelope.
Example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {},
    "requestId": "string",
    "docs_url": "string"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
POSThttps://referalli.com/v1/coupons
Create a coupon code

Registers a coupon code for a partner in a program, so checkouts that use it attribute to them (coupon codes win over clicks). Codes match case-insensitively and are unique per org (409).

Auth: an API key with links:write (or full), or a session with role owner, admin.

Parameters
Idempotency-Keystringheader
Any unique string up to 255 printable ASCII characters (a UUID). A retry with the same key within 24 hours gets the first response again (with idempotent-replayed: true) and nothing runs twice. The same key on a different request is 422 idempotency_key_reused; while the first is still running, 409 idempotency_in_progress.
x-org-idstringheader
With a session: the org to act in (the user must be a member). Not used with API keys, which belong to one org.
referalli-modestringheader
test runs a session request against the org's test data. With an API key it must match the key's mode (400 mode_mismatch otherwise). The header name from before the rename is still accepted.
live | test
Request body application/json
programIdstringrequired
partnerIdstringrequired
codestringrequired
{
  "programId": "string",
  "partnerId": "string",
  "code": "string"
}
Code samples
cURL
curl -X POST "https://referalli.com/v1/coupons" \
  -H "Idempotency-Key: <value>" \
  -H "x-org-id: <value>" \
  -H "referalli-mode: <value>" \
  -H "Content-Type: application/json" \
  -d '{"programId":"string","partnerId":"string","code":"string"}'
TypeScript
const res = await fetch('https://referalli.com/v1/coupons', {
  method: 'POST',
  headers: {
    'Idempotency-Key': '<value>',
    'x-org-id': '<value>',
    'referalli-mode': '<value>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"programId":"string","partnerId":"string","code":"string"}),
});
const data = await res.json();
Python
import requests

res = requests.request(
    "POST",
    "https://referalli.com/v1/coupons",
    headers={
    "Idempotency-Key": "<value>",
    "x-org-id": "<value>",
    "referalli-mode": "<value>",
    "Content-Type": "application/json",
    },
    json={"programId": "string", "partnerId": "string", "code": "string"},
)
data = res.json()
Go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	req, _ := http.NewRequest("POST", "https://referalli.com/v1/coupons", strings.NewReader(`{"programId":"string","partnerId":"string","code":"string"}`))
	req.Header.Set("Idempotency-Key", "<value>")
	req.Header.Set("x-org-id", "<value>")
	req.Header.Set("referalli-mode", "<value>")
	req.Header.Set("Content-Type", "application/json")
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)
	fmt.Println(string(body))
}
PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://referalli.com/v1/coupons');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Idempotency-Key: <value>', 'x-org-id: <value>', 'referalli-mode: <value>', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"programId":"string","partnerId":"string","code":"string"}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Ruby
require 'net/http'
require 'uri'

uri = URI('https://referalli.com/v1/coupons')
req = Net::HTTP::Post.new(uri)
req['Idempotency-Key'] = '<value>'
req['x-org-id'] = '<value>'
req['referalli-mode'] = '<value>'
req['Content-Type'] = 'application/json'
req.body = '{"programId":"string","partnerId":"string","code":"string"}'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(req)
end
puts res.body
Java
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpRequest.BodyPublishers;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://referalli.com/v1/coupons"))
    .header("Idempotency-Key", "<value>")
    .header("x-org-id", "<value>")
    .header("referalli-mode", "<value>")
    .header("Content-Type", "application/json")
    .method("POST", BodyPublishers.ofString("{\"programId\":\"string\",\"partnerId\":\"string\",\"code\":\"string\"}"))
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Responses
200 OK
Example
{
  "id": "string",
  "code": "string"
}
Schema
idstringrequired
codestringrequired
400 The request is invalid. error.code is one of:
Example
{
  "error": {
    "code": "validation_error",
    "message": "the body or query failed validation, an unknown field was sent, the body is not valid json, or a session call has no `x-org-id`",
    "details": [
      {
        "code": "invalid_format",
        "path": [
          "destinationUrl"
        ],
        "message": "Invalid URL"
      }
    ],
    "docs_url": "https://referalli.com/docs/errors-and-limits#validation_error"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
401 Missing or invalid credentials. error.code is one of:
Example
{
  "error": {
    "code": "unauthorized",
    "message": "no credentials, an unknown, revoked or expired api key or session, or a signature that did not verify",
    "docs_url": "https://referalli.com/docs/errors-and-limits#unauthorized"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
403 Authenticated, but not allowed. error.code is one of:
Example
{
  "error": {
    "code": "forbidden",
    "message": "the wrong role, a key without the needed scope (the message names it), not a member, a suspended org, or a publishable key from an origin it does not allow",
    "docs_url": "https://referalli.com/docs/errors-and-limits#forbidden"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
404 No such resource. error.code is one of:
Example
{
  "error": {
    "code": "not_found",
    "message": "the resource does not exist in this org (ids from other orgs look the same), a referenced id does not exist, a list cursor is not in the list, or the endpoint does not exist",
    "docs_url": "https://referalli.com/docs/errors-and-limits#not_found"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
409 The request conflicts with the current state. error.code is one of:
Example
{
  "error": {
    "code": "conflict",
    "message": "a unique value is taken, or the action would break a rule (the message says which)",
    "docs_url": "https://referalli.com/docs/errors-and-limits#conflict"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
422 The request cannot be processed as sent. error.code is one of:
Example
{
  "error": {
    "code": "idempotency_key_reused",
    "message": "the `idempotency-key` was used for a different request",
    "docs_url": "https://referalli.com/docs/errors-and-limits#idempotency_key_reused"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
429 Rate limited. error.code is one of:
Example
{
  "error": {
    "code": "rate_limited",
    "message": "an endpoint limit or the per-key quota was exceeded",
    "docs_url": "https://referalli.com/docs/errors-and-limits#rate_limited"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
500 Unexpected server error. error.code is one of:
Example
{
  "error": {
    "code": "internal_error",
    "message": "retry with backoff",
    "requestId": "req_8f2c1d4e5a6b7c8d",
    "docs_url": "https://referalli.com/docs/errors-and-limits#internal_error"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
default Any other error, in the same envelope.
Example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {},
    "requestId": "string",
    "docs_url": "string"
  }
}
Schema
errorobjectrequired
Show child parameters
codestringrequired
messagestringrequired
details
requestIdstring
docs_urlstringrequired
The docs entry for this error code: what it means and how to fix it.
Updated