---
title: Import multiple members
description: Import multiple members at once.
url: /api/members/importMembers
---

# Import multiple members

`POST /members:import`

````yaml
openapi: 3.1.0
info:
  title: Spoke API
  version: v1
servers:
  - url: https://api.spoke.com/public/v1
security:
  - BasicAuth: []
paths:
  /members:import:
    post:
      operationId: importMembers
      summary: Import multiple members
      tags:
        - Members
      description: Import multiple members at once.
      requestBody:
        content:
          application/json:
            schema:
              minItems: 1
              maxItems: 50
              type: array
              items:
                type: object
                properties:
                  name:
                    description: The member's full name
                    anyOf:
                      - type: string
                        minLength: 1
                        maxLength: 255
                      - type: "null"
                  displayName:
                    description: The name displayed for the member in the UI
                    anyOf:
                      - type: string
                        minLength: 1
                        maxLength: 255
                      - type: "null"
                  email:
                    description: Member's email
                    anyOf:
                      - type: string
                        minLength: 1
                        maxLength: 255
                        format: email
                        pattern: ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                      - type: "null"
                  linkedDriverId:
                    description: The existing driver to link the member to
                    anyOf:
                      - type: string
                        pattern: ^drivers\/[a-zA-Z0-9---_]{1,50}$
                      - type: "null"
                  role:
                    type: string
                    enum:
                      - admin
                      - depot-manager
                      - dispatcher
                      - read-only
                    description: The operational role given to the member.
                  depots:
                    description: The depot IDs associated with the member in the format `depots/<id>`, duplicates will be ignored. If set to null or not provided, the team's Main depot will be set as member depot.
                    anyOf:
                      - minItems: 1
                        maxItems: 50
                        type: array
                        items:
                          type: string
                          pattern: ^depots\/[a-zA-Z0-9---_]{1,50}$
                          description: The depot ID, in the format `depots/<id>`
                      - type: "null"
                required:
                  - role
                additionalProperties: false
                description: The request body for creating a member.
              description: An array of member descriptions to be created in batch.
        description: An array of member descriptions to be created in batch.
      responses:
        "200":
          description: The imported members
          content:
            application/json:
              schema:
                description: The imported members
                type: object
                properties:
                  success:
                    type: array
                    items:
                      type: string
                      pattern: ^members\/[a-zA-Z0-9---_]{1,50}$
                      description: The id of the member, in the format `members/<id>`.
                    description: The ids of the successfully imported members
                  failed:
                    type: array
                    items:
                      type: object
                      properties:
                        error:
                          type: object
                          properties:
                            message:
                              type: string
                              description: The error that occurred during import
                          required:
                            - message
                        member:
                          type: object
                          properties:
                            name:
                              anyOf:
                                - type: string
                                  minLength: 1
                                  maxLength: 255
                                - type: "null"
                              description: The member's full name
                            displayName:
                              anyOf:
                                - type: string
                                  minLength: 1
                                  maxLength: 255
                                - type: "null"
                              description: The name displayed for the member in the UI
                            email:
                              anyOf:
                                - type: string
                                  minLength: 1
                                  maxLength: 255
                                  format: email
                                  pattern: ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                                - type: "null"
                              description: Member's email
                            linkedDriverId:
                              anyOf:
                                - type: string
                                  pattern: ^drivers\/[a-zA-Z0-9---_]{1,50}$
                                - type: "null"
                              description: The existing driver to link the member to
                            role:
                              type: string
                              enum:
                                - admin
                                - depot-manager
                                - dispatcher
                                - read-only
                              description: The operational role given to the member.
                            depots:
                              anyOf:
                                - minItems: 1
                                  maxItems: 50
                                  type: array
                                  items:
                                    type: string
                                    pattern: ^depots\/[a-zA-Z0-9---_]{1,50}$
                                    description: The depot ID, in the format `depots/<id>`
                                - type: "null"
                              description: The depot IDs associated with the member in the format `depots/<id>`, duplicates will be ignored. If set to null or not provided, the team's Main depot will be set as member depot.
                          required:
                            - role
                          description: The request body for creating a member.
                      required:
                        - error
                        - member
                    description: The failed members
                required:
                  - success
                  - failed
        "400":
          description: Failed to validate the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: Failed to validate the request
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: Unauthorized
        "409":
          description: Conflict when creating member.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    anyOf:
                      - type: string
                        enum:
                          - The member could not be created because of a conflict, such as a member already existing with the same email.
                      - type: string
                required:
                  - message
                description: Conflict when creating member.
        "422":
          description: Failed to import members.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    anyOf:
                      - type: string
                        enum:
                          - An error occured when importing members, but the error is not due to a validation error, instead it is another conflict, check if the provided data is semantically valid.
                      - type: string
                required:
                  - message
                description: Failed to import members.
        "500":
          description: An internal server error occurred
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: An internal server error occurred
        default:
          description: The default error model
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: The default error model
components:
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: Use the API key as the username and leave the password empty.
````