> For the complete documentation index, see [llms.txt](https://apidocs.rapigo.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.rapigo.co/api/cotizar-servicio.md).

# Cotizar Servicio

## Cotizar valor servicio

<mark style="color:green;">`POST`</mark> `https://www.rapigo.co/api/v1/estimate/`

Función para cotizar el valor del servicio

#### Headers

| Name           | Type   | Description      |
| -------------- | ------ | ---------------- |
| Authentication | string | Token Basic Auth |

#### Request Body

| Name     | Type   | Description                                                   |
| -------- | ------ | ------------------------------------------------------------- |
| city\_id | string |                                                               |
| points   | array  | array formato json, de las direcciones de recogida y entrega. |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```javascript
{
    "status": "ok",
    "distance": 2000,
    "price": 24000,
    "estimate": 301
}
```

{% endtab %}
{% endtabs %}

## Ejemplo en php

```php
<?php

$request = new HttpRequest();
$request->setUrl('https://www.rapigo.co/api/bogota/estimate/');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'postman-token' => '62e4553c-9ff8-a703-3571-1b1752d6ea2e',
  'cache-control' => 'no-cache',
  'content-type' => 'application/json',
  'authorization' => 'Basic anVsaWFuQHJhcGlnby5jbzpjb2xvbWJpYTEyMjQ='
));

$request->setBody('{
  "points": [
    {
        "address" : "Carrera 18 #148-69",
        "type" :"point",
        "description" : "Recoger 2 paquetes",
        "phone" : "3147445189"
    },
    {
        "address" : "Av 9 #104",
        "type" :"point",
        "description" : "Recoger 2 paquetes",
        "phone" : "3147445189"
    }
]
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```
