> ## 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.

# Clay Enterprise: Clay Run Query

> Search or count your Clay workflow runs with a query, returning matching runs newest-first and a cursor (beta). Includes SDK V2 examples, schemas, and cost.

Search or count your Clay workflow runs with a query, returning matching runs newest-first and a cursor (beta).

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

## 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(
  'clay_run_query',
  {
    "query": "software companies hiring engineers"
  },
);

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

### CLI

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline run clay_run_query --input '{
  "query": "software companies hiring engineers"
}'
```

## 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": [
      {
        "action_credits_used": 123,
        "created_at": "2026-01-15T12:00:00Z",
        "data_credits_used": 123,
        "ended_at": "2026-01-15T12:00:00Z",
        "id": "id_123",
        "input_field_count": 123,
        "output_field_count": 123,
        "run_status": "example",
        "started_at": "2026-01-15T12:00:00Z",
        "trigger_id": "trigger_123",
        "workflow_id": "workflow_123",
        "workflow_snapshot_id": "workflow_snapshot_123"
      }
    ],
    "mode": "select"
  }
}
```

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

## Input reference

Execute a Clay workflow-run query. A `select` query returns matching runs newest-first with a `cursor` for the next page. A `count` query returns the number of matching runs. Get the query grammar with GET /workflows/runs/query/reference. Results are read from an eventually-consistent replica (replication lag is typically a few seconds), so a just-created or just-transitioned run may briefly be missing or show its prior status.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.cursor` | `string` | No | — | — |
| `payload.limit` | `integer` | No | — | Minimum: 1. Maximum: 100. |
| `payload.query` | `string` | Yes | — | Minimum length: 1. Maximum length: 2000. |

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

  ### Input JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "Execute a Clay workflow-run query. A `select` query returns matching runs newest-first with a `cursor` for the next page; a `count` query returns the number of matching runs. Get the query grammar with GET /workflows/runs/query/reference. Results are read from an eventually-consistent replica (replication lag is typically a few seconds), so a just-created or just-transitioned run may briefly be missing or show its prior status.",
    "properties": {
      "cursor": {
        "type": "string"
      },
      "limit": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      },
      "query": {
        "type": "string",
        "minLength": 1,
        "maxLength": 2000
      }
    },
    "required": [
      "query"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

Standard tool result payload.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.data` | `object` | Yes | — | Provider response payload. |
| `result.data.cursor` | `string` | No | — | — |
| `result.data.data` | `array` | Yes | — | — |
| `result.data.data[].action_credits_used` | `number` | Yes | — | — |
| `result.data.data[].created_at` | `string` | Yes | — | — |
| `result.data.data[].data_credits_used` | `number` | Yes | — | — |
| `result.data.data[].ended_at` | `string \| null` | Yes | — | — |
| `result.data.data[].id` | `string` | Yes | — | — |
| `result.data.data[].input_field_count` | `integer` | Yes | — | — |
| `result.data.data[].output_field_count` | `integer` | Yes | — | — |
| `result.data.data[].run_status` | `string` | Yes | — | — |
| `result.data.data[].started_at` | `string` | Yes | — | — |
| `result.data.data[].trigger_fired_id` | `string \| null` | No | — | — |
| `result.data.data[].trigger_id` | `string \| null` | Yes | — | — |
| `result.data.data[].workflow_id` | `string` | Yes | — | — |
| `result.data.data[].workflow_snapshot_id` | `string` | Yes | — | — |
| `result.data.mode` | `"select"` | Yes | — | — |
| `result.data.count` | `integer` | Yes | — | — |
| `result.meta` | `object` | No | — | Additional response metadata (status, paging). |

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

  ### Output JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "Standard tool result payload.",
    "properties": {
      "data": {
        "description": "Provider response payload.",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "cursor": {
                "type": "string"
              },
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "action_credits_used": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "data_credits_used": {
                      "type": "number"
                    },
                    "ended_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "input_field_count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "output_field_count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "run_status": {
                      "type": "string"
                    },
                    "started_at": {
                      "type": "string"
                    },
                    "trigger_fired_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "trigger_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "workflow_id": {
                      "type": "string"
                    },
                    "workflow_snapshot_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "workflow_id",
                    "workflow_snapshot_id",
                    "trigger_id",
                    "run_status",
                    "started_at",
                    "ended_at",
                    "created_at",
                    "data_credits_used",
                    "action_credits_used",
                    "input_field_count",
                    "output_field_count"
                  ],
                  "additionalProperties": false
                }
              },
              "mode": {
                "type": "string",
                "const": "select"
              }
            },
            "required": [
              "mode",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "mode": {
                "type": "string",
                "const": "count"
              }
            },
            "required": [
              "mode",
              "count"
            ],
            "additionalProperties": false
          }
        ]
      },
      "meta": {
        "type": "object",
        "description": "Additional response metadata (status, paging).",
        "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

* [Connect integrations](https://deepline.com/docs/integrations.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.