> For the complete documentation index, see [llms.txt](https://docs.shippify.co/developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shippify.co/developers/en/shippify-api/deliveries/assign-driver.md).

# Assign driver

With this endpoint, you can assign a driver or vehicle to a delivery.

## Assign a driver to a delivery or route.

> Assign a driver to a delivery or route.

```json
{"openapi":"3.0.0","info":{"title":"Shippify Api","version":"1.0.0"},"servers":[{"url":"https://api.shippify.co","description":"Development server"}],"security":[{"Basic_Auth":[]}],"components":{"securitySchemes":{"Basic_Auth":{"type":"http","scheme":"basic"}},"schemas":{"assignDriver":{"successfulResponse":{"type":"object","properties":{"code":{"type":"string"}}},"request":{"type":"object","required":["courierId"],"properties":{"courierId":{"description":"Driver identifier to whom the delivery/route will be assigned. No other property is sent in the payload","type":"integer"},"vehicleId":{"type":"integer","description":"Driver's vehicle identifier to which the delivery/route will be assigned. No other property is sent in the payload"},"vehicleReferenceId":{"type":"string","description":"Driver's vehicle reference to which the delivery/route will be assigned. No other property is sent in the payload"},"driver":{"type":"object","description":"Driver's information. Only sent if it's necessary to create the driver within the system.","required":["firstName","lastName","dni","mobile"],"properties":{"firstName":{"type":"string","description":"Driver's first names"},"lastName":{"type":"string","description":"Driver's last names"},"dni":{"type":"string","description":"Driver's identification"},"mobile":{"type":"string","description":"Driver's phone number"}}},"vehicle":{"type":"object","description":"Driver's vehicle information. Only sent if it's necessary to create the driver within the system.","required":["capacity","model","brand","licensePlate","referenceId"],"properties":{"capacity":{"type":"integer","description":"Vehicle capacity, from a bicycle to a truck","minimum":1,"maximum":5},"model":{"type":"string","description":"Vehicle model"},"brand":{"type":"string","description":"Vehicle brand"},"licensePlate":{"type":"string","description":"Vehicle license plate"},"referenceId":{"type":"string","description":"Vehicle reference"}}}}}},"Unauthenticated":{"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"}}},"paths":{"/v1/routes/{id}/assign":{"post":{"tags":["Deliveries","Routes"],"summary":"Assign a driver to a delivery or route.","description":"Assign a driver to a delivery or route.","responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/assignDriver/successfulResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unauthenticated"}}}}},"parameters":[{"name":"id","in":"path","description":"Identifier or reference Id of the delivery or route to which a driver will be assigned","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/assignDriver/request"}}}}}}}}
```

## Casos de uso

<details>

<summary>Assign driver to delivery ID</summary>

```json
{
    "courierId": 396930
}
```

</details>

<details>

<summary>Assign driver to delivery reference ID</summary>

You can use the delivery reference ID in the URL of the request to assign a driver.

</details>

<details>

<summary>Assign driver by vehicle ID</summary>

```json
{
    "vehicleId": 19365
}
```

</details>

<details>

<summary>Assign driver by vehicle reference ID</summary>

```json
{
    "vehicleReferenceId": 19365
}
```

</details>

<details>

<summary>Create and assign a vehicle and driver to a task</summary>

```json
{
    "driver": {
        "firstName": "Juan",
        "lastName": "Perez",
        "dni": "0999999999",
        "mobile": "0999999999"
    },
    "vehicle": {
        "capacity": 1,
        "model": "Toyota",
        "brand": "Corolla",
        "licensePlate": "T99999999",
        "referenceId": "A99999999"
    }
}
```

</details>
