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

# Create a sequence

> Create the email steps a campaign sends. Step 0 goes out on enrollment; each later step waits `wait_days` after the previous one and, with `thread_mode: "reply"`, threads under the first email.

Merge variables: `{{first_name}}`, `{{company}}`, `{{title}}`, `{{domain}}`, `{{location}}`. Bodies are simple HTML — `<p>`, `<br>`, `<strong>`, `<a>`.

A/B variants inside a step require Pro or Business.

Requires the `write` permission.



## OpenAPI

````yaml POST /api/outreach/sequences
openapi: 3.1.0
info:
  title: ManyPI API
  description: >-
    The REST API behind ManyPI — AI lead generation, email validation,
    cold-email outreach, agent runs and web scraping. Every endpoint is
    authenticated with a ManyPI API key (`mpi_...`) or an OAuth 2.1 access
    token, and honours the permissions granted to that credential.
  version: 2.0.0
  contact:
    name: ManyPI Support
    email: support@manypi.com
    url: https://manypi.com
servers:
  - url: https://app.manypi.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Leads
    description: Find, store, enrich and manage leads.
  - name: Email validation
    description: Verify that lead addresses can receive mail.
  - name: Outreach
    description: Inboxes, sequences, campaigns, sending and replies.
  - name: Agent
    description: Agent runs, replies and skills.
  - name: Scraping
    description: Scrapers, runs and extracted data.
  - name: Endpoints
    description: Publish scrapers as typed REST endpoints.
  - name: Account
    description: Key validation and account information.
paths:
  /api/outreach/sequences:
    post:
      tags:
        - Outreach
      summary: Create a sequence
      description: >-
        Create the email steps a campaign sends. Step 0 goes out on enrollment;
        each later step waits `wait_days` after the previous one and, with
        `thread_mode: "reply"`, threads under the first email.


        Merge variables: `{{first_name}}`, `{{company}}`, `{{title}}`,
        `{{domain}}`, `{{location}}`. Bodies are simple HTML — `<p>`, `<br>`,
        `<strong>`, `<a>`.


        A/B variants inside a step require Pro or Business.


        Requires the `write` permission.
      operationId: createSequence
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - steps
              properties:
                name:
                  type: string
                  maxLength: 120
                description:
                  type: string
                  maxLength: 500
                steps:
                  type: array
                  minItems: 1
                  maxItems: 10
                  items:
                    $ref: '#/components/schemas/SequenceStep'
            example:
              name: Agency outbound Q3
              steps:
                - subject: Quick question about {{company}}
                  body_html: <p>Hi {{first_name}},</p><p>…</p>
                  wait_days: 0
                  thread_mode: new
                - subject: ''
                  body_html: <p>Following up on the above.</p>
                  wait_days: 3
                  thread_mode: reply
      responses:
        '200':
          description: The created sequence.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sequence'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: A/B variants require Pro or Business.
components:
  schemas:
    SequenceStep:
      type: object
      required:
        - subject
        - body_html
      properties:
        subject:
          type: string
          maxLength: 300
          description: >-
            Merge variables allowed. Empty on a `reply` step, which sends as
            "Re:" the first email's subject.
        body_html:
          type: string
          description: 'Simple HTML: `<p>`, `<br>`, `<strong>`, `<a>`.'
        wait_days:
          type: integer
          minimum: 0
          maximum: 90
          description: Days after the previous step. Step 0 is 0.
        thread_mode:
          type: string
          enum:
            - new
            - reply
          description: Step 0 is always `new`.
    Sequence:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        description:
          type: string
          nullable: true
        steps:
          type: array
          items:
            $ref: '#/components/schemas/SequenceStep'
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable message.
        code:
          type: string
          description: >-
            A machine-readable code on gated failures: `lead_limit`,
            `outreach_locked`, `validation_credits_exhausted`.
  responses:
    BadRequest:
      description: The request body or parameters failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: >-
        Missing, invalid or expired credential — or a key that lacks the
        permission this route requires.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        A ManyPI API key (`mpi_...`) from Settings → API keys, or an OAuth 2.1
        access token obtained through the MCP consent flow.

````