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

# Create user

> This endpoint lets you create a user. If no password given, a password will automatically be generated.

The password will be ignored if `send_invitation` is set to `True`.

You need to have `WRITE` access on the organization of the user you want to create.

If you want to have an `invited` user but send the invitation email later, you have to send the `send_invitation` parameter as `False` and a `status` parameter to `invited`.       
You will then have to call the [invitation endpoint](/api-reference/users/invite-user) to send the invitation email to the user.




## OpenAPI

````yaml /assets/openapi/openapi-bundled.yaml post /user
openapi: 3.1.0
info:
  title: Partoo Rest API
  version: v2
  license:
    name: © Copyright Partoo
    url: https://www.partoo.co/en/gtu-api/
  x-logo:
    url: >-
      https://partoo-client-images.s3.amazonaws.com/logo-partoo-restapi-white.png
  description: >
    ## Introduction

    The Partoo Rest API allows you to automate all the actions that are possible
    to do in the Partoo Web Application.


    The Partoo Rest API can be used for many different purposes:
      - Create/update/delete your businesses & users if you are a client.
      - Create/subscribe/manage organizations, businesses & users if you are a reseller.
      - Retrieve data on businesses you have access to if you are a publisher.
      - ...
servers:
  - url: https://api.partoo.co/v2
    description: Production server
  - url: https://api.sandbox.partoo.co/v2
    description: Sandbox server (dev environment for clients & partners)
security:
  - ApiKeyAuth: []
paths:
  /user:
    post:
      tags:
        - Users
      summary: Create user
      description: >
        This endpoint lets you create a user. If no password given, a password
        will automatically be generated.


        The password will be ignored if `send_invitation` is set to `True`.


        You need to have `WRITE` access on the organization of the user you want
        to create.


        If you want to have an `invited` user but send the invitation email
        later, you have to send the `send_invitation` parameter as `False` and a
        `status` parameter to `invited`.       

        You will then have to call the [invitation
        endpoint](/api-reference/users/invite-user) to send the invitation email
        to the user.
      operationId: createUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              description: Request body to create a user
              type: object
              required:
                - email
                - first_name
                - last_name
              properties:
                email:
                  description: User email (must be unique will return otherwise)
                  type: string
                  format: email
                first_name:
                  $ref: '#/components/schemas/UserFirstName'
                last_name:
                  $ref: '#/components/schemas/UserLastName'
                org_id:
                  $ref: '#/components/schemas/UserCreateUpdateOrgId'
                accesses:
                  $ref: '#/components/schemas/accesses'
                business_ids:
                  description: >
                    The list of business to which the user has access to. Will
                    be taken into account only if user has `BUSINESS_MANAGER`
                    role.
                  type: array
                  items:
                    type: string
                role:
                  $ref: '#/components/schemas/RoleWithoutProvider'
                custom_role:
                  $ref: '#/components/schemas/CustomRoleApiId'
                sidebar_pages:
                  deprecated: true
                  allOf:
                    - $ref: '#/components/schemas/SidebarPages'
                  description: >
                    **DEPRECATED**: This parameter is deprecated in favor of the
                    new Custom Roles system. See the [Custom Roles & Permissions
                    guide](/guides/api/guides/custom-roles-and-permissions) for
                    migration information.


                    List of features the user can access from the sidebar.

                    If not provided in the payload or set to `null`, then the
                    user will be given all the available features of their
                    organization.
                send_invitation:
                  description: >
                    Send an invitation email to the User.

                    If you want to have an `invited` user but send the
                    invitation email later, you have to send the
                    `send_invitation` parameter as `False` and a `status`
                    parameter to `invited`.     

                    You will then have to call the [invitation
                    endpoint](/api-reference/users/invite-user) to send the
                    invitation email to the user.
                  type: boolean
                  default: false
                status:
                  $ref: '#/components/schemas/UserStatus'
                password:
                  $ref: '#/components/schemas/Password'
                lang:
                  $ref: '#/components/schemas/Lang'
                sso_only:
                  $ref: '#/components/schemas/SsoOnly'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    $ref: '#/components/schemas/UserId'
                  status:
                    $ref: '#/components/schemas/RequestStatus'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
components:
  schemas:
    UserFirstName:
      description: User first name
      type: string
      example: Perceval
    UserLastName:
      description: User last name
      type: string
      example: de Galles
    UserCreateUpdateOrgId:
      description: >
        Unique identifier of the organization to which the user should belong.
        Only `PROVIDER` users can set this field. If no `org_id` is given, or if
        you are not a `PROVIDER`, the user will have the same organization as
        you.
      type: integer
      example: 42
    accesses:
      description: >
        List of (list of Group ID).


        Accesses of the users for the new groups system, only for
        `GROUP_MANAGER` users.


        See [the Groups and Sections
        description](/guides/api/resources/organizations/groups)
      type: array
      items:
        type: array
        items:
          type: integer
      example:
        - - 1
          - 2
        - - 1
          - 3
    RoleWithoutProvider:
      description: User role in the application
      type: string
      enum:
        - ORG_ADMIN
        - ORG_MANAGER
        - GROUP_MANAGER
        - BUSINESS_MANAGER
        - PUBLISHER
      example: BUSINESS_MANAGER
    CustomRoleApiId:
      description: >
        Optional API identifier of a custom role to assign to the user. The
        value must match the `api_id` of one of the custom roles available to
        your organization.


        If no custom role is given, users with the role `GROUP_MANAGER` or
        `BUSINESS_MANAGER` will automatically be assigned to the default
        built-in custom role associated with their role.


        For more information about custom roles, see [Managing User Permissions
        with Custom Roles](/guides/api/guides/custom-roles-and-permissions)
      type: string
      example: my_custom_role
    SidebarPages:
      type: array
      description: |
        List of features the user can access from the sidebar.
      items:
        allOf:
          - $ref: '#/components/schemas/SidebarPagesFeatureEnum'
        type: string
        description: Sidebar page feature name
    UserStatus:
      description: User status in the application
      type: string
      enum:
        - active
        - invited
      example: active
    Password:
      description: |
        The User password. It should comply with the following rules:
        - should be at least 8 characters long
        - should have one upper case letter and one lower case letter
        - should have one special character
      type: string
      format: password
      minLength: 8
    Lang:
      description: Available language in the application
      type: string
      enum:
        - fr
        - en
        - es
        - it
        - pt-br
        - de
        - ar
        - nl
        - pl
        - cs
        - ca
        - sk
        - pt
        - lv
        - ro
        - bg
        - hu
      example: fr
    SsoOnly:
      description: >
        Prevent the user from connecting directly from the Partoo connection
        page.


        This field is available for users whose organization has defined an SSO
        configuration.


        This field can be edited by a user with the role `ORG_ADMIN` or
        `PROVIDER`.
      type: boolean
      default: false
    UserId:
      description: User id
      type: string
      example: 5309c3a237bbc544d8e26737
    RequestStatus:
      description: Request status
      type: string
      enum:
        - success
    SidebarPagesFeatureEnum:
      enum:
        - bulk_modification
        - diffusion
        - feedback_management
        - messages
        - posts
        - presence_analytics
        - review_analytics
        - review_invite
        - review_management
  responses:
    '400':
      description: Your request is incorrect
      content:
        application/json:
          schema:
            description: |
              Error that occcurs when your request is incorrect
            properties:
              errors:
                type: object
                description: The detail of the error encountered
                properties:
                  json:
                    type: object
    '401':
      description: You are not authenticated
      content:
        application/json:
          schema:
            description: Error that occurs when you are not authenticated
            type: object
            properties:
              errors:
                type: object
                description: The detail of the error encountered
                properties:
                  authentication:
                    type: string
                    default: User not authenticated
    '403':
      description: |
        You are not allowed to perform this action
      content:
        application/json:
          schema:
            description: >
              Error that occurs when you are authenticated but you are trying to
              perform an action you are not allowed to perform
            type: object
            properties:
              errors:
                type: object
                description: The detail of the error encountered
                properties:
                  authorization:
                    type: string
                    default: Operation not allowed
  securitySchemes:
    ApiKeyAuth:
      description: >
        The authentication system on Partoo API is using API Key that should be
        put in the header of the request (the name of the header is `x-APIKey`).
        An api_key is linked to a user. This user's role will give you different
        access level to the API features.
      type: apiKey
      in: header
      name: x-APIKey

````