---
title: Create a new member
description: Create a member with the given data in your team. Prefer using the
  [batch import endpoint](/api/members/importMembers) for creating multiple
  members at once as it is more efficient.
url: /api/members/createMember
---

# Create a new member

`POST /members`

````yaml
openapi: 3.1.0
info:
  title: Spoke API
  version: v1
servers:
  - url: https://api.spoke.com/public/v1
security:
  - BasicAuth: []
paths:
  /members:
    post:
      operationId: createMember
      summary: Create a new member
      tags:
        - Members
      description: Create a member with the given data in your team. Prefer using the [batch import endpoint](/api/members/importMembers) for creating multiple members at once as it is more efficient.
      requestBody:
        content:
          application/json:
            schema:
              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.
        required: true
        description: The request body for creating a member.
      responses:
        "200":
          description: The created member
          content:
            application/json:
              schema:
                description: The created member
                $ref: "#/components/schemas/memberSchema"
        "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
        "404":
          description: The linked driver could not be found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    anyOf:
                      - type: string
                        enum:
                          - Driver not found
                      - type: string
                required:
                  - message
                description: The linked driver could not be found.
                title: Driver not found
        "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 create member.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    anyOf:
                      - type: string
                        enum:
                          - An error occured when creating the member, 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 create member.
        "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:
  schemas:
    driverIdSchema:
      type: string
      pattern: ^drivers\/[a-zA-Z0-9---_]{1,50}$
    memberIdSchema:
      type: string
      pattern: ^members\/[a-zA-Z0-9---_]{1,50}$
    memberSchema:
      type: object
      properties:
        id:
          allOf:
            - $ref: "#/components/schemas/memberIdSchema"
          description: The member id, in the format `members/<id>`
        name:
          description: The name of the member.
          type:
            - "null"
            - string
        email:
          description: The email of the member.
          type:
            - "null"
            - string
        phone:
          description: The phone number of the member.
          type:
            - "null"
            - string
        linkedDriverId:
          anyOf:
            - $ref: "#/components/schemas/driverIdSchema"
            - type: "null"
          description: The driver linked to the member (where applicable).
        displayName:
          description: The display name of the member.
          type:
            - "null"
            - string
        active:
          type: boolean
          description: Whether the member membership is active or paused.
        depots:
          type: array
          items:
            type: string
            pattern: ^depots\/[a-zA-Z0-9---_]{1,50}$
          description: Depots associated with the member.
        roles:
          $ref: "#/components/schemas/roleSchema"
      required:
        - id
        - name
        - email
        - phone
        - linkedDriverId
        - displayName
        - active
        - depots
        - roles
      additionalProperties: false
      description: A dashboard member.
    roleSchema:
      type: array
      items:
        type: string
        enum:
          - owner
          - admin
          - depot-manager
          - dispatcher
          - read-only
          - driver
      description: The role(s) given to the member.
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: Use the API key as the username and leave the password empty.
````