cURL
curl --request GET 'https://api.integrateledger.com/v1/customers/referrals?customerId=user_123' \
-H "Authorization: Bearer $LEDGER_API_KEY"import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.listCustomerReferrals({ customerId: "user_123" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.list_customer_referrals(customer_id="user_123"){
"codes": [
{
"code": "<string>",
"programId": "<string>",
"customerId": "<string>",
"createdAt": "<string>"
}
],
"asReferrer": [
{
"referralId": 123,
"programId": "<string>",
"referrerId": "<string>",
"refereeId": "<string>",
"status": "pending",
"refusedReason": "same_payment_method",
"rewardedAt": "<string>",
"createdAt": "<string>"
}
],
"asReferee": {
"referralId": 123,
"programId": "<string>",
"referrerId": "<string>",
"refereeId": "<string>",
"status": "pending",
"refusedReason": "same_payment_method",
"rewardedAt": "<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": "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
List a customer's referrals
A customer’s referral codes, who they referred, and who referred them.
GET
/
v1
/
customers
/
referrals
cURL
curl --request GET 'https://api.integrateledger.com/v1/customers/referrals?customerId=user_123' \
-H "Authorization: Bearer $LEDGER_API_KEY"import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.listCustomerReferrals({ customerId: "user_123" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.list_customer_referrals(customer_id="user_123"){
"codes": [
{
"code": "<string>",
"programId": "<string>",
"customerId": "<string>",
"createdAt": "<string>"
}
],
"asReferrer": [
{
"referralId": 123,
"programId": "<string>",
"referrerId": "<string>",
"refereeId": "<string>",
"status": "pending",
"refusedReason": "same_payment_method",
"rewardedAt": "<string>",
"createdAt": "<string>"
}
],
"asReferee": {
"referralId": 123,
"programId": "<string>",
"referrerId": "<string>",
"refereeId": "<string>",
"status": "pending",
"refusedReason": "same_payment_method",
"rewardedAt": "<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": "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."
}Lists the customer’s referral codes, each customer they referred (
asReferrer, newest first) with its status (pending, rewarded or refused) and refusedReason, and who referred them (asReferee). A promotion code the customer redeemed isn’t a referral, so it isn’t listed here; see List a customer’s redemptions. Needs the Customers permission at Read.Authorizations
Response
The customer's referral codes, the customers they referred, and who referred them. A promotion code they redeemed isn't a referral, so it isn't here.