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

# Bulk add contacts to segment

> Add multiple contacts to a manual segment by contact IDs or email addresses. Data-driven segments do not support bulk add operations.



## OpenAPI

````yaml /openapi.json post /v1/segments/{id}/contacts/bulk
openapi: 3.0.3
info:
  title: Emailr API
  version: 1.0.0
servers:
  - url: https://api.emailr.dev
    description: Production
security: []
tags:
  - name: emails
    description: Email sending and management
  - name: contacts
    description: Contact management
  - name: templates
    description: Email template management
  - name: domains
    description: Domain verification and management
  - name: webhooks
    description: Webhook configuration
  - name: broadcasts
    description: Broadcast campaign management
  - name: segments
    description: Contact segmentation
paths:
  /v1/segments/{id}/contacts/bulk:
    post:
      tags:
        - segments
      summary: Bulk add contacts to segment
      description: >-
        Add multiple contacts to a manual segment by contact IDs or email
        addresses. Data-driven segments do not support bulk add operations.
      operationId: bulkAddContactsToSegment
      parameters:
        - schema:
            type: string
            format: uuid
            example: 123e4567-e89b-12d3-a456-426614174000
          required: true
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkAddContactsToSegmentRequest'
      responses:
        '200':
          description: Contacts added to segment
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkAddContactsToSegmentResponse'
        '400':
          description: Validation error or segment type not supported
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Segment not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    BulkAddContactsToSegmentRequest:
      type: object
      properties:
        contact_ids:
          type: array
          items:
            type: string
            format: uuid
          description: Array of contact IDs to add to the segment
          example:
            - 123e4567-e89b-12d3-a456-426614174000
            - 223e4567-e89b-12d3-a456-426614174001
        emails:
          type: array
          items:
            type: string
            format: email
          description: >-
            Array of email addresses to add to the segment (will be looked up in
            contacts)
          example:
            - user1@example.com
            - user2@example.com
    BulkAddContactsToSegmentResponse:
      type: object
      properties:
        added:
          type: integer
          description: Number of contacts successfully added to the segment
          example: 10
        already_in_segment:
          type: integer
          description: Number of contacts that were already in the segment
          example: 2
        not_found:
          type: integer
          description: Number of emails that were not found in the contacts list
          example: 1
      required:
        - added
        - already_in_segment
        - not_found
    Error:
      type: object
      properties:
        error:
          type: string
          example: An error occurred
        code:
          type: string
          example: VALIDATION_ERROR
        details: {}
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: API key authentication. Use your API key as the bearer token.

````