# Search the workspace (https://notert.io/docs/api/reference/search-the-workspace)

`GET /api/v1/search`

Finds anything in the workspace the way the app's search box does: the requests matching some words, and the conversations, changelog entries and help articles the token's scopes let it read, each best first; or, for a pasted Notert link to a request or a conversation, or its id, that one alone. A kind the token's scopes don't reach is null.

Access: A token with requests:read.

## Query parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | Yes | Words to look for, such as part of a request's title or a customer's name, or a pasted link to a request or conversation in Notert, or its id. At least 1 character. At most 200 characters. |

## Response 200

| Field | Type | Description |
| --- | --- | --- |
| `requests` | object[] | The requests whose title, details or documents best match the words, typos and accents forgiven, best first; the one a pasted link or id names alone. |
| `requests.id` | string | The record's id, which its own endpoints take. |
| `requests.title` | string | The record's title. |
| `requests.status` | string | Where the record stands, in its own kind's words: a request's status, from pending to completed or closed; a changelog entry's draft, scheduled or published; a help article's draft or published. One of: `pending`, `in_review`, `planned`, `in_progress`, `completed`, `closed`. |
| `conversations` | object[] or null | The conversations whose customer the words name, best first; the one a pasted link or id names alone. Null for a token without the conversations:read scope. |
| `conversations.id` | string | The record's id, which its own endpoints take. |
| `conversations.customer` | string | The conversation's customer by the name the team knows them by, empty when they gave none. Their email address is never answered. |
| `conversations.customerAlias` | string or null | The name the inbox gives a customer who gave none, an adjective and an animal such as "Calm Otter", by which the team finds them in Notert. Never their name, so never call them by it. Null once they gave one. |
| `conversations.preview` | string or null | How what was said last begins, cut short. Null when nothing was said yet. |
| `changelogEntries` | object[] or null | The changelog entries whose title or text best match the words, drafts included, best first. Null for a token without the changelog:read scope. |
| `changelogEntries.id` | string | The record's id, which its own endpoints take. |
| `changelogEntries.title` | string | The record's title. |
| `changelogEntries.status` | string | Where the record stands, in its own kind's words: a request's status, from pending to completed or closed; a changelog entry's draft, scheduled or published; a help article's draft or published. One of: `draft`, `scheduled`, `published`. |
| `helpArticles` | object[] or null | The help articles whose title or text best match the words, drafts included, best first. Null for a token without the help:read scope. |
| `helpArticles.id` | string | The record's id, which its own endpoints take. |
| `helpArticles.title` | string | The record's title. |
| `helpArticles.status` | string | Where the record stands, in its own kind's words: a request's status, from pending to completed or closed; a changelog entry's draft, scheduled or published; a help article's draft or published. One of: `draft`, `published`. |

## Errors

| Status | Code | Message |
| --- | --- | --- |
| 400 | `BAD_REQUEST` | Input validation failed. |
| 401 | `UNAUTHORIZED` | Send a valid API token as a Bearer token. |
| 403 | `HOLDER_NOT_ALLOWED` | The teammate who holds this API token's secret can't do this in the workspace now. A teammate who can should roll it in the workspace's settings. |
| 403 | `INSUFFICIENT_SCOPE` | This API token can't read requests, boards, tags and statuses. Create one that may in the workspace's settings. |
| 403 | `NETWORK_NOT_ALLOWED` | This API token works only from the networks it was made for. Call from one of them, or create a token for this one in the workspace's settings. |
| 429 | `TOO_MANY_REQUESTS` | Too Many Requests. Its data holds `retryAfter`. |

## Example request

```sh
curl "https://app.notert.io/api/v1/search?query=dark+mode" \
  -H "Authorization: Bearer $NOTERT_API_TOKEN"
```

## Example response 200

```json
{
  "requests": [
    {
      "id": "8f2c4b1e-3a6d-4f0b-9c2e-5d7a1b3c9e40",
      "title": "Dark mode",
      "status": "planned"
    }
  ],
  "conversations": [
    {
      "id": "8f2c4b1e-3a6d-4f0b-9c2e-5d7a1b3c9e40",
      "customer": "Hannah Lee",
      "customerAlias": "Calm Otter",
      "preview": "Is dark mode coming soon?"
    }
  ],
  "changelogEntries": [
    {
      "id": "8f2c4b1e-3a6d-4f0b-9c2e-5d7a1b3c9e40",
      "title": "Dark mode",
      "status": "planned"
    }
  ],
  "helpArticles": [
    {
      "id": "8f2c4b1e-3a6d-4f0b-9c2e-5d7a1b3c9e40",
      "title": "Dark mode",
      "status": "planned"
    }
  ]
}
```
