---
title: "Get sale(s)"
method: GET
path: "/sales"
---

# Get sale(s)

`GET /sales`

Returns sales for your program. Filter by a single sale with `id`, by the affiliate who earned it, by the referral it belongs to, or by the IDs the sale has in your own system (`saleExternalId` and `saleExternalInvoiceId`). With no parameters, every sale in the program is returned.

Every sale is returned with a `commissionEarned` field — the commission recorded for the affiliate credited with that sale.

## Query parameters

- `id` integer
- `affiliateId` string, uuid
- `affiliateEmail` string, email
- `referralId` string, uuid
- `saleExternalId` string
- `saleExternalInvoiceId` string

## Response `200`

A single sale when filtering by `id` (`null` if no match), otherwise an array.

- union
  - Sale
    - `id` integer — The sale ID
    - `affiliateId` string, uuid, nullable — The affiliate credited with this sale
    - `referralId` string, uuid, nullable — The referral this sale belongs to
    - `affiliateProgramId` string, uuid, nullable — The affiliate program this sale belongs to
    - `affiliateLinkId` string, uuid, nullable — The affiliate link the sale was attributed to
    - `promotionalCodeId` string, uuid, nullable — The promotional code used on this sale, if any
    - `externalId` string, nullable — The ID of this sale in your own system. Unique per program.
    - `externalInvoiceId` string, nullable — The ID of the invoice in your own system. Unique per program.
    - `name` string, nullable — Name of the customer
    - `email` string, email, nullable — Email of the customer
    - `totalEarned` number, float — Gross value of the sale
    - `commissionRate` number, float, nullable — Commission rate applied to this sale
    - `commissionEarned` number, float, nullable — Commission recorded for the credited affiliate. Merged in by the API from the sale's commission record — it is not a column on the sale itself.
    - `taxAmount` number, float — Tax deducted before commission was calculated
    - `shippingAmount` number, float — Shipping deducted before commission was calculated
    - `productsBought` string[] — Product identifiers attached to this sale
    - `clicks` integer — Clicks attributed to this sale
    - `status` 'ACTIVE' | 'REFUNDED' — Whether the sale is live or has been refunded
    - `refundedAt` string, date-time, nullable — When the sale was marked refunded
    - `paymentTrigger` 'SIGNUP' | 'PURCHASE' | 'BONUS' | 'CONTENT_REWARD' — What triggered the commission for this sale
    - `source` 'UNKNOWN' | 'API' | 'INTEGRATION' | 'MANUAL' | 'IMPORTED' | 'AUTOMATED' — Where the sale came from. Sales created through this API have `API`.
    - `metadata` object, nullable — Arbitrary JSON you can attach to the sale
    - `createdAt` string, date-time — When the sale was recorded
  - Sale[]
    - `id` integer — The sale ID
    - `affiliateId` string, uuid, nullable — The affiliate credited with this sale
    - `referralId` string, uuid, nullable — The referral this sale belongs to
    - `affiliateProgramId` string, uuid, nullable — The affiliate program this sale belongs to
    - `affiliateLinkId` string, uuid, nullable — The affiliate link the sale was attributed to
    - `promotionalCodeId` string, uuid, nullable — The promotional code used on this sale, if any
    - `externalId` string, nullable — The ID of this sale in your own system. Unique per program.
    - `externalInvoiceId` string, nullable — The ID of the invoice in your own system. Unique per program.
    - `name` string, nullable — Name of the customer
    - `email` string, email, nullable — Email of the customer
    - `totalEarned` number, float — Gross value of the sale
    - `commissionRate` number, float, nullable — Commission rate applied to this sale
    - `commissionEarned` number, float, nullable — Commission recorded for the credited affiliate. Merged in by the API from the sale's commission record — it is not a column on the sale itself.
    - `taxAmount` number, float — Tax deducted before commission was calculated
    - `shippingAmount` number, float — Shipping deducted before commission was calculated
    - `productsBought` string[] — Product identifiers attached to this sale
    - `clicks` integer — Clicks attributed to this sale
    - `status` 'ACTIVE' | 'REFUNDED' — Whether the sale is live or has been refunded
    - `refundedAt` string, date-time, nullable — When the sale was marked refunded
    - `paymentTrigger` 'SIGNUP' | 'PURCHASE' | 'BONUS' | 'CONTENT_REWARD' — What triggered the commission for this sale
    - `source` 'UNKNOWN' | 'API' | 'INTEGRATION' | 'MANUAL' | 'IMPORTED' | 'AUTOMATED' — Where the sale came from. Sales created through this API have `API`.
    - `metadata` object, nullable — Arbitrary JSON you can attach to the sale
    - `createdAt` string, date-time — When the sale was recorded

## Other responses

- `401` — The `Authorization` header is missing, is not a `Bearer` header, or the token is not valid.
- `403` — API access is not enabled for this account.
- `404` — The affiliate program this token belongs to no longer exists.
- `429` — Too many requests for this token on this endpoint. Please slow down.

---

[API](https://skmtc.net/referly/apis/referly-api.md) · [All operations](https://skmtc.net/referly/apis/referly-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/referly/referly-api/versions/0f506d61b9c3/schema)
