# Atrelar motorista

Com esse endpoint podemos atrelar um motorista ou um veículo à uma entrega.

## Atribuir um motorista a uma entrega ou rota.

> Atribuir um motorista a uma entrega ou rota.

```json
{"openapi":"3.0.0","info":{"title":"API Shippify","version":"1.0.0"},"servers":[{"url":"https://api.shippify.co","description":"Servidor de desenvolvimento"}],"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":["Entregas","Routes"],"summary":"Atribuir um motorista a uma entrega ou rota.","description":"Atribuir um motorista a uma entrega ou rota.","responses":{"200":{"description":"Operação bem-sucedida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/assignDriver/successfulResponse"}}}},"401":{"description":"Não autorizado","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>Atrelar um motorista à um ID de entrega</summary>

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

</details>

<details>

<summary>Atrelar um motorista à um referenceID de entrega</summary>

Utilize o referenceid da entrega na url da petição para atrelar um motorista.

</details>

<details>

<summary>Atrelar motorista por id do veículo</summary>

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

</details>

<details>

<summary>Atrelar motorista por id de referência do veículo</summary>

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

</details>

<details>

<summary>Criar e atrelar veículo e motorista à uma tarefa</summary>

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

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shippify.co/developers/pt/shippify-api/entregas/atrelar-motorista.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
