> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequenzy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Sequence (Deprecated)

> Deprecated compatibility alias that creates a disabled AI-generated sequence draft

# Generate Sequence (Deprecated)

<Warning>
  This endpoint is deprecated. Use `POST /api/v1/sequences` with `name`,
  `trigger`, and `goal` for new integrations.
</Warning>

Creates and persists a disabled sequence draft using a `contact_added` trigger.
The endpoint remains as a compatibility alias; it returns `Deprecation: true`
and a successor `Link` header. It never enables the sequence.

## Request

<ParamField body="goal" type="string" required>
  The sequence goal or desired subscriber journey.
</ParamField>

<ParamField body="name" type="string">
  Optional sequence name. Defaults to a normalized version of `goal`.
</ParamField>

<ParamField body="listId" type="string">
  Optional list ID that scopes the `contact_added` trigger.
</ParamField>

<ParamField body="emailCount" type="number">
  Number of emails to generate. Defaults to `5`. Maximum is `10`.
</ParamField>

<ParamField body="durationDays" type="number">
  Duration used to space suggested delays. Defaults to `14`.
</ParamField>

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/generate/sequence" \
  -H "Authorization: Bearer seq_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Workspace onboarding",
    "goal": "Onboard a new workspace admin",
    "emailCount": 3,
    "durationDays": 7
  }'
```

## Responses

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "deprecated": true,
    "deprecationMessage": "POST /api/v1/generate/sequence is deprecated. Use POST /api/v1/sequences with goal-based creation.",
    "sequence": {
      "id": "seq_123",
      "name": "Workspace onboarding",
      "status": "draft",
      "trigger": "trigger_list",
      "emailCount": 3,
      "enrichmentStatus": "processing"
    },
    "message": "Sequence created. AI is generating email content based on your brand. This typically takes 30-60 seconds."
  }
  ```

  ```json 400 theme={null}
  {
    "error": "emailCount must be a positive integer"
  }
  ```

  ```json 400 theme={null}
  {
    "error": "emailCount must be no more than 10"
  }
  ```

  ```json 401 theme={null}
  {
    "error": "Invalid API key"
  }
  ```

  ```json 403 theme={null}
  {
    "error": "No companies found. Create a company first using the create_company tool."
  }
  ```

  ```json 500 theme={null}
  {
    "error": "Failed to create sequence"
  }
  ```
</ResponseExample>
