# Sequence definition JSON Schema (https://docs.opensequence.dev/reference/definition-schema)

The JSON Schema of a sequence definition, generated from the Zod source of truth.

<Note>This page is generated from `packages/core/src/domain/definition/schema.ts` by `pnpm generate`. Do not edit it by hand; change the source and regenerate.</Note>

The same document is served by `GET /v1/schema` (with the node and channel catalogue) so a canvas, a script or an agent validates against what the service enforces. Node `params` are open here and validated per node type and channel action: see [Nodes and channels](/reference/nodes).

Limits: 200 nodes, 10 MB per definition, 1000 characters per SMS body, 100,000 characters per text email body and 5,000,000 per html email body, 300 characters per LinkedIn note (longer rendered notes are cut).

## Top level [#top-level]

| Param | Type | Required | Default | Constraints |
| --- | --- | --- | --- | --- |
| `schema_version` | `1` | yes |  |  |
| `entry` | string | yes |  | pattern `^[a-z][a-z0-9_]*$`; min length 1; max length 64 |
| `settings` | object | no | `{"reenroll":"never"}` |  |
| `exit_on` | array of `"reply"`, `"meeting_booked"` | no | `[]` |  |
| `nodes` | object | yes |  |  |

## settings [#settings]

| Param | Type | Required | Default | Constraints |
| --- | --- | --- | --- | --- |
| `send_window` | object | no |  |  |
| `jitter` | string | no |  | pattern `^(\d+)(m\|h\|d\|bd)$` |
| `reenroll` | string | no | `"never"` | pattern `^(never\|always\|after_\d+d)$` |

## settings.send_window [#settingssend_window]

| Param | Type | Required | Default | Constraints |
| --- | --- | --- | --- | --- |
| `days` | array of `"mon"`, `"tue"`, `"wed"`, `"thu"`, `"fri"`, `"sat"`, `"sun"` | yes |  | min items 1 |
| `from` | string | yes |  | pattern `^([01]\d\|2[0-3]):[0-5]\d$` |
| `to` | string | yes |  | pattern `^([01]\d\|2[0-3]):[0-5]\d$` |
| `tz` | `"contact"`, `"sender"` | no | `"contact"` |  |

## nodes.\{id\} [#nodesid]

Node ids are `lower_snake_case`, up to 64 characters.

| Param | Type | Required | Default | Constraints |
| --- | --- | --- | --- | --- |
| `type` | string | yes |  | min length 1 |
| `name` | string | no |  | max length 120 |
| `channel` | string | no |  |  |
| `action` | string | no |  |  |
| `params` | object | no |  |  |
| `next` | object | no | `{}` |  |
| `branches_by_outcome` | object | no |  |  |

## JSON Schema [#json-schema]

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schema_version": {
      "type": "number",
      "const": 1
    },
    "entry": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "pattern": "^[a-z][a-z0-9_]*$"
    },
    "settings": {
      "default": {
        "reenroll": "never"
      },
      "type": "object",
      "properties": {
        "send_window": {
          "type": "object",
          "properties": {
            "days": {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "mon",
                  "tue",
                  "wed",
                  "thu",
                  "fri",
                  "sat",
                  "sun"
                ]
              }
            },
            "from": {
              "type": "string",
              "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
            },
            "to": {
              "type": "string",
              "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
            },
            "tz": {
              "default": "contact",
              "type": "string",
              "enum": [
                "contact",
                "sender"
              ]
            }
          },
          "required": [
            "days",
            "from",
            "to"
          ]
        },
        "jitter": {
          "type": "string",
          "pattern": "^(\\d+)(m|h|d|bd)$"
        },
        "reenroll": {
          "default": "never",
          "type": "string",
          "pattern": "^(never|always|after_\\d+d)$"
        }
      }
    },
    "exit_on": {
      "default": [],
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "reply",
          "meeting_booked"
        ]
      }
    },
    "nodes": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "pattern": "^[a-z][a-z0-9_]*$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "minLength": 1
          },
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "channel": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "params": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "next": {
            "default": {},
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*$"
            }
          },
          "branches_by_outcome": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*$"
            }
          }
        },
        "required": [
          "type"
        ]
      }
    }
  },
  "required": [
    "schema_version",
    "entry",
    "nodes"
  ]
}
```
