> ## Documentation Index
> Fetch the complete documentation index at: https://docs.komerza.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Affiliates

> Searches affiliates by the `query` parameter and applies filtering/sorting/pagination.
The query is matched against affiliate email, affiliate link/code, affiliate ID, and customer ID.
Requires the `stores.affiliates.view` permission.

## Filterable Fields

This endpoint supports filtering and sorting. See the [Filtering & Sorting Guide](/api-reference/filtering) for syntax details.

| Field | Type | Description |
| - | - | - |
| `isEnabled` | boolean | Filter by whether the affiliate profile is enabled |
| `email` | string | Filter by affiliate email (case-insensitive contains) |
| `link` | string | Filter by referral link or code |
| `balance` | number | Current unpaid balance |
| `allTimeEarned` | number | Total commission earned across all time |
| `referredOrders` | integer | Number of orders attributed to this affiliate |
| `payoutCount` | integer | Number of payouts recorded against this affiliate |
| `returnPercentage` | number | The affiliate's commission rate |
| `percentageOff` | number | The customer discount applied to their referrals |
| `dateCreated` | datetime | When the affiliate profile was created |

Numeric and date fields take ranges through the comparison operators rather than separate from/to parameters.

**Sortable:** `isEnabled`, `email`, `link`, `referredOrders`, `allTimeEarned`, `payoutCount`, `dateCreated`.

**Example:**

```bash theme={null}
# Enabled affiliates who have earned over 100, biggest earners first
GET /stores/{storeId}/affiliates?filters=isEnabled==true,allTimeEarned>=100&sorts=-allTimeEarned

# Affiliates with an outstanding balance and at least one referred order
GET /stores/{storeId}/affiliates?filters=balance>0,referredOrders>=1
```


## API Specification

The full API specification for this endpoint is available in the [documentation index](https://docs.komerza.com/llms.txt).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.