# Add leads to a campaign

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /lead/add:
    post:
      summary: Add leads to a campaign
      deprecated: false
      description: Send a list of lead objects to add to a campaign.
      operationId: Lead_lead/add-leads-to-a-campaign
      tags:
        - Lead
        - Lead
      parameters:
        - name: x-api-key
          in: header
          description: Your PlusVibe.ai account's API Key
          required: true
          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
                campaign_id:
                  type: string
                skip_if_in_workspace:
                  type: boolean
                  description: >-
                    When set to True, lead already existed in the workspace
                    would be skipped.
                resume_camp_if_completed:
                  type: boolean
                  description: >-
                    When set to True, a completed campaign will be resumed to
                    active.
                leads:
                  type: array
                  items:
                    type: object
                    properties:
                      email:
                        type: string
                      first_name:
                        type: string
                      last_name:
                        type: string
                      notes:
                        type: string
                      address_line:
                        type: string
                      city:
                        type: string
                      country:
                        type: string
                      country_code:
                        type: string
                      phone_number:
                        type: string
                      company_name:
                        type: string
                      company_website:
                        type: string
                      linkedin_person_url:
                        type: string
                      linkedin_company_url:
                        type: string
                      custom_variables:
                        type: object
                        properties:
                          functional_role:
                            type: string
                        required:
                          - functional_role
                        x-apidog-orders:
                          - functional_role
                        description: >-
                          Custom variables or workspace's additional fields
                          should be put inside this json object
                    x-apidog-orders:
                      - email
                      - first_name
                      - last_name
                      - notes
                      - address_line
                      - city
                      - country
                      - country_code
                      - phone_number
                      - company_name
                      - company_website
                      - linkedin_person_url
                      - linkedin_company_url
                      - custom_variables
                is_overwrite:
                  type: boolean
                  description: >-
                    (Optional) If true, existing lead will be updated with the
                    provided fields while retaining any unspecified fields.
                skip_lead_in_active_pause_camp:
                  type: boolean
                  description: >-
                    When set to True, lead already existed in Active/Paused
                    campaigns would be skipped
                skip_lead_for_active_only_camp:
                  type: boolean
                  description: >-
                    When set to True, lead already existed in Active campaigns
                    would be skipped
                hubspot_sync:
                  type: boolean
                  description: When set to True, the lead will be synced to Hubspot as well
              required:
                - workspace_id
                - campaign_id
                - leads
              x-apidog-orders:
                - workspace_id
                - campaign_id
                - skip_if_in_workspace
                - skip_lead_in_active_pause_camp
                - skip_lead_for_active_only_camp
                - resume_camp_if_completed
                - hubspot_sync
                - leads
                - is_overwrite
            example:
              workspace_id: 6724392a2b582b83709e43d7
              campaign_id: 678ed62eeac0980768c2292f
              skip_if_in_workspace: false
              skip_lead_in_active_pause_camp: true
              skip_lead_for_active_only_camp: false
              resume_camp_if_completed: false
              hubspot_sync: false
              leads:
                - email: lead2@example.com
                  first_name: Jane
                  last_name: Smith
                  notes: This is a lead referred by XYZ
                  address_line: 123 Main St
                  city: San Francisco
                  country: USA
                  country_code: US
                  phone_number: '+1234567890'
                  company_name: Example Corp
                  company_website: https://example.com
                  linkedin_person_url: https://linkedin.com/in/janesmith
                  linkedin_company_url: https://linkedin.com/company/another
                  custom_variables:
                    functional_role: Marketing
              is_overwrite: false
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: ''
                    examples:
                      - success
                  total_sent:
                    type: integer
                    description: ''
                    format: int32
                    examples:
                      - 10
                  leads_uploaded:
                    type: integer
                    description: ''
                    format: int32
                    examples:
                      - 8
                  duplicate_email_count:
                    type: integer
                    description: ''
                    format: int32
                    examples:
                      - 1
                  already_in_campaign:
                    type: integer
                    description: ''
                    format: int32
                  invalid_email_count:
                    type: integer
                    description: ''
                    format: int32
                  skipped:
                    type: integer
                    description: ''
                    format: int32
                    examples:
                      - 1
                  remaining_in_plan:
                    type: integer
                    description: ''
                    format: int32
                    examples:
                      - 490
                  overflowed_lead_count:
                    type: integer
                    description: ''
                    format: int32
                x-apidog-orders:
                  - status
                  - total_sent
                  - leads_uploaded
                  - duplicate_email_count
                  - already_in_campaign
                  - invalid_email_count
                  - skipped
                  - remaining_in_plan
                  - overflowed_lead_count
          headers: {}
          x-apidog-name: OK
        '400':
          description: Validation or other error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: ''
                    examples:
                      - Validation error
                  error:
                    type: string
                    description: ''
                    examples:
                      - Validation error
                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: Lead
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/929054/apis/api-17238007-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: []

```
