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

# Create or link the project's default sequence



## OpenAPI

````yaml /openapi.yaml post /projects/{id}/sequences
openapi: 3.0.3
info:
  title: Leonar API
  description: >
    REST API for accessing and managing workspace data in Leonar CRM.


    ## Authentication


    All API requests require a Bearer token in the Authorization header:


    ```

    Authorization: Bearer leo_xxxxx

    ```


    API keys can be created and managed in Settings > API.


    ## Rate limiting


    - **2000 requests per hour by default**, configurable per workspace and
    shared by all API keys owned by the same user

    - Rate limit headers are included in all responses


    ## Pagination


    List endpoints support pagination via `limit` and `offset` query parameters.
  version: 1.0.0
  contact:
    name: Leonar Support
    url: https://leonar.ai
    email: support@leonar.ai
servers:
  - url: https://app.leonar.app/api/v1
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Contacts
    description: Manage contacts in your workspace
  - name: Companies
    description: Manage companies and their relationships
  - name: Deals
    description: Track and manage sales deals
  - name: Deal Pipelines
    description: View deal pipeline configurations
  - name: Projects
    description: Organize recruiting projects
  - name: Pipeline Entries
    description: Manage candidates in project pipelines
  - name: Tasks
    description: Track to-dos and follow-ups
  - name: Tags
    description: Organize resources with tags
  - name: Notes
    description: Manage notes on contacts, companies, deals, and projects
  - name: Sequences
    description: Automate outreach campaigns
  - name: Conversations
    description: View conversations across channels
  - name: Messages
    description: Send messages via email, LinkedIn, or WhatsApp
  - name: Enrichment
    description: Find emails and phone numbers for contacts
  - name: Sourcing
    description: Search and import candidates
  - name: Connected Accounts
    description: View linked LinkedIn accounts
paths:
  /projects/{id}/sequences:
    post:
      tags:
        - Projects
        - Sequences
      summary: Create or link the project's default sequence
      operationId: create-or-link-project-sequence
      parameters:
        - $ref: '#/components/parameters/projectId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  required:
                    - sequence_id
                  properties:
                    sequence_id:
                      type: string
                      format: uuid
                  additionalProperties: false
                - type: object
                  required:
                    - sequence
                  properties:
                    sequence:
                      $ref: '#/components/schemas/SequenceCreate'
                  additionalProperties: false
      responses:
        '200':
          description: Existing sequence linked
        '201':
          description: Sequence created and linked
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Project already has a linked sequence
components:
  parameters:
    projectId:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Project ID
  schemas:
    SequenceCreate:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          maxLength: 200
        status:
          type: string
          enum:
            - draft
          default: draft
        priority:
          type: string
          enum:
            - normal
            - high
          default: normal
        mode:
          type: string
          enum:
            - simple
            - advanced
          default: simple
        project_id:
          type: string
          format: uuid
        owner_ids:
          type: array
          minItems: 1
          maxItems: 50
          items:
            type: string
            format: uuid
        schedule_config:
          type: object
          additionalProperties: true
        steps:
          type: array
          maxItems: 50
          items:
            $ref: '#/components/schemas/SequenceCreateStep'
    SequenceCreateStep:
      type: object
      properties:
        client_key:
          type: string
          maxLength: 100
          description: Temporary key for referencing new steps from `parent_step_id`.
        type:
          type: string
          enum:
            - linkedin_invitation
            - linkedin_message
            - linkedin_inmail
            - linkedin_voice
            - linkedin_profile_view
            - email
            - whatsapp
            - call
            - email_enrichment
            - phone_enrichment
            - manual_step
          default: email
        name:
          type: string
          maxLength: 200
        subject:
          type: string
          maxLength: 500
        body:
          type: string
          maxLength: 50000
        content_template:
          type: object
          additionalProperties: true
          description: >-
            For `linkedin_voice`, must contain exactly one audio attachment with
            `kind: voice_note`.
        delay_days:
          type: integer
          minimum: 0
          maximum: 365
          default: 0
        delay_hours:
          type: integer
          minimum: 0
          maximum: 23
          default: 0
        execution_mode:
          type: string
          enum:
            - automatic
            - manual
          default: automatic
        sender_ids:
          type: array
          maxItems: 25
          items:
            type: string
            format: uuid
        parent_step_id:
          type: string
          nullable: true
          description: A `client_key` from this request.
        branch_condition:
          type: object
          nullable: true
          additionalProperties: false
          required:
            - type
            - branch
          properties:
            type:
              type: string
              minLength: 1
              maxLength: 100
            branch:
              type: string
              enum:
                - 'yes'
                - 'no'
            after_days:
              type: integer
              minimum: 0
              maximum: 365
        entry_conditions:
          type: object
          additionalProperties: true
          nullable: true
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - invalid_api_key
                - insufficient_scope
                - rate_limit_exceeded
                - validation_error
                - not_found
                - internal_error
                - billing_required
                - plan_upgrade_required
              description: >
                Error codes:

                - `invalid_api_key` — API key is missing, malformed, or revoked

                - `insufficient_scope` — API key lacks the required scope for
                this endpoint

                - `rate_limit_exceeded` — Too many requests (2000/hour)

                - `validation_error` — Request body or parameters failed
                validation

                - `not_found` — The requested resource does not exist

                - `internal_error` — Unexpected server error

                - `billing_required` — Workspace has no active subscription

                - `plan_upgrade_required` — Current plan does not include this
                feature
            message:
              type: string
              description: Human-readable error description
  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: Resource not found
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key starting with `leo_`

````