---
title: "Assign Driver"
url: "https://stage-api-docs.centraldispatch.com/apis/stage-fulfillment-api-1-0-0/versions/8637c155-7ff6-49fa-ac0a-3b4df78c9665/operations/patchDrivers"
---

> Full API specification: https://stage-api-docs.centraldispatch.com/apis/stage-fulfillment-api-1-0-0/versions/8637c155-7ff6-49fa-ac0a-3b4df78c9665.md

# Assign Driver

`PATCH` `/api/fulfillments/id/{dispatchId}/drivers`

Operation ID: `patchDrivers`

Assign a driver to a load or unassign a driver from the load. #### 👥 Customer Type - Carrier #### 📝 Important Notes - May only be used by the assigned carrier or a broker with the carrier profile that is assigned to.

## Path parameters

- `dispatchId` (string, uuid, required) - The ID of the dispatch.

## Header parameters

- `If-Match` (integer, required) - This is a required field to ensure the update is being completed on an item that has not changed since it was last read. The value of this field will be the value of the `ETag` header that was received on the preceding get call.
- `Content-Type` (string, required) - The major version of the API to make a request against. This is a custom MIME type that contains `vnd.coxauto.v[#]+`. For example, to request a resource from version 1.x.x of an API, the Content-Type header should be set to `application/vnd.coxauto.v1+json`.

## Request body

Content types: `application/json`

## Responses

- `204` - No Content. Successful request.
- `400` - Bad Request. Check the request payload. **Scenarios:** - Missing `If-Match` header
- `401` - Unauthorized. Authentication failed or missing.
- `403` - Forbidden **Scenarios:** - Tier group not supported.
- `404` - Not Found.
- `409` - Conflict. Update not allowed based on the current resource state. **Scenarios:** - Dispatch has already been CANCELED/DELIVERED.
- `412` - Precondition Failed **Scenarios:** - RecordVersion (`If-Match` header) does not match.
- `422` - Unprocessable Entity. Errors found in the request. **Scenarios:** - The operation is duplicated in request body. - The driverId is not a uuid. - The same driverId is present in both remove and add operations. - The driverId value is empty or the driverId list is empty.
- `429` - Too Many Requests. Rate limit exceeded.
- `500` - Error.
- `503` - Service Unavailable. Temporary service interruption.

## OpenAPI definition

```yaml
openapi: 3.0.1
info:
  title: Fulfillment API
  version: 1.0.0
servers:
  - url: https://fulfillment-api.centraldispatch.com
    description: Production server
paths:
  /api/fulfillments/id/{dispatchId}/drivers:
    patch:
      tags:
        - Dispatch
      summary: Assign Driver
      description: >
        
        Assign a driver to a load or unassign a driver from the load.


        #### 👥 Customer Type

        - Carrier


        #### 📝 Important Notes

        - May only be used by the assigned carrier or a broker with the carrier
        profile that is assigned to.
      operationId: patchDrivers
      parameters:
        - name: dispatchId
          in: path
          description: The ID of the dispatch.
          required: true
          schema:
            type: string
            format: uuid
          example: d159acc0-e89b-12d3-a456-426614174000
        - name: If-Match
          in: header
          description: This is a required field to ensure the update is being completed on
            an item that has not changed since it was last read. The value of
            this field will be the value of the `ETag` header that was received
            on the preceding get call.
          required: true
          schema:
            type: integer
          example: 8675309
        - name: Content-Type
          in: header
          description: The major version of the API to make a request against. This is a
            custom MIME type that contains `vnd.coxauto.v[#]+`. For example, to
            request a resource from version 1.x.x of an API, the Content-Type
            header should be set to `application/vnd.coxauto.v1+json`.
          required: true
          schema:
            type: string
          example: application/vnd.coxauto.v1+json
      requestBody:
        description: "`AssignDriverRequest` collection"
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: "#/components/schemas/AssignDriverRequest"
              nullable: true
            examples:
              ex.:
                value:
                  - op: ADD
                    path: /drivers/drivers/-
                    values:
                      - driverId: 3ca6e1c2-98fb-4b4e-bfd8-ffaec58fb347
      responses:
        "204":
          description: No Content. Successful request.
        "400":
          description: |-
            Bad Request. Check the request payload.

            **Scenarios:**

             - Missing `If-Match` header
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorsAlt"
        "401":
          description: Unauthorized. Authentication failed or missing.
        "403":
          description: |-
            Forbidden

            **Scenarios:**

             - Tier group not supported.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorsAlt"
        "404":
          description: Not Found.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorsAlt"
        "409":
          description: |-
            Conflict. Update not allowed based on the current resource state.

            **Scenarios:**

             - Dispatch has already been CANCELED/DELIVERED.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorsAlt"
        "412":
          description: |-
            Precondition Failed

            **Scenarios:**

             - RecordVersion (`If-Match` header) does not match.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorsAlt"
        "422":
          description: |-
            Unprocessable Entity. Errors found in the request.

            **Scenarios:**

             - The operation is duplicated in request body.
             - The driverId is not a uuid.
             - The same driverId is present in both remove and add operations.
             - The driverId value is empty or the driverId list is empty.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorsAlt"
        "429":
          description: Too Many Requests. Rate limit exceeded.
        "500":
          description: Error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorsAlt"
        "503":
          description: Service Unavailable. Temporary service interruption.
      security:
        - Bearer: []
security:
  - Bearer: []
components:
  schemas:
    AssignDriverRequest:
      type: object
      properties:
        op:
          type: string
          description: "The operation to be performed. Values: `ADD`, `REMOVE`."
          example: ADD
        path:
          type: string
          description: The path to the property to be modified.
          example: /drivers/drivers/-
        values:
          type: array
          items:
            $ref: "#/components/schemas/DriverPatchRequest"
          description: The driver ID values to be applied in the patch operation.
      description: Details of driver patch operation.
    ErrorsAlt:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: "#/components/schemas/ErrorAlt"
          description: A collection of errors.
          nullable: true
      description: An error occurred, and the request could not be completed.
    DriverPatchRequest:
      type: object
      properties:
        driverId:
          type: string
          description: The Central Dispatch user ID of the driver.
          format: uuid
          example: d71b5750-e89b-12d3-a456-426614174000
      description: Details of driver patch operation.
    ErrorAlt:
      type: object
      properties:
        errorID:
          type: string
          description: The ID of the error.
          nullable: true
          example: 157a16f0-503d-4256-ba60-a4876e8eb9bb
        code:
          type: string
          description: The code used for the issue.
          nullable: true
          example: resource.issue_type
        description:
          type: string
          description: A detailed message.
          nullable: true
          example: The issue happened because something is wrong.
        properties:
          type: array
          items:
            $ref: "#/components/schemas/ErrorAltProperty"
          description: Properties related to the issue.
          nullable: true
      description: Details of an error or issue.
    ErrorAltProperty:
      type: object
      properties:
        property:
          type: string
          description: The name of the property.
          nullable: true
          example: person
        value:
          type: string
          description: The value of the property.
          nullable: true
          example: J0hn D03
      description: Details of an error's property.
  securitySchemes:
    Bearer:
      type: http
      scheme: Bearer
```
