> ## 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 Notes by Keyword. Includes SDK V2 and CLI requests, input constraints, response fields, and Deepline credit cost.

Search Notes by Keyword.

<Info>
  Tool ID: `affinity_v2_notes_search_post`
</Info>

## Run this action

Use the TypeScript SDK for a single call. Put `ctx.tools.execute(...)` inside a Play when the call should be durable, scheduled, or run across a CSV.

```ts theme={null}
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={null}
deepline tools execute affinity_v2_notes_search_post --input '{
  "prompt": "example"
}' --json
```

## Example response

The SDK exposes this shape at `result.toolResponse.raw`. Values below are representative.

```json theme={null}
{
  "data": {
    "data": [
      {
        "note": {
          "id": 123,
          "kind": "note"
        },
        "preview": "example"
      }
    ]
  }
}
```

Use `deepline tools get 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={null}
  {
    "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={null}
  {
    "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](/docs/providers/affinity/guide)
* [SDK V2 quickstart](/docs/sdk-v2/quickstart)
* [SDK reference](/docs/sdk-v2/sdk-reference)
* [Run tools across a CSV](/docs/sdk-v2/batch-csv)
