# Generate a call script for a record

Builds a call script from one lead's own facts AND SAVES it as that lead's own version — which is what makes the Generate button mean something. Regenerating retires the previous row-scoped version in the same transaction, so the lead's ladder never forks. The answer carries `ai_status: disabled` and the script is stored as `static`: no model is wired here, and a static script must never be mistaken for an AI one. Leads page only.

Access class: `def:read`.

## Endpoint

`POST /v1/definitions/{key}/rows/{rowId}/script/generate`

## Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| key | path | string | Yes |
| rowId | path | string | Yes |

## Request body

Content type: `application/json`.

```json
{
  "body": {},
  "params": {
    ":key": "string",
    ":rowId": ""
  },
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "branches": [
      {
        "children": [
          {
            "children": [
              {
                "children": [
                  {
                    "children": [
                      {
                        "exit": "string",
                        "id": "",
                        "say": "string",
                        "tag": "string",
                        "trigger": "string"
                      }
                    ],
                    "exit": "string",
                    "id": "",
                    "say": "string",
                    "tag": "string",
                    "trigger": "string"
                  }
                ],
                "id": "",
                "next": "string",
                "say": "string",
                "tag": "string",
                "trigger": "string"
              }
            ],
            "exit": "string",
            "id": "",
            "next": "string",
            "say": "string",
            "tag": "string",
            "trigger": "string"
          }
        ],
        "id": "",
        "next": "string",
        "say": "string",
        "tag": "string",
        "trigger": "string"
      }
    ],
    "brief": {
      "headline": "string",
      "hooks": [
        "string"
      ],
      "key_facts": [
        "string"
      ],
      "watch_outs": [
        "string"
      ]
    },
    "generator": "string",
    "id": 1.5,
    "source_context": {
      "ai_status": "string",
      "name": "string",
      "resolved_from": "string",
      "script_id": 1.5,
      "version": 1.5
    },
    "spine": [
      {
        "key": "string",
        "label": "string",
        "purpose": "string",
        "say": "string"
      }
    ],
    "status": "string"
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
