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

# Affinity: V2 Notes Search Post

> Search Affinity notes by keyword, optionally limited to one company or specific notes. Includes inputs, outputs, SDK V2 examples, and Deepline cost.

Search Affinity notes by keyword, optionally limited to one company or specific notes.

> [!NOTE]
>
> Tool ID: `affinity_v2_notes_search_post`

## Run this action

Use the TypeScript SDK for one call. Use `ctx.tools.execute(...)` inside a Play for durable calls, scheduled calls, or CSV processing.

```ts theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'affinity_v2_notes_search_post',
  {
    "prompt": "example"
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline tools execute affinity_v2_notes_search_post --input '{
  "prompt": "example"
}' --json
```

## Example response

The SDK returns this shape at `result.toolResponse.raw`. The example values illustrate the response.

```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
{
  "data": {
    "data": [
      {
        "note": {
          "id": 123,
          "kind": "note"
        },
        "preview": "example"
      }
    ]
  }
}
```

Use `deepline describe affinity_v2_notes_search_post --json` for the latest machine-readable contract.

## Input reference

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.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.prompt` | `string` | Yes | — | The search query. Returns up to `limit` notes ordered by relevance. Prompts with no strong matches may still return low-relevance results. Minimum length: 3. Maximum length: 500. |
| `payload.noteIds` | `array` | No | — | Limit search to these specific notes. Omit for org-wide search. Maximum items: 100. |
| `payload.limit` | `integer` | No | `20` | Maximum number of notes to return. Format: `int32`. Minimum: 1. Maximum: 100. |
| `payload.companyId` | `integer` | No | — | Restrict search to notes associated with this company. Format: `int64`. Minimum: 1. Maximum: 9007199254740991. |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "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.",
    "properties": {
      "prompt": {
        "type": "string",
        "description": "The search query. Returns up to `limit` notes ordered by relevance. Prompts with no strong matches may still return low-relevance results.",
        "minLength": 3,
        "maxLength": 500
      },
      "noteIds": {
        "type": "array",
        "description": "Limit search to these specific notes. Omit for org-wide search.",
        "maxItems": 100,
        "items": {
          "type": "integer",
          "minimum": 1,
          "maximum": 2147483647,
          "format": "int32"
        }
      },
      "limit": {
        "type": "integer",
        "description": "Maximum number of notes to return.",
        "default": 20,
        "minimum": 1,
        "maximum": 100,
        "format": "int32"
      },
      "companyId": {
        "type": "integer",
        "description": "Restrict search to notes associated with this company.",
        "minimum": 1,
        "maximum": 9007199254740991,
        "format": "int64"
      }
    },
    "required": [
      "prompt"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.data` | `object` | Yes | — | — |
| `result.data.data` | `array` | Yes | — | Maximum items: 100. |
| `result.data.data[].note` | `object` | Yes | — | — |
| `result.data.data[].note.id` | `integer` | Yes | — | Format: `int32`. Minimum: 1. Maximum: 2147483647. |
| `result.data.data[].note.kind` | `"note" \| "meeting-note" \| "email-note" \| "ai-summary" \| "meeting-ai-summary" \| "chat-message-note"` | Yes | — | Allowed: `note`, `meeting-note`, `email-note`, `ai-summary`, `meeting-ai-summary`, `chat-message-note`. |
| `result.data.data[].preview` | `string` | Yes | — | Maximum length: 2000. |
| `result.meta` | `object` | No | — | — |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "properties": {
      "data": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "object",
              "properties": {
                "note": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483647,
                      "format": "int32"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "note",
                        "meeting-note",
                        "email-note",
                        "ai-summary",
                        "meeting-ai-summary",
                        "chat-message-note"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "kind"
                  ],
                  "additionalProperties": false
                },
                "preview": {
                  "type": "string",
                  "maxLength": 2000
                }
              },
              "required": [
                "note",
                "preview"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "data"
        ],
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Affinity provider guide](https://deepline.com/docs/providers/affinity/guide.md)
* [SDK V2 quickstart](https://deepline.com/docs/sdk-v2/quickstart.md)
* [SDK reference](https://deepline.com/docs/sdk-v2/sdk-reference.md)
* [Run tools across a CSV](https://deepline.com/docs/sdk-v2/batch-csv.md)


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