# draftSearchPlan

query · in the family [Reading your records](/reference/reading-your-records/)

## What it does

Describe what you are looking for in plain words and get a search plan back — the start, the relationships to follow, the conditions on each step — shown in words before anything runs.

Draft ONE search plan from plain words: the assistant routes your words onto the plan grammar — the start family, up to 3 hops along KNOWN relationships, each step's conditions — in ONE strict structured call; then each step's conditions pass through the SAME interpreter the filter builder uses (names resolve inside your tenant; every clause re-validated exactly as hand-built); the assembled plan passes THE PLAN GATE before you see it (a refused plan is re-asked ONCE with the gate's own words, then refused VALIDATION/INVALID in the teaching voice). NOTHING runs and nothing is saved: the answer is the plan IN WORDS + the exact JSON document searchPlanRun(plan) / startSearchJob(plan) accept — you decide. `words` is one written ask, 1..500 characters. Refuses INTEGRATION/UNAVAILABLE while the assistant is offline/keyless — build the plan by hand. Requires authentication (user sessions). Every call is cost-metered (at.ai.call.v1 — the route call as office.plan_draft, each step as office.filter_interpret).

## What happens

A drafting assist: nothing runs and nothing is saved. The assistant routes your words onto the plan grammar and interprets each step’s conditions (names resolve inside your organization); the plan passes the same gate a hand-built plan passes; you run it with searchPlanRun or startSearchJob. Every call is metered like any other AI call.

## Who may call it

Capability area: **Reading your records** — Looking up and listing the records of your organization.

- Owner
- System Administrator
- Manager
- Associate Manager
- Warehouse Associate
- Sales Associate
- An API key whose scope allows `api:draftSearchPlan`

## Arguments

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `words` | [String](/types/#scalars) `String!` | yes | No further notes. |

## Returns

[SearchPlanDraft](/types/SearchPlanDraft/) `SearchPlanDraft!` — NOTHING has run.

## Example request

```graphql
query ExampleDraftSearchPlan($words: String!) {
  draftSearchPlan(words: $words) {
    words
    planJson
    reasoning
  }
}
```

Variables:

```json
{
  "words": "<words>"
}
```

## Example response

```json
{
  "data": {
    "draftSearchPlan": {
      "words": "<words>",
      "planJson": "<plan json>",
      "reasoning": "<reasoning>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

## Errors this call can answer

- `VALIDATION/INVALID` — Something in the request is not valid. ([VALIDATION](/errors/VALIDATION/))
- `AUTHN/REQUIRED` — Sign in to do this. ([AUTHN](/errors/AUTHN/))
- `AUTHZ/FORBIDDEN` — Your role does not allow this action. ([AUTHZ](/errors/AUTHZ/))
- `RATE_LIMIT/THROTTLED` — Too many requests in a short time. ([RATE_LIMIT](/errors/RATE_LIMIT/))
