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

# Create Driver

> Create a driver profile. If a user with the email exists in your company or a company you manage, the profile is linked to that account; otherwise a new account is created. The account gets the scopes `cargo-vehicles:read`, `depots:read`, `stations:read` and `drivers:read`, which you must hold yourself. Use the driver's `user_id` to assign them to routes.

**Failure Modes:**
- **400**: The user already has an active driver profile
- **401**: Token is missing or invalid
- **403**: Insufficient permissions, `company_slug` is a company you cannot manage, or you lack one of the scopes above
- **409**: The email belongs to a user of a company outside yours
- **422**: Invalid request body

**Required Auth Scopes:**
- `drivers:manage`



## OpenAPI

````yaml /api-reference/openapi.json post /operations/drivers
openapi: 3.1.0
info:
  title: SWITCH API
  version: '1.0'
  description: >-
    The SWITCH API gives mobility and logistics teams programmatic access to
    SWITCH forecasts, fleet operations, routing and analytics. Every request is
    authenticated with an API key sent as a bearer token.
servers:
  - url: https://api.getswitch.io
    description: Production
security: []
tags:
  - name: Forecast
    description: Demand forecasts per zone and time window.
  - name: Operations
    description: Fleet imbalance, rebalancing suggestions and generated tasks.
  - name: Routing
    description: Route optimisation for single and multiple fleets.
  - name: Routing Sessions
    description: Saved routing sessions, their routes and drivers.
  - name: Routing Operations
    description: Complete, undo and re-route the stops of a route.
  - name: Fleet Management
    description: Your depots, stations, drivers and cargo vehicles.
  - name: Integrations
    description: Vehicles, statuses and commands on your fleet platform.
  - name: Station Based Analytics
    description: Analytics for station-based (docked) services.
  - name: Zone Based Analytics
    description: Analytics for free-floating services, by zone.
  - name: Free Float Analytics
    description: Trip history for free-floating services.
  - name: Transit Analytics
    description: Punctuality and service delivery for public transit.
  - name: Live
    description: Real-time fleet, delivery and transit status.
  - name: Grids
    description: Spatial grids used by forecasts and analytics.
  - name: API Keys
    description: Create and manage the API keys you call this API with.
paths:
  /operations/drivers:
    post:
      tags:
        - Fleet Management
      summary: Create Driver
      description: >-
        Create a driver profile. If a user with the email exists in your company
        or a company you manage, the profile is linked to that account;
        otherwise a new account is created. The account gets the scopes
        `cargo-vehicles:read`, `depots:read`, `stations:read` and
        `drivers:read`, which you must hold yourself. Use the driver's `user_id`
        to assign them to routes.


        **Failure Modes:**

        - **400**: The user already has an active driver profile

        - **401**: Token is missing or invalid

        - **403**: Insufficient permissions, `company_slug` is a company you
        cannot manage, or you lack one of the scopes above

        - **409**: The email belongs to a user of a company outside yours

        - **422**: Invalid request body


        **Required Auth Scopes:**

        - `drivers:manage`
      operationId: create_driver
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DriverCreate'
      responses:
        '201':
          description: >-
            Driver created successfully. Returns the complete driver profile
            including user details, availability, license info, and active
            status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DriverPublic'
        '400':
          description: >-
            Bad Request. The specified user already has an active driver
            profile.
        '401':
          description: >-
            Unauthorized. Token is missing, invalid, malformed, expired, or
            revoked.
        '403':
          description: >-
            Forbidden. The authenticated user does not have sufficient
            permissions to create drivers, or does not hold every scope the
            driver would be auto-granted.
        '409':
          description: >-
            Conflict. The email matches a user of a company outside your company
            tree.
        '422':
          description: >-
            Unprocessable Entity. Request validation failed due to malformed
            data, missing required fields, or invalid field types.
        '500':
          description: Internal Server Error.
      security:
        - HTTPBearer: []
        - HTTPBearer: []
components:
  schemas:
    DriverCreate:
      properties:
        email:
          type: string
          title: Email
          description: >-
            Driver's email (case-insensitive). If a user with this email exists,
            the driver is linked to that account; otherwise a new account is
            created with it.
          examples:
            - marco.bianchi@acme-mobility.com
        full_name:
          type: string
          title: Full Name
          description: Full name, used only when a new account is created.
          examples:
            - Marco Bianchi
        phone:
          type:
            - string
            - 'null'
          title: Phone
          description: Phone number.
          examples:
            - +39 02 1234 5678
        license_number:
          type:
            - string
            - 'null'
          title: License Number
          description: License number.
          examples:
            - MI1234567X
        availability:
          additionalProperties: true
          type: object
          title: Availability
          description: >-
            Working hours per weekday: keys `monday` to `sunday`, each
            `{"start": "HH:MM", "end": "HH:MM"}`; a missing day means not
            available.
          examples:
            - friday:
                end: '17:00'
                start: '08:00'
              monday:
                end: '17:00'
                start: '08:00'
              thursday:
                end: '17:00'
                start: '08:00'
              tuesday:
                end: '17:00'
                start: '08:00'
              wednesday:
                end: '17:00'
                start: '08:00'
        password:
          type:
            - string
            - 'null'
          title: Password
          description: >-
            Password of the new account (10-72 bytes, UTF-8); a random one is
            set if omitted. Ignored when the email matches an existing user.
        company_slug:
          type:
            - string
            - 'null'
          title: Company Slug
          description: Company of a new account; defaults to yours.
          examples:
            - acme-mobility
      type: object
      required:
        - email
        - full_name
      title: DriverCreate
      description: |-
        Create a driver.

        If email matches existing user, links to them;
        otherwise creates user too.
      examples:
        - availability:
            friday:
              end: '17:00'
              start: '08:00'
            monday:
              end: '17:00'
              start: '08:00'
            thursday:
              end: '17:00'
              start: '08:00'
            tuesday:
              end: '17:00'
              start: '08:00'
            wednesday:
              end: '17:00'
              start: '08:00'
          company_slug: acme-mobility
          email: marco.bianchi@acme-mobility.com
          full_name: Marco Bianchi
          license_number: MI1234567X
          phone: +39 02 1234 5678
    DriverPublic:
      properties:
        id:
          type: integer
          title: Id
          description: Driver ID.
          examples:
            - 1
        user_id:
          type: integer
          title: User Id
          description: >-
            ID of the driver's user account; use it to assign the driver to
            routes.
          examples:
            - 10
        phone:
          type:
            - string
            - 'null'
          title: Phone
          description: Phone number.
          examples:
            - +39 02 1234 5678
        license_number:
          type:
            - string
            - 'null'
          title: License Number
          description: License number.
          examples:
            - MI1234567X
        availability:
          additionalProperties: true
          type: object
          title: Availability
          description: >-
            Working hours per weekday: keys `monday` to `sunday`, each
            `{"start": "HH:MM", "end": "HH:MM"}`; a missing day means not
            available.
          examples:
            - friday:
                end: '17:00'
                start: '08:00'
              monday:
                end: '17:00'
                start: '08:00'
              thursday:
                end: '17:00'
                start: '08:00'
              tuesday:
                end: '17:00'
                start: '08:00'
              wednesday:
                end: '17:00'
                start: '08:00'
        is_active:
          type: boolean
          title: Is Active
          description: Whether the driver is active.
          examples:
            - true
        full_name:
          type: string
          title: Full Name
          description: Driver's full name, from their user account.
          examples:
            - Marco Bianchi
        email:
          type: string
          title: Email
          description: Driver's email, from their user account.
          examples:
            - marco.bianchi@acme-mobility.com
        company_slug:
          type: string
          title: Company Slug
          description: Company of the driver's user account.
          examples:
            - acme-mobility
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Datetime when the record was created.
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
          title: Updated At
          description: Datetime when the record was last updated, if ever.
      type: object
      required:
        - id
        - user_id
        - is_active
        - full_name
        - email
        - company_slug
        - created_at
      title: DriverPublic
      description: |-
        Public schema for a driver resource.

        Exposes driver details to API consumers, including user details,
        availability, license info, and active status.
      examples:
        - availability:
            friday:
              end: '17:00'
              start: '08:00'
            monday:
              end: '17:00'
              start: '08:00'
            thursday:
              end: '17:00'
              start: '08:00'
            tuesday:
              end: '17:00'
              start: '08:00'
            wednesday:
              end: '17:00'
              start: '08:00'
          company_slug: acme-mobility
          created_at: '2026-10-01T07:45:00Z'
          email: marco.bianchi@acme-mobility.com
          full_name: Marco Bianchi
          id: 12
          is_active: true
          license_number: MI1234567X
          phone: +39 02 1234 5678
          updated_at: '2026-11-20T12:10:00Z'
          user_id: 57
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      description: >-
        An API key, sent as `Authorization: Bearer <key>`. Create one in the
        SWITCH Copilot under **Settings → API keys** (needs the API keys
        permission in your company), or with `POST /auth/api-keys`. The key is
        shown once, at creation.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.