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

# Add contact

> Register a per-medium contact address for a recipient. Email needs a **primary** email contact to receive email. A duplicate `(medium, address)`, or a second primary for the same `(recipient, medium)`, returns `409`.

Register a contact address for a recipient. To send email to a recipient, add an `email` contact and mark it `is_primary`.

💡 Sync this **server-side** (e.g. on your `/me` endpoint) so the address never rides a browser request.


## OpenAPI

````yaml POST /recipients/{recipient_id}/contacts
openapi: 3.0.3
info:
  title: Bodhveda Notifications API
  version: '1.0'
  description: API for sending notifications to recipients or broadcasting to all.
servers: []
security: []
paths:
  /recipients/{recipient_id}/contacts:
    post:
      tags:
        - Contacts
      summary: Add a contact to a recipient
      description: >-
        Register a per-medium contact address for a recipient. Email needs a
        **primary** email contact to receive email. A duplicate `(medium,
        address)`, or a second primary for the same `(recipient, medium)`,
        returns `409`.
      operationId: createRecipientContact
      parameters:
        - name: recipient_id
          in: path
          required: true
          schema:
            type: string
          description: The unique identifier of the recipient.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRecipientContactPayload'
      responses:
        '201':
          description: Contact created
          content:
            application/json:
              examples:
                Contact created:
                  summary: Contact Created Response
                  value:
                    message: Contact created
                    data:
                      id: 1
                      medium: email
                      address: alice@example.com
                      is_primary: true
                      verified_at: null
                      created_at: '2025-11-07T05:31:56Z'
                      updated_at: '2025-11-07T05:31:56Z'
        '409':
          description: >-
            A contact with this address, or a primary contact for this medium,
            already exists.
          content:
            application/json:
              examples:
                Conflict:
                  summary: Contact Conflict
                  value:
                    message: Contact already exists
      security:
        - BearerAuthWithAPIKeyWithEitherScope: []
      x-codeSamples:
        - lang: curl
          source: >-
            curl -X POST
            https://api.bodhveda.com/recipients/recipient_123/contacts \
              -H "Authorization: Bearer bv_xxxxxxxxx" \
              -H "Content-Type: application/json" \
              -d '{
                "medium": "email",
                "address": "alice@example.com",
                "is_primary": true
              }'
components:
  schemas:
    CreateRecipientContactPayload:
      type: object
      properties:
        medium:
          type: string
          description: The delivery transport. Only `email` is exercised today.
          enum:
            - email
            - sms
            - web_push
            - mobile_push
        address:
          type: string
          description: >-
            The contact address. For email it must contain `@` and is stored
            lowercased.
        is_primary:
          type: boolean
          description: >-
            Mark this as the primary contact for its medium. Only one primary is
            allowed per `(recipient, medium)`.
          default: false
      required:
        - medium
        - address
  securitySchemes:
    BearerAuthWithAPIKeyWithEitherScope:
      type: http
      scheme: bearer
      bearerFormat: APIKey
      description: >-
        Bearer authentication header of the form `Bearer bv_xxxxxxxxx`, where
        `bv_xxxxxxxxx` is your **API Key** with `Full access` or `Recipient
        acess` scope.

````