Skip to main content
POST
Create Driver

Authorizations

Authorization
string
header
required

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.

Body

application/json

Create a driver.

If email matches existing user, links to them; otherwise creates user too.

email
string
required

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.

Example:

"marco.bianchi@acme-mobility.com"

full_name
string
required

Full name, used only when a new account is created.

Example:

"Marco Bianchi"

phone
string | null

Phone number.

Example:

"+39 02 1234 5678"

license_number
string | null

License number.

Example:

"MI1234567X"

availability
Availability · object

Working hours per weekday: keys monday to sunday, each {"start": "HH:MM", "end": "HH:MM"}; a missing day means not available.

Example:
password
string | null

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
string | null

Company of a new account; defaults to yours.

Example:

"acme-mobility"

Response

Driver created successfully. Returns the complete driver profile including user details, availability, license info, and active status.

Public schema for a driver resource.

Exposes driver details to API consumers, including user details, availability, license info, and active status.

id
integer
required

Driver ID.

Example:

1

user_id
integer
required

ID of the driver's user account; use it to assign the driver to routes.

Example:

10

is_active
boolean
required

Whether the driver is active.

Example:

true

full_name
string
required

Driver's full name, from their user account.

Example:

"Marco Bianchi"

email
string
required

Driver's email, from their user account.

Example:

"marco.bianchi@acme-mobility.com"

company_slug
string
required

Company of the driver's user account.

Example:

"acme-mobility"

created_at
string<date-time>
required

Datetime when the record was created.

phone
string | null

Phone number.

Example:

"+39 02 1234 5678"

license_number
string | null

License number.

Example:

"MI1234567X"

availability
Availability · object

Working hours per weekday: keys monday to sunday, each {"start": "HH:MM", "end": "HH:MM"}; a missing day means not available.

Example:
updated_at
string<date-time> | null

Datetime when the record was last updated, if ever.