---
title: "Search Notes by Keyword"
method: POST
path: "/v2/notes/search"
tags: ["Notes"]
---

# Search Notes by Keyword

`POST /v2/notes/search`

Search notes by keyword. The scope of the search is controlled by the request body:

- Provide `noteIds` to limit the search to specific notes.
- Provide `companyId` to limit the search to notes associated with a specific company.
- Omit both to search across your entire account.

`noteIds` and `companyId` are mutually exclusive.

Returns up to `limit` notes ordered by relevance. Prompts with no strong matches may
still return low-relevance results.

Each result contains a matched note and a single representative excerpt (a matching
passage from that note). Even if a note contains multiple matching passages, it appears
exactly once in the response with one excerpt.

## Request body

- union
  - object — Search all notes in the org, or limit to specific note IDs.
    - `prompt` string, required — The search query. Returns up to `limit` notes ordered by relevance. Prompts with no strong matches may still return low-relevance results.
    - `noteIds` integer[] — Limit search to these specific notes. Omit for org-wide search.
    - `limit` integer — Maximum number of notes to return.
  - object — Search notes associated with a specific company.
    - `prompt` string, required — The search query. Returns up to `limit` notes ordered by relevance. Prompts with no strong matches may still return low-relevance results.
    - `companyId` integer — Restrict search to notes associated with this company.
    - `limit` integer — Maximum number of notes to return.

## Response `201`

Created

- NotesKeywordSearchResult — Results of a keyword search over notes.
  - `data` NotesSearchResult[], required — Matching note results, one per note, ordered by relevance.
    - `note` object, required — The matched note.
      - `id` integer, required — The note's unique identifier.
      - `kind` 'note' | 'meeting-note' | 'email-note' | 'ai-summary' | 'meeting-ai-summary' | 'chat-message-note', required — The type of note. - `note`: user-written note - `meeting-note`: note attached to a meeting - `email-note`: note from an email thread - `ai-summary`: auto-generated note summary - `meeting-ai-summary`: auto-generated meeting summary - `chat-message-note`: note attached to a chat message
    - `preview` string, required — The matching passage, up to 2,000 characters.

## Other responses

- `400` — Bad Request
- `404` — Not Found
- `default` — Errors

---

[API](https://skmtc.net/affinity/apis/affinity-api-v2.md) · [All operations](https://skmtc.net/affinity/apis/affinity-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/affinity/affinity-api-v2/revisions/4c2891c31b7f/schema)
