# Pedidos

## Criar pedido

Cria um novo pedido.

<mark style="color:green;">`POST`</mark> `https://api-v2.linkbolt.com.br/order`

**Autenticação**

Para acessar este endpoint, você deve primeiro obter um Bearer Token fazendo login com seu email e senha.

{% content-ref url="/pages/hgLlDhwDz9waa3f6w6To" %}
[Autenticação](/v2/reference/autenticacao.md)
{% endcontent-ref %}

| Nome          | Tipo   | Descrição                             |
| ------------- | ------ | ------------------------------------- |
| Authorization | string | Bearer Token (ex.: Bearer seu\_token) |

#### Corpo da requisição

```json
{
  "externalId": "22331",
  "deliveryAt": "2024-06-28T06:00:00",
  "address": {
    "street": "R. Guarujá",
    "number": "31",
    "neighborhood": "Saúde",
    "city": "São Paulo",
    "state": "SP",
    "postalCode": "04052-110",
    "complement": "Casa 02"
  },
  "instructions": "Não bater na porta",
  "customer": {
    "name": "Adriano",
    "phoneNumber": "11998880009"
  }
}
```

| Name                                                   | Type   | Description                                                                   |
| ------------------------------------------------------ | ------ | ----------------------------------------------------------------------------- |
| externalId<mark style="color:red;">\*</mark>           | string | Identificador externo do pedido.                                              |
| deliveryAt<mark style="color:red;">\*</mark>           | string | Data e hora da entrega no formato ISO 8601 em UTC (ex.: 2024-06-28T06:00:00). |
| instructions                                           | string | Instruções de entrega. Ex: "Não bater na porta"                               |
| address<mark style="color:red;">\*</mark>              | object | Informações do endereço de entrega.                                           |
| address.street<mark style="color:red;">\*</mark>       | string | Rua do endereço.                                                              |
| address.number                                         | string | Número do endereço.                                                           |
| address.neighborhood<mark style="color:red;">\*</mark> | string | Bairro do endereço.                                                           |
| address.city<mark style="color:red;">\*</mark>         | string | Cidade do endereço.                                                           |
| address.state<mark style="color:red;">\*</mark>        | string | Estado do endereço.                                                           |
| address.postalCode<mark style="color:red;">\*</mark>   | string | CEP do endereço.                                                              |
| address.complement                                     | string | Complemento do endereço.                                                      |
| customer<mark style="color:red;">\*</mark>             | object | Informações do cliente.                                                       |
| customer.name<mark style="color:red;">\*</mark>        | string | Nome do cliente.                                                              |
| customer.phoneNumber<mark style="color:red;">\*</mark> | string | Número de telefone do cliente.                                                |

{% tabs %}
{% tab title="201 Created" %}

```json
{
  "success": true,
  "data": {
    "id": 1234
  }
}
```

{% endtab %}

{% tab title="400 Bad Request" %}
Dados da requisição inválidos
{% endtab %}

{% tab title="401 Unauthorized" %}

```json
{
  "success": false,
  "message": "Unauthorized - No token provided"
}
```

{% endtab %}
{% endtabs %}

## Desbloquear pedidos

Desbloqueia os pedidos, para serem roteirizados.

<mark style="color:green;">`POST`</mark> `https://api-v2.linkbolt.com.br/order/unlock`

**Autenticação**

Para acessar este endpoint, você deve primeiro obter um Bearer Token fazendo login com seu email e senha.

{% content-ref url="/pages/hgLlDhwDz9waa3f6w6To" %}
[Autenticação](/v2/reference/autenticacao.md)
{% endcontent-ref %}

<table><thead><tr><th>Nome</th><th width="123">Tipo</th><th>Descrição</th></tr></thead><tbody><tr><td>Authorization</td><td>string</td><td>Bearer Token (ex.: Bearer seu_token)</td></tr></tbody></table>

#### Corpo da requisição

```json
{
 "orders": [1234, 4432, 4535]
}
```

| Nome   | Tipo  | Descrição                                    |
| ------ | ----- | -------------------------------------------- |
| orders | array | Conjunto de pedidos para serem desbloqueados |

**Resposta**

{% tabs %}
{% tab title="200 OK" %}

```json
{
    "success": true,
    "data": {
        "successOrders": [
            {
                "id": 109,
                "externalId": "22330"
            },
            {
                "id": 110,
                "externalId": "22331"
            }
        ],
        "failedOrders": [
            {
                "id": 108,
                "externalId": "22329"
            }
        ],
        "unlockedOrders": [
            {
                "id": 109,
                "externalId": "22330"
            },
            {
                "id": 110,
                "externalId": "22331"
            }
        ]
    }
}
```

{% endtab %}

{% tab title="400 Orders failed" %}

```json
{
  "success": false,
  "message": "All orders have failed"
}
```

{% endtab %}

{% tab title="400 Orders required" %}

```json
{
  "success": false,
  "message": "Orders is required"
}
```

{% endtab %}

{% tab title="401 Unauthorized" %}

```json
{
  "success": false,
  "message": "Unauthorized - No token provided"
}
```

{% endtab %}
{% endtabs %}


---

# 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://linkbolt.gitbook.io/v2/reference/pedidos.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.
