Driver Schedule Upsert Many Ep
POST/v1/driver_schedule/upsert_many
Upsert Many Driver Schedules
Creates or updates driver schedules in batch. Matching is done by ID or by driver+date. Only one schedule per driver per date is allowed. The driver cannot be changed on an existing schedule.
Request
id: str | None = None
The internal identifier for an existing schedule. If provided, the schedule will be updated. If not, matching falls back to driver+date.
shift_start: datetime
The start of the driver's shift.
shift_end: datetime
The end of the driver's shift. Must be after shift_start.
timezone: string = utc
The timezone of the shift_start and shift_end values.
shift: Shift
The shift designation (e.g. day, night).
driver: Driver
The driver to assign to the schedule. Cannot be changed on an existing schedule.
Show Child Attributes
Matched in the following hierarchy: (source_system and source_id), id, name.
id: str | None = None
Unique identifier for the driver.
name: str | None = None
Name of the driver.
source_system: str | None = None
The name of the external system this driver is integrated from.
source_id: str | None = None
The unique identifier for this driver in the source_system.
depot: Depot | None = None
The depot for the schedule. If not provided, the driver's default depot is used.
Show Child Attributes
Matched in the following hierarchy: (source_system and source_id), id, name.
id: str | None = None
Unique identifier for the depot.
name: str | None = None
Name of the depot.
source_system: str | None = None
The name of the external system this depot is integrated from.
source_id: str | None = None
The unique identifier for this depot in the source_system.
tractor: Tractor | None = None
The tractor to assign. If not provided, the driver's default tractor is used.
Show Child Attributes
Matched in the following hierarchy: (source_system and source_id), id, name.
id: str | None = None
Unique identifier for the tractor.
name: str | None = None
Name of the tractor.
source_system: str | None = None
The name of the external system this tractor is integrated from.
source_id: str | None = None
The unique identifier for this tractor in the source_system.
trailer: Trailer | None = None
The trailer to assign. If not provided, the driver's default trailer is used.
Show Child Attributes
Matched in the following hierarchy: (source_system and source_id), id, name.
id: str | None = None
Unique identifier for the trailer.
name: str | None = None
Name of the trailer.
source_system: str | None = None
The name of the external system this trailer is integrated from.
source_id: str | None = None
The unique identifier for this trailer in the source_system.
Response
insert_count: int
The number of schedules successfully created.
update_count: int
The number of schedules successfully updated.
errors: list[UpsertError]
A list of errors for schedules that could not be created or updated.
Each entry echoes the submitted request fields alongside the reason it failed.
Show Child Attributes
error: str
The reason this schedule could not be created or updated.
Responses
- 200
- 422
Successful Response
- application/json
- Example (from schema)
{
"insert_count": 0,
"update_count": 0,
"errors": [
{
"id": "string",
"shift_start": "2026-09-25T19:33:18.418Z",
"shift_end": "2026-09-25T19:33:18.418Z",
"timezone": "UTC",
"shift": "am",
"driver": {
"id": "string",
"name": "string",
"source_system": "string",
"source_id": "string"
},
"depot": {
"id": "string",
"name": "string",
"source_system": "string",
"source_id": "string"
},
"tractor": {
"id": "string",
"name": "string",
"source_system": "string",
"source_id": "string"
},
"trailer": {
"id": "string",
"name": "string",
"source_system": "string",
"source_id": "string"
},
"error": "string"
}
]
}
Validation Error
- application/json
- Example (from schema)
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}