> ## 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 Semantic Search Post

> Search Affinity records of a chosen type with a natural-language description, optionally within specific lists. Includes SDK V2 examples, schemas, and cost.

Search Affinity records of a chosen type with a natural-language description, optionally within specific lists.

> [!NOTE]
>
> Tool ID: `affinity_v2_semantic_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_semantic_search_post',
  {
    "prompt": "example"
  },
);

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

### CLI

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline tools execute affinity_v2_semantic_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": [
      {
        "id": 123,
        "name": "Example",
        "domain": "example.com",
        "domains": [
          "example.com"
        ],
        "isGlobal": true,
        "score": "example"
      }
    ],
    "entityType": "companies",
    "explanation": "example"
  }
}
```

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

## Input reference

Semantic search criteria including search prompt and entity type

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.prompt` | `string` | Yes | — | The search prompt to apply. Minimum length: 1. Maximum length: 500. |
| `payload.limit` | `integer` | No | `100` | Number of items to include in the response. Format: `int32`. Minimum: 1. Maximum: 100. |
| `payload.entityType` | `"companies"` | No | — | The type of entity to search for. |
| `payload.listIds` | `array` | No | — | The IDs of the lists to filter results by. Maximum items: 100. |

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

  ### Input JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "Semantic search criteria including search prompt and entity type",
    "properties": {
      "prompt": {
        "type": "string",
        "description": "The search prompt to apply.",
        "minLength": 1,
        "maxLength": 500
      },
      "limit": {
        "type": "integer",
        "description": "Number of items to include in the response.",
        "default": 100,
        "minimum": 1,
        "maximum": 100,
        "format": "int32"
      },
      "entityType": {
        "type": "string",
        "description": "The type of entity to search for.",
        "const": "companies"
      },
      "listIds": {
        "type": "array",
        "description": "The IDs of the lists to filter results by.",
        "maxItems": 100,
        "items": {
          "type": "integer",
          "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[].id` | `integer` | Yes | — | Format: `int64`. Minimum: 1. Maximum: 9007199254740991. |
| `result.data.data[].name` | `string` | Yes | — | — |
| `result.data.data[].domain` | `string \| null` | Yes | — | Format: `hostname`. |
| `result.data.data[].domains` | `array` | Yes | — | Maximum items: 100. |
| `result.data.data[].isGlobal` | `boolean` | Yes | — | — |
| `result.data.data[].score` | `string` | Yes | — | — |
| `result.data.entityType` | `"companies"` | Yes | — | — |
| `result.data.explanation` | `string` | Yes | — | — |
| `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": {
                "id": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991,
                  "format": "int64"
                },
                "name": {
                  "type": "string"
                },
                "domain": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "hostname"
                },
                "domains": {
                  "type": "array",
                  "maxItems": 100,
                  "items": {
                    "type": "string",
                    "format": "hostname"
                  }
                },
                "isGlobal": {
                  "type": "boolean"
                },
                "score": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name",
                "domain",
                "domains",
                "isGlobal",
                "score"
              ],
              "additionalProperties": false
            }
          },
          "entityType": {
            "type": "string",
            "const": "companies"
          },
          "explanation": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "entityType",
          "explanation"
        ],
        "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.