# Change definitions key scripts scriptId

Edits a call script, which in this table means writing the NEXT VERSION: the live version is retired and a new one written in the same transaction, so the ladder never has two live rungs and never has none. It answers 201 with the new script, because the id the caller sent is not the id it now holds. A field not sent is inherited. The id may name any version — the ladder continues from the LIVE one. Leads page, admin.

Access class: `def:admin`.

## Endpoint

`PATCH /v1/definitions/{key}/scripts/{scriptId}`

## Parameters

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

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "branches": [
      {
        "children": "string",
        "exit": "string",
        "id": "",
        "next": "string",
        "say": "string",
        "tag": "string",
        "trigger": "string"
      }
    ],
    "brief": {
      "headline": "string",
      "hooks": [
        "string"
      ],
      "key_facts": [
        "string"
      ],
      "watch_outs": [
        "string"
      ]
    },
    "name": "string",
    "spine": [
      {
        "key": "string",
        "label": "string",
        "purpose": "string",
        "say": "string"
      }
    ]
  },
  "params": {
    ":key": "string",
    ":scriptId": ""
  },
  "query": {}
}
```

## Responses

### 200

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "branches": [
      "string"
    ],
    "brief": {
      "headline": "string"
    },
    "createdAt": "string",
    "definitionKey": "string",
    "generator": "string",
    "id": 1.5,
    "kind": "string",
    "name": "string",
    "scope": "string",
    "spine": [
      {
        "key": "string",
        "label": "string",
        "purpose": "string",
        "say": "string"
      }
    ],
    "updatedAt": "string",
    "version": 1.5
  }
}
```

### 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"
}
```
