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

# Add multiple items to a campaign

> Allows adding multiple items to a specific campaign identified by `campaignId`. Authentication is required using an API key passed in the `X-Api-Key` header. You can retrieve your API key from your profile when logged in to [Starleads](https://app.starleads.co/).



## OpenAPI

````yaml POST /CampaignItem/{campaignId}/bulk-add-items
openapi: 3.0.1
info:
  title: Starleads public API documentation
  description: >
    Welcome to the Starleads Public API documentation. This API provides public
    access to Starleads services, allowing developers and growth-hackers to
    interact with campaign-related data.

    ***

    ### Base endpoint

    ```https://api.starleads.co```

    ***

    ### Errors

    The API uses standard HTTP status codes to indicate the success or failure
    of the API call. In case of failure, the body of the response will be JSON
    in the following format:

    ```

    {
      "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
      "title": "Bad Request",
      "status": 400,
      "detail": "No campaign exists with campaignId : 11111111"
    }

    ```

    The ```type``` property is a link to a general description of the error
    type.

    ***

    ### Authentification

    Authentication for the API is handled with an API key that must be provided
    as a ```X-Api-Key``` header for every request.<br>

    **API keys are supposed to be a secret that only the client and server know.
    Please remember to not share them with anyone.**<br>

    You can find your API keys when authenticated in your Starleads profile
    :<br> ![Api key menu option](../images/api-menu-option-screenshot.png)
  version: v1
  x-logo:
    url: https://api.starleads.co/images/starleads-logo.png
servers: []
security: []
tags:
  - name: Agent
    description: >-
      Manage your AI agent's prompt. These endpoints allow you to read and
      update the prompt that drives your agent's behavior during calls.
  - name: CampaignField
    description: >-
      CampaignFields enables users to specify customizable fields within their
      campaigns. These fields serve as placeholders (e.g., ```{lastname}```)
      that can be dynamically filled with corresponding data when creating
      prompts, providing flexibility in tailoring campaign content based on
      specific variables.<br>**Those are the keys of the ```databag``` field of
      the request payload to add a new ```CampaignItem``` to a campaign.**
  - name: CampaignItem
    description: Represents prospects entries related to a campaign
  - name: Consumption
    description: >-
      Track your company's credit consumption. These endpoints expose your
      current balance, usage and billing period so you can build budget
      monitoring on top of the API.
  - name: Subscription
    description: >-
      Inspect your subscription contract: the plan you are on, your subscription
      status, the features currently active and your effective limits. No
      pricing information is exposed.
  - name: AgentTest
    description: >-
      Tests of your agents: simulation tests (a simulated user talks to the
      agent and each success criterion is judged) and classification tests (the
      agent must produce the expected tag for a conversation). A test belongs to
      one agent.
  - name: AgentTestExecution
    description: >-
      Executions of agent tests: launching a set of tests, following their
      progress and cancelling them. One execution groups the runs created
      together for a list of tests, each repeated up to 5 times.
  - name: AgentTestFolder
    description: >-
      Folders grouping the tests of an agent (flat, with a name, a color and a
      markdown body).
  - name: AgentTestRun
    description: >-
      Runs of agent tests: one run is one attempt of one test inside an
      execution. Results, history and cancellation.
  - name: SimulationChat
    description: >-
      Test an agent through a text chat, exactly as it would behave in a real
      conversation (prompt, fields and connected tools included). Start a chat,
      then exchange messages with the agent.
  - name: SubAgent
    description: >-
      Configure the sub-agents your agents delegate to: a sub-agent handles a
      sub-task (document lookup, date computation, writing in an imposed format)
      in its own conversation. Connect them to an agent through the Agent
      endpoints.
paths:
  /CampaignItem/{campaignId}/bulk-add-items:
    post:
      tags:
        - CampaignItem
      summary: Add multiple items to a campaign
      description: >-
        Allows adding multiple items to a specific campaign identified by
        `campaignId`. Authentication is required using an API key passed in the
        `X-Api-Key` header. You can retrieve your API key from your profile when
        logged in to [Starleads](https://app.starleads.co/).
      operationId: BulkAddCampaignItems
      parameters:
        - name: X-Api-Key
          in: header
          description: >-
            Api key to pass as a ```X-Api-Key``` request header. You can get
            yours in your profile when authenticated in
            [Starleads](https://app.starleads.co/)
          required: true
          schema:
            type: string
        - name: campaignId
          in: path
          description: ID of the campaign.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkAddItemRequest'
          text/json:
            schema:
              $ref: '#/components/schemas/BulkAddItemRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/BulkAddItemRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkAdditemResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    BulkAddItemRequest:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/PublicCampaignItem'
          nullable: true
      additionalProperties: false
    BulkAdditemResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ItemLogError'
          nullable: true
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    PublicCampaignItem:
      required:
        - phoneNumber
      type: object
      properties:
        phoneNumber:
          minLength: 1
          type: string
          description: Phone number of the campaign item. It must be unique.
        dataBag:
          type: object
          additionalProperties:
            type: string
          description: >-
            The databag refer to the campaign fields. The Databag needs one key
            / entry per **mandatory** fields of the targeted campaign.<br>If one
            mandatory field is missing from the databag, an error will be
            returned.<br>Databag's keys that aren't properties of the targeted
            campaign will be ignored.<br>If the campaign has no mandatory
            fields, this property can be ommited
          nullable: true
        nextTryDate:
          type: string
          description: >-
            The next date when the number will be called again by
            Starleads.<br>If this property is not set (or set to null), it will
            be setted by default to today.
          format: 'DateTime format eg : 2023-11-17T12:44:50.809Z'
          nullable: true
      additionalProperties: false
    ItemLogError:
      type: object
      properties:
        item:
          $ref: '#/components/schemas/PublicCampaignItem'
        errorDescription:
          type: string
          nullable: true
      additionalProperties: false

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.