> The index of all pages is at https://docs.afffast.com/llms.txt.

# Search

Find conversions, programs, brands, links, connections, sites, tags, payouts and deals by name or ID with one API request.

`GET /v1/search?q=<text>` searches your workspace in one request. Use it to find an object when you know a part of its name or its ID. The dashboard command menu uses the same endpoint.

```bash
curl "https://api.example.com/v1/search?q=summer" \
  -H "Authorization: Bearer sk_test_..."
```

```json
{
  "object": "search_results",
  "livemode": false,
  "query": "summer",
  "data": [
    {
      "object": "program",
      "id": "prog_0Yx3kqW7sRzL1nH8aBcD4e",
      "title": "Summer Shop",
      "subtitle": "awin"
    },
    {
      "object": "tag",
      "id": "tag_0Yx3kqW7sRzL1nH8aBcD5f",
      "title": "Summer sale",
      "subtitle": null
    }
  ]
}
```

## What the search finds

| Object type  | The text matches                         | `title`               | `subtitle`                 |
| ------------ | ---------------------------------------- | --------------------- | -------------------------- |
| `conversion` | The order ID or the external ID          | The order ID          | The amount and the network |
| `program`    | The name                                 | The name              | The network                |
| `brand`      | The name or the domain                   | The name              | The domain                 |
| `link`       | The code or the destination              | The code              | The destination            |
| `connection` | The label                                | The label             | The network                |
| `site`       | The name or the domain                   | The name              | The domain                 |
| `tag`        | The name                                 | The name              | None                       |
| `payout`     | The invoice reference or the external ID | The invoice reference | The amount and the network |
| `deal`       | The title or the code                    | The title             | The code, or the network   |

The search ignores the case of letters. The characters `%` and `_` have no special meaning. The search ignores objects in the [Trash](https://docs.afffast.com/docs/trash.md). A search in a test key finds test data only. A search in a live key finds live data only.

## The order of the answer

The answer has one group for each object type, in the order of the table. Inside a group, the order is:

1. The objects with an ID that starts with the text. The text must have an underscore (`_`), for example `prog_0Yx3`.
2. The objects with a name, a label, a code or a title that contains the text. For a conversion, this is the order ID.
3. In each of these parts, the newest object is first.

Use `limit` to set the number of matches for each type. The default is 5. The maximum is 10. Use the ID of a match to read the object with its own endpoint, for example `GET /v1/programs/{id}`.

## Scopes

The request needs no scope. The answer has only the types that the key can read. For example, a key with the scope `programs:read` and no other read scope gets programs only. A key that can read none of the types gets an empty list.

The search has the [rate limits](https://docs.afffast.com/docs/rate-limits.md) of the other endpoints.
