Skip to main content

Partner API

The Partner API lets your server read the partners of your programme with your secret API key. The main use: show a signed-in customer of your app their own referral links and recruit link, without sending them to the partner portal.

API Version: v1

Endpoints:

  • GET /api/v1/programs/{programId}/partners/lookup?email= -- find a partner by email, with their links
  • GET /api/v1/programs/{programId}/partners -- list the partners of a programme
  • GET /api/v1/programs/{programId}/partners/{partnerId} -- read one partner

The Partner API only reads. Approving, suspending and other changes to a partner stay in the Selgeo dashboard.

Prerequisites​

  • A secret API key (sk_test_* or sk_live_*) from the Selgeo dashboard (Settings > API Keys)
  • The ID of your programme: open the programme's settings in the dashboard and copy the ID from the address bar (/programs/{programId}/settings)

Authentication​

Pass the secret key as a Bearer token in the Authorization header:

Authorization: Bearer sk_test_YOUR_KEY

The key's mode selects the data: a sk_test_* key reads the partners of your test programmes, a sk_live_* key the partners of your live programmes. A key of the other mode finds no partner of the programme.

Never expose secret keys in frontend code

Call the Partner API from your server only. The response holds your partners' email addresses. Never send the secret key to the browser or a mobile app.

Find a partner by email​

curl "https://app.selgeo.com/api/v1/programs/YOUR_PROGRAMME_ID/partners/lookup?email=anna%40example.com" \
-H "Authorization: Bearer sk_test_YOUR_KEY"

The email matches without regard to case. Encode it in the query (@ is %40).

Response (200 OK)​

{
"partner": {
"id": "8f0c2f9e-4b7a-4f1e-9a51-2a5d7c3b9e10",
"programDefinitionId": "1d2e3f40-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
"displayName": "Anna",
"email": "anna@example.com",
"status": "approved",
"appliedAt": "2026-11-02T09:14:00.000Z",
"approvedAt": "2026-11-02T09:14:00.000Z"
},
"referralLinks": [
{
"id": "c4b1a2d3-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"label": "Newsletter",
"url": "https://example.com/pricing?ref=k3Jq9xYb2LmN"
}
],
"recruitUrl": "https://app.selgeo.com/apply/your-programme?recruit=AbCdEfGhIjKl"
}

partner is the same object as GET /api/v1/programs/{programId}/partners/{partnerId} returns; the example shows some of its fields.

FieldDescription
partner.statuspending, approved, deactivated, suspended, rejected or expired. A suspended, rejected or expired partner earns no commissions. A deactivated partner earns only on the customers they already brought.
referralLinksThe partner's referral links, newest first, at most 50. A partner creates them in the partner portal, so a new partner can have none: the list is then empty.
referralLinks[].urlThe link to share. A visit through it is attributed to the partner.
recruitUrlThe partner's recruit link: a person who applies through it becomes the partner's recruit, and the partner earns the level-2 commission on that recruit's customers. null when the partner cannot recruit now, for example a partner with no level-2 rate or a partner who is not approved.

List and read partners​

curl "https://app.selgeo.com/api/v1/programs/YOUR_PROGRAMME_ID/partners?status=approved&page=1&pageSize=50" \
-H "Authorization: Bearer sk_test_YOUR_KEY"

The list takes the same filters as the dashboard: status, search (part of the name or email), dateFrom, dateTo, page and pageSize. Each item of data is a partner object as in the lookup. The full parameters are in the API Reference.

Errors​

StatusCodeCause
400VALIDATION_ERRORThe email parameter is missing or is not an email address
401MISSING_AUTH_HEADER, INVALID_AUTH_FORMAT, INVALID_TOKEN, INVALID_SECRET_KEYNo key, a header that is not Bearer <key>, a value that is not a secret key, or a key that is not active
403PROGRAM_FORBIDDENList or read: the programme belongs to another workspace
404PARTICIPANT_NOT_FOUND, PROGRAM_NOT_FOUNDNo partner with this email in this programme and mode, or the partner's data was erased; list or read: no programme with this ID
429HTTP_429More than 1,000 requests a minute to one endpoint from one IP address
  1. When a customer signs in, call the lookup with the email of their account.
  2. On 200 with partner.status approved, show referralLinks and recruitUrl (when it is not null). For any other status, show no links: a suspended, rejected or expired partner earns no commissions, and the links of a deactivated partner bring no new customers.
  3. On 404, show a link to your programme's application page instead: https://app.selgeo.com/apply/YOUR_PROGRAMME_SLUG.
  4. Keep the answer for a few minutes, or until the customer opens the page again. The links in it change when the partner adds, renames or deletes a link, when the partner's status, level-2 rate or display name changes, and when the programme stops being active.

The lookup finds a partner only by the email they applied with. This is the email the dashboard shows; a change of the partner's login email in the partner portal does not change it. When your customers can apply with another address, ask them to use the email of their account.

Example (Node.js)​

async function findPartnerLinks(email: string) {
const url = new URL(
`https://app.selgeo.com/api/v1/programs/${process.env.SELGEO_PROGRAMME_ID}/partners/lookup`
);
url.searchParams.set('email', email);

const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.SELGEO_SECRET_KEY}` },
});
if (response.status === 404) {
return null;
}
if (!response.ok) {
throw new Error(`Selgeo Partner API answered ${response.status}`);
}

const { partner, referralLinks, recruitUrl } = await response.json();

return { status: partner.status, referralLinks, recruitUrl };
}

Rate limit​

The Partner API allows 1,000 requests a minute per endpoint and IP address. A request over the limit gets 429 with a Retry-After header. Keep the answers for a short time instead of calling the API on each page view.