# Create a new subsequence

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /campaign/add/subsequence:
    post:
      summary: Create a new subsequence
      deprecated: false
      description: >-
        Creates a new subsequence under a specified parent campaign. The request
        payload must include the subsequence name, parent campaign ID, and an
        array of event objects.


        **Supported Event Types and Instructions:**


        1\. \*\*LEAD\_LABEL\_UPDATED\*\*  
           - \*\*Purpose:\*\* Adds leads based on lead labels.
           - \*\*Instruction:\*\*  
             Provide an array of lead labels in the \`val\` field.  
             \*\*Important:\*\* Each label \*\*must\*\* begin with \`LEAD\_MARKED\_AS\_\`.  
             \*\*Exact Example:\*\*  
         
             {
               "workspace\_id": "65099a0dd96fae8ab61130c0",
               "name": "API Sub Camp Name",
               "parent\_camp\_id": "67ee00f7612525c35a6e8abf",
               "events": \[{
                 "name": "LEAD\_LABEL\_UPDATED",
                 "val": \["LEAD\_MARKED\_AS\_INTERESTED", "LEAD\_MARKED\_AS\_MEETING\_BOOKED"\]
               }\]
             }
         


        2. \*\*LEAD\_REPLY\_CONTENT\*\*  
           - \*\*Purpose:\*\* Adds leads when a reply contains (or excludes) specified text.
           - \*\*Instruction:\*\*  
             The \`include\_text\` field is required and should specify the text that must appear in the lead's reply; you can also optionally provide \`exclude\_text\` for text that must not be present.  
             \*\*Exact Example:\*\*  
         
             {
               "name": "test",
               "parent\_camp\_id": "67edfddba4c4e2b75518d1b7",
               "events": \[{
                 "name": "LEAD\_REPLY\_CONTENT",
                 "include\_text": "call me, CALL ME",
                 "exclude\_text": "not interested, don't call me"
               }\]
             }
           

        3. \*\*LEAD\_REPLY\_ALL\*\*  
           - \*\*Purpose:\*\* Adds leads when any reply is received.
           - \*\*Instruction:\*\*  
             No additional fields are required beyond specifying the event name.  
             \*\*Exact Example:\*\*  
          
             {
               "name": "Test Subsequence with LEAD\_REPLY\_ALL",
               "parent\_camp\_id": "67ee00f7612525c35a6e8abf",
               "events": \[{
                 "name": "LEAD\_REPLY\_ALL"
               }\]
             }
             


        4. \*\*LEAD\_REPLY\_ALL\_EXCEPT\_OOO\_AUTOMATIC\_REPLY\*\*  
           - \*\*Purpose:\*\* Adds leads when any reply is received, excluding replies that are Out of Office or Automatic Replies.
           - \*\*Instruction:\*\*  
             No additional fields are required beyond specifying the event name.  
             \*\*Exact Example:\*\*  
           
             {
               "name": "Test Subsequence with LEAD\_REPLY\_ALL\_EXCEPT\_OOO\_AUTOMATIC\_REPLY",
               "parent\_camp\_id": "67ee00f7612525c35a6e8abf",
               "events": \[{
                 "name": "LEAD\_REPLY\_ALL\_EXCEPT\_OOO\_AUTOMATIC\_REPLY"
               }\]
             }
      operationId: Campaign_campaign/create-a-new-campaign-subsequence
      tags:
        - Campaign
        - Campaign
      parameters:
        - name: x-api-key
          in: header
          description: Your PlusVibe.ai account's API Key
          required: false
          example: ''
          schema:
            type: string
            description: Your PlusVibe.ai account's API Key
            default: ''
            examples:
              - your-api-key
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                workspace_id:
                  type: string
                  description: The workspace ID under which the subsequence is created.
                  examples:
                    - 65099a0dd96fae8ab61130c0
                name:
                  type: string
                  description: The name of the subsequence.
                  examples:
                    - New Subsequence Name
                parent_camp_id:
                  type: string
                  description: The parent campaign ID to which this subsequence belongs.
                  examples:
                    - 67ee00f7612525c35a6e8abf
                events:
                  type: array
                  description: >
                    An array of event definitions that determine when leads are
                    added. Each event object must specify one of the supported
                    event types and include the required fields for that type.
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        description: >
                          The event type. Must be one of the following: -
                          `LEAD_LABEL_UPDATED` - `LEAD_REPLY_CONTENT` -
                          `LEAD_REPLY_ALL` -
                          `LEAD_REPLY_ALL_EXCEPT_OOO_AUTOMATIC_REPLY`
                        examples:
                          - LEAD_LABEL_UPDATED
                      val:
                        type: array
                        description: ''
                        items:
                          type: string
                          description: ''
                          examples:
                            - LEAD_MARKED_AS_INTERESTED
                    required:
                      - name
                    x-apidog-orders:
                      - name
                      - val
              required:
                - workspace_id
                - name
                - parent_camp_id
                - events
              x-apidog-orders:
                - workspace_id
                - name
                - parent_camp_id
                - events
            examples: {}
      responses:
        '200':
          description: Campaign subsequence successfully created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: Indicates the status of the API call.
                    examples:
                      - success
                  id:
                    type: string
                    description: The unique ID of the newly created campaign subsequence.
                    examples:
                      - 67ee01f9a4c4e2b75518d1b8
                x-apidog-orders:
                  - status
                  - id
          headers: {}
          x-apidog-name: OK
        '400':
          description: >
            Bad Request. For example, if a subsequence is created with an
            invalid ID or if the parent campaign ID is missing.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message describing the issue.
                    examples:
                      - Parent Camp ID needed, Subsequence ID passed
                  error:
                    type: string
                    description: Detailed error information.
                    examples:
                      - Parent Camp ID needed, Subsequence ID passed
                x-apidog-orders:
                  - message
                  - error
          headers: {}
          x-apidog-name: Bad Request
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                properties: {}
                x-apidog-orders: []
          headers: {}
          x-apidog-name: Server Error
      security:
        - ApiKeyAuth: []
          x-apidog:
            schemeGroups:
              - id: uS5KiuC4wfZHK42AzOfA_
                schemeIds:
                  - ApiKeyAuth
            required: true
            use:
              id: uS5KiuC4wfZHK42AzOfA_
            scopes:
              uS5KiuC4wfZHK42AzOfA_:
                ApiKeyAuth: []
      x-apidog-folder: Campaign
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/929054/apis/api-17237996-run
components:
  schemas: {}
  securitySchemes:
    ApiKeyAuth:
      type: apikey
      in: header
      name: x-api-key
      description: |
        API key issued in the PlusVibe dashboard. The server reads it
        from the `x-api-key` header and injects it into the request as
        the `api_key` query parameter, which is why you will see
        `api_key` referenced in validation errors.
    apiKey:
      type: apikey
      in: body
      name: api_key
      description: API key passed in request body
servers:
  - url: https://api.plusvibe.ai/api/v1
    description: Prod Env
security:
  - ApiKeyAuth: []
    x-apidog:
      schemeGroups:
        - id: uS5KiuC4wfZHK42AzOfA_
          schemeIds:
            - ApiKeyAuth
      required: true
      use:
        id: uS5KiuC4wfZHK42AzOfA_
      scopes:
        uS5KiuC4wfZHK42AzOfA_:
          ApiKeyAuth: []

```
