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

# Create Bulk User

> **/user/bulk**

<Note>
  This endpoint requires authentication. Include your Bearer token in the Authorization header.
</Note>

## Description

**/user/bulk**

**Description:**
The `/user/bulk` endpoint allows the creation of multiple users simultaneously by providing an array of user objects, each containing user details.

**Method:**
`POST`

**Request Payload:**

| Parameter                  | Type    | Description                                                     |
| -------------------------- | ------- | --------------------------------------------------------------- |
| users                      | array   | An array of user objects with their details.                    |
| sendEmail *(Optional)*     | boolean | This sends an invite email to the users, by default it is true. |
| redirect\_url *(Optional)* | string  | The URL to redirect after creation.                             |
| message *(Optional)*       | string  | For passing the invite email custom message.                    |

> See sample response for request payload in the `body` below

## Code Examples

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch('https://api.royalti.io/user/bulk', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      "users": [
        {
          "firstName": "sample-firstName",
          "lastName": "sample-lastName",
          "nickName": "sample-nickName",
          "userType": "sample-userType",
          "email": "sample-email",
          "ipi": "sample-ipi",
          "role": "sample-role",
          "phone": "sample-phone",
          "country": "sample-country"
        }
      ],
      "sendEmail": true,
      "redirect_url": "sample-redirect_url",
      "message": "sample-message"
    })
  });

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
    'https://api.royalti.io/user/bulk',
    headers={
      'Authorization': f'Bearer {token}'
    },
    json={"users":[{"firstName":"sample-firstName","lastName":"sample-lastName","nickName":"sample-nickName","userType":"sample-userType","email":"sample-email","ipi":"sample-ipi","role":"sample-role","phone":"sample-phone","country":"sample-country"}],"sendEmail":true,"redirect_url":"sample-redirect_url","message":"sample-message"}
  )

  data = response.json()
  print(data)
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.royalti.io/user/bulk \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"users":[{"firstName":"sample-firstName","lastName":"sample-lastName","nickName":"sample-nickName","userType":"sample-userType","email":"sample-email","ipi":"sample-ipi","role":"sample-role","phone":"sample-phone","country":"sample-country"}],"sendEmail":true,"redirect_url":"sample-redirect_url","message":"sample-message"}'

  ```
</CodeGroup>


## OpenAPI

````yaml post /user/bulk
openapi: 3.0.0
info:
  title: Royalti.io API
  description: "# Royalti API\r\n\r\nThis is the Royalti music royalty management platform API server.\r\n\r\n## Overview\r\n\r\nThe Royalti API provides comprehensive music royalty management services including:\r\n- Music publishing and writer management\r\n- Royalty processing and analytics\r\n- DDEX integration for music industry standards\r\n- File processing and pattern recognition\r\n- Payment processing and distribution\r\n\r\n## Authentication\r\n\r\nThe API uses JWT-based authentication with multiple protection levels:\r\n- Public endpoints for basic operations\r\n- Protected endpoints requiring valid JWT tokens\r\n- Admin endpoints for administrative functions\r\n\r\n## Features\r\n\r\n- Multi-dimensional royalty analytics\r\n- CWR (Collective Works Registration) support\r\n- DDEX integration for music metadata\r\n- Advanced file processing with pattern recognition\r\n- Real-time data processing with queue system"
  version: 2.6.0
  contact:
    name: Royalti.io Support
    email: support@royalti.io
    url: https://royalti.io
  license:
    name: Proprietary
    url: https://royalti.io/terms
servers:
  - url: https://api.royalti.io
    description: Production server
  - url: https://api-dev.royalti.io
    description: Development server
  - url: http://localhost:8084
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: Accounting
    description: Accounting and financial transaction operations
  - name: DDEX
    description: DDEX operations (ERN/MEAD, messages, delivery, providers)
  - name: Label
    description: Label management operations
  - name: Internal Webhooks
    description: Internal system webhooks for royalty processing and downloads
  - name: Payment Webhooks
    description: Payment processor webhook endpoints
  - name: Billing Webhooks
    description: Stripe billing and subscription webhooks
  - name: Infrastructure Webhooks
    description: Cloudflare domain and SSL webhooks
  - name: Distribution Webhooks
    description: Digital distribution platform webhooks (FUGA)
paths:
  /user/bulk:
    post:
      tags:
        - User
      summary: Create Bulk User
      description: >-
        **/user/bulk**


        **Description:**

        The `/user/bulk` endpoint allows the creation of multiple users
        simultaneously by providing an array of user objects, each containing
        user details.


        **Method:**

        `POST`


        **Request Payload:**


        | Parameter | Type | Description |

        | --- | --- | --- |

        | users | array | An array of user objects with their details. |

        | sendEmail _(Optional)_ | boolean | This sends an invite email to the
        users, by default it is true. |

        | redirect_url _(Optional)_ | string | The URL to redirect after
        creation. |

        | message _(Optional)_ | string | For passing the invite email custom
        message. |


        > See sample response for request payload in the `body` below
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                users:
                  type: array
                  items:
                    type: object
                    properties:
                      firstName:
                        type: string
                      lastName:
                        type: string
                      nickName:
                        type: string
                      userType:
                        type: string
                      email:
                        type: string
                        format: email
                      ipi:
                        type: string
                      role:
                        type: string
                      phone:
                        type: string
                      country:
                        type: string
                sendEmail:
                  type: boolean
                  default: true
                redirect_url:
                  type: string
                message:
                  type: string
              required:
                - users
      responses:
        '201':
          description: Created with Errors
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  createdUsers:
                    type: array
                    items:
                      type: string
                  processedCount:
                    type: integer
                  errors:
                    type: array
                    items:
                      type: string
              example:
                message: Done.
                createdUsers:
                  - John Doe
                  - Jericho Doe
                processedCount: 3
                errors:
                  - User Jane Doe already associated with workspace!
                  - Invalid email format for Jacob Doe
                  - Invalid email format for Jake Doe
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: array
              items:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Format: "Bearer
        {token}"

````