Users

Create users in batch


This method allows creating multiple users in a single request.

Method

POST /api.hesh.app/api/v1/public/users/batch

Method Returns

The method returns a list of created user objects with their details, including IDs, status, and other metadata

Permissions required

Requires x-tenant-id (UUID v4) in the request header to identify the tenant.

Request

  • Headers:

    • x-tenant-id (string, UUID v4) - Tenant ID Example: 40dd0c53-2fa7-4193-82ae-14d4e62c20fb

  • Body (application/json):

{
  "users": [
    {
      "external_user_id": "[email protected]",
      "email": "[email protected]",
      "first_name": "Vova",
      "last_name": "Smith",
      "phone": "38000"
    }
  ]
}
  • Field users: An array containing user objects with the following fields:

    • external_user_id (string): External identifier for the user (e.g., email).

    • email (string): The user's email address.

    • first_name (string): The user's first name.

    • last_name (string): The user's last name.

    • phone (string): The user's phone number.

Path parameters

This method does not require any additional path parameters.

Response

  • 200 OK: Successfully created clients. A list of client objects is returned.

Response body (application/json):

[
  {
    "id": "b86fa12a-76fc-46f5-8a3e-bf39e7be4c4e",
    "email": "[email protected]",
    "avatar_image_url": "https://storage.googleapis.com/hesh-company-user-image/d81b1b14-c9c5-4d6e-bbb7-802956834bd0-thumb-1920-238870.jpg",
    "first_name": "Vova",
    "last_name": "Smith",
    "external_user_id": "b86fa12a-76fc-46f5-8a3e-bf39e7be4c4e",
    "full_name": "Luke Smith",
    "phone": "38000",
    "status": "Active",
    "created_at": "2023-08-25T09:07:21.759Z",
    "userVacations": [
      {
        "start_at": "2024-09-02T21:00:00.000Z",
        "end_at": "2024-09-15T21:00:00.000Z"
      }
    ]
  }
]

Response fields:

  • id (string, UUID): The unique identifier of the created user

  • email (string): The user's email address

  • avatar_image_url (string): URL to the user's avatar image

  • first_name (string): The user's first name

  • last_name (string): The user's last name

  • external_user_id (string): The external identifier for the user

  • full_name (string): The user's full name

  • phone (string): The user's phone number

  • status (string): The user's current status (e.g., Active)

  • created_at (string, ISO 8601): The timestamp when the user was created.

  • userVacations (array of objects): List of vacation periods assigned to the user. Each object includes:

    • start_at (string, ISO 8601): The start date of the vacation

    • end_at (string, ISO 8601): The end date of the vacation

Error Codes:

  • 400 Bad Request — Invalid data in the request

  • 401 Unauthorized — Missing or incorrect x-tenant-id

  • 500 Internal Server Error — Internal server error

Last updated