> ## 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.

# Batch create recipients

> Create up to 100 recipients at once.

Instead of creating one recipient per HTTP request, Bodhveda provides a batching endpoint that lets you create up to 1000 recipients in a single API call.


## OpenAPI

````yaml POST /recipients/batch
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/batch:
    post:
      tags:
        - Recipients
      summary: Create up to 100 recipients at once.
      description: Create up to 100 recipients at once.
      operationId: batchCreateRecipients
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                recipients:
                  type: array
                  items:
                    $ref: '#/components/schemas/CreateRecipientPayload'
              required:
                - recipients
      responses:
        '200':
          description: Batch create recipients result
          content:
            application/json:
              examples:
                Batch create result:
                  summary: Batch Create Recipients Response
                  value:
                    data:
                      created:
                        - id: recipient_123
                      updated:
                        - id: recipient_456
                      failed:
                        - id: ''
                          batch_index: 2
                          errors:
                            - message: ID is required
                              description: ID cannot be empty
                              property_path: id
                              invalid_value: ''
      security:
        - BearerAuthWithAPIKeyWithFullAcessScope: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl -X POST https://api.bodhveda.com/recipients/batch \
              -H "Authorization: Bearer bv_xxxxxxxxx" \
              -H "Content-Type: application/json" \
              -d '{
                "recipients": [
                  { "id": "recipient_123", "name": "Alice Johnson" },
                  { "id": "recipient_456", "name": "Bob Smith" }
                ]
              }' 
        - lang: javascript
          label: JavaScript
          source: |-
            import { Bodhveda } from "@bodhveda/js";

            const bodhveda = new Bodhveda("bv_xxxxxxxxx");

            const res = await bodhveda.recipients.createBatch({
                recipients: [
                    { id: "recipient_123", name: "Alice Johnson" },
                    { id: "recipient_456", name: "Bob Smith" },
                ],
            });
            // res.created, res.updated, res.failed
        - lang: go
          label: Go
          source: >-
            import (
                "context"

                bodhveda "github.com/MudgalLabs/bodhveda/sdk/go"
            )


            ctx := context.Background()

            client := bodhveda.NewClient("bv_xxxxxxxxx", nil)


            alice, bob := "Alice Johnson", "Bob Smith"

            res, _ := client.Recipients.CreateBatch(ctx,
            &bodhveda.CreateRecipientsBatchRequest{
                Recipients: []bodhveda.CreateRecipientRequest{
                    {ID: "recipient_123", Name: &alice},
                    {ID: "recipient_456", Name: &bob},
                },
            })

            // res.Created, res.Updated, res.Failed
components:
  schemas:
    CreateRecipientPayload:
      type: object
      properties:
        id:
          type: string
          description: |-
            Unique identifier from your system. 

             This cannot be changed after creation. So use a stable identifier that will not change over time.
        name:
          type: string
          description: Name of the recipient.
      required:
        - id
  securitySchemes:
    BearerAuthWithAPIKeyWithFullAcessScope:
      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` scope.

````