cURL
curl --request POST 'https://api.integrateledger.com/v1/customers/referral-codes?customerId=user_123' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"programId":"friends"}'import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.createReferralCode({ customerId: "user_123", body: { programId: "friends" } });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.create_referral_code(customer_id="user_123", program_id="friends"){
"code": "<string>",
"programId": "<string>",
"customerId": "<string>",
"createdAt": "<string>"
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "insufficient_permissions",
"requiredScope": "customers:read",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "payload_too_large",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}{
"error": "rate_limited",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}Customers
Get a customer's referral code
The code a customer shares to refer others.
POST
/
v1
/
customers
/
referral-codes
cURL
curl --request POST 'https://api.integrateledger.com/v1/customers/referral-codes?customerId=user_123' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"programId":"friends"}'import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.createReferralCode({ customerId: "user_123", body: { programId: "friends" } });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.create_referral_code(customer_id="user_123", program_id="friends"){
"code": "<string>",
"programId": "<string>",
"customerId": "<string>",
"createdAt": "<string>"
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "insufficient_permissions",
"requiredScope": "customers:read",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "payload_too_large",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}{
"error": "rate_limited",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}Returns the customer’s code in a referral program: made on the first call, the same one on every call after. Codes are 8 characters from A-Z and 2-9 without 0, O, 1, I or L, unique among your codes of every kind. The customer who signs up with it redeems it with Redeem a code.
404 referral_program_not_found for an unknown or archived program. Needs the Customers permission at Write.Authorizations
Body
application/json