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

# Deliveries

{% hint style="info" %}
**Good to know:** All the methods shown below are synced to an example Swagger file URL and are kept up to date automatically with changes to the API.
{% endhint %}

## GET Delivery Pricing

## Get the delivery price from departure to arrival

<mark style="color:blue;">`GET`</mark> `https://api.gorider.co/api/oauth2/v1/delivery/pricing`

#### Query Parameters

| Name                                                 | Type   | Description |
| ---------------------------------------------------- | ------ | ----------- |
| client\_id<mark style="color:red;">\*</mark>         | String |             |
| client\_secret\_id<mark style="color:red;">\*</mark> | String |             |
| departure<mark style="color:red;">\*</mark>          | String |             |
| arrival<mark style="color:red;">\*</mark>            | String |             |

#### Headers

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| Bearer Token<mark style="color:red;">\*</mark> | String | API\_KEY    |

{% tabs %}
{% tab title="cURL" %}

```url
curl https://api.gorider.co/v1/delivery/pricing?client_id={client_id}&client_secret_id={client_secret_id}&departure="10 rue du paradis, 75010"&arrival="121 rue du faubourg saint-denis, 75010"
    -H "Authorization: Bearer {token}"
```

{% endtab %}

{% tab title="Node" %}

```javascript
// require the gorider module and set it up with your keys
const grClient = require('gorider')({client_id, client_secret_id, apiToken});

const deliveryPricing = await grClient.deliveries.getPricing({
    departure: "10 rue du paradis, 75010",
    arrival: "121 rue du faubourg saint-denis, 75010"
})
```

{% endtab %}
{% endtabs %}

## GET Your Deliveries

## Get your deliveries

<mark style="color:blue;">`GET`</mark> `https://api.gorider.co/api/oauth2/v1/deliveries`

#### Query Parameters

| Name                                                 | Type   | Description          |
| ---------------------------------------------------- | ------ | -------------------- |
| client\_id<mark style="color:red;">\*</mark>         | String |                      |
| client\_secret\_id<mark style="color:red;">\*</mark> | String |                      |
| $limit<mark style="color:red;">\*</mark>             | Number | By default set to 10 |
| $page<mark style="color:red;">\*</mark>              | Number |                      |

#### Headers

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| Bearer Token<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="cURL" %}

```
curl https://api.gorider.co/v1/deliveries?client_id={client_id}&client_secret_id={client_secret_id}
    -H "Authorization: Bearer {token}"
```

{% endtab %}

{% tab title="Node" %}

```javascript
// require the gorider module and set it up with your keys
const grClient = require('gorider')({client_id, client_secret_id, apiToken});

const deliveries = await grClient.deliveries.getDeliveries({
    $page: 1,
    $limit: 20,
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
By default, the $page is equal to 1 and the $limit is equal to 10
{% endhint %}

## GET Your Delivery

## Get a delivery

<mark style="color:blue;">`GET`</mark> `https://api.gorider.co/api/oauth2/v1/delivery/:deliveryId`

#### Path Parameters

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| deliveryId<mark style="color:red;">\*</mark> | String |             |

#### Query Parameters

| Name                                                 | Type   | Description |
| ---------------------------------------------------- | ------ | ----------- |
| client\_id<mark style="color:red;">\*</mark>         | String |             |
| client\_secret\_id<mark style="color:red;">\*</mark> | String |             |

#### Headers

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| Bearer Token<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="cURL" %}

```
curl https://api.gorider.co/v1/delivery/:deliveryId?client_id={client_id}&client_secret_id={client_secret_id}
    -H "Authorization: Bearer {token}"
```

{% endtab %}

{% tab title="Node" %}

```javascript
// require the gorider module and set it up with your keys
const grClient = require('gorider')({client_id, client_secret_id, apiToken});

const deliveryId = 'YOUR_DELIVERY_ID'
const delivery = await grClient.deliveries.getDelivery(deliveryId)
```

{% endtab %}
{% endtabs %}

## GET Deliveries Statistics&#x20;

<mark style="color:blue;">`GET`</mark> `https://api.gorider.co/api/oauth2/v1/deliveries/stats?`

#### Path Parameters

| Name       | Type   | Description |
| ---------- | ------ | ----------- |
| deliveryId | String |             |

#### Query Parameters

| Name                                                 | Type   | Description |
| ---------------------------------------------------- | ------ | ----------- |
| client\_id<mark style="color:red;">\*</mark>         | String |             |
| client\_secret\_id<mark style="color:red;">\*</mark> | String |             |
| $startDate                                           | Date   |             |
| $endDate                                             | Date   |             |

#### Headers

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| Bearer Token<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="cURL" %}

```
curl https://api.gorider.co/v1/delivery/statistics?client_id={client_id}&client_secret_id={client_secret_id}
    -H "Authorization: Bearer {token}"
```

{% endtab %}

{% tab title="Node" %}

```javascript
// require the gorider module and set it up with your keys
const grClient = require('gorider')({client_id, client_secret_id, apiToken});

const deliveriesStatistics = await grClient.deliveries.getStatistics({
    $startDate: new Date("2022-05-31T22:00:00.000Z"),
    $endDate: new Date("2022-06-30T22:00:00.000Z"),
})
```

{% endtab %}
{% endtabs %}

## UPDATE Deliveries Settings

## Update deliveries settings

<mark style="color:orange;">`PUT`</mark> `https://api.gorider.co/api/oauth2/v1/delivery/settings`

#### Query Parameters

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| client\_id<mark style="color:red;">\*</mark> | String |             |
| client\_secret\_id                           | String |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer Token | String |             |

#### Request Body

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| maxRadius | String |             |

{% tabs %}
{% tab title="cURL" %}

```
curl -XPUT https://api.gorider.co/v1/delivery/settings?client_id={client_id}&client_secret_id={client_secret_id}
    -H "Authorization: Bearer {token}"
    -H "Content-Type: application/json"
    -d '{"maxRadius": 5000}'
```

{% endtab %}

{% tab title="Node" %}

```javascript
// require the gorider module and set it up with your keys
const grClient = require('gorider')({client_id, client_secret_id, apiToken});

const deliveryUpdate = await grClient.deliveries.updateSettings({
    maxRadius: '5000' // in meters
})
```

{% endtab %}
{% endtabs %}

## POST Order Delivery

## Order a delivery

<mark style="color:green;">`POST`</mark> `https://api.gorider.co/api/oauth2/v1/delivery`

#### Query Parameters

| Name                                                 | Type   | Description |
| ---------------------------------------------------- | ------ | ----------- |
| client\_id<mark style="color:red;">\*</mark>         | String |             |
| client\_secret\_id<mark style="color:red;">\*</mark> | String |             |

#### Headers

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| Bearer Token<mark style="color:red;">\*</mark> | String |             |

#### Request Body

| Name                                              | Type   | Description |
| ------------------------------------------------- | ------ | ----------- |
| departure                                         | Object |             |
| arrival<mark style="color:red;">\*</mark>         | Object |             |
| arrival.placeId<mark style="color:red;">\*</mark> | String |             |
| arrival.contact<mark style="color:red;">\*</mark> | Object |             |
| departure.placeId                                 | String |             |
| departure.contact                                 | Object |             |

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="cURL" %}

```
curl https://api.gorider.co/v1/delivery/pricing?client_id={client_id}&client_secret_id={client_secret_id}&departure="10 rue du paradis, 75010"&arrival="121 rue du faubourg saint-denis, 75010"
    -H "Authorization: Bearer {token}"
```

{% endtab %}

{% tab title="Node" %}

```javascript
// require the gorider module and set it up with your keys
const grClient = require('gorider')({client_id, client_secret_id, apiToken});

const deliveryPricing = await grClient.deliveries.getPricing({
    departure: "10 rue du paradis, 75010", // if it's empty mainAddress is taken
    arrival: "121 rue du faubourg saint-denis, 75010"
})

const delivery = await grClient.deliveries.orderDelivery({
    departure: { // if it's empty mainAddress is taken
        placeId: deliveryPricing.departurePlaceId,
        contact: {
            firstname: 'Jean',
            lastname: 'Goldberg',
            companyName: 'Gorider',
            phoneNumber: '+33143339933',
            email: 'hello@gorider.co',
        },
    },
    arrival: {
        placeId: deliveryPricing.arrivalPlaceId,
        contact: {
            firstname: 'Jean',
            lastname: 'LeReceveur',
            companyName: 'Receiver',
            phoneNumber: '+33123433221',
            email: 'hello@receiver.xyz',
        },
    },
    amount: deliveryPricing.totalAmount, // used only to check
})
```

{% endtab %}
{% endtabs %}

## CANCEL Ongoing Delivery

<mark style="color:green;">`POST`</mark> `https://api.gorider.co/api/oauth2/v1/delivery/:delivery/cancel`

#### Path Parameters

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| deliveryId<mark style="color:red;">\*</mark> | String |             |

#### Query Parameters

| Name                                                 | Type   | Description |
| ---------------------------------------------------- | ------ | ----------- |
| client\_id<mark style="color:red;">\*</mark>         | String |             |
| client\_secret\_id<mark style="color:red;">\*</mark> | String |             |

#### Headers

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| Bearer Token<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="cURL" %}

```
curl -XPUT https://api.gorider.co/v1/delivery/:deliveryId/cancel?client_id={client_id}&client_secret_id={client_secret_id}
    -H "Authorization: Bearer {token}"
    -H "Content-Type: application/json"
    -d '{ "reason": "Cancelled by the buyer" }'
```

{% endtab %}

{% tab title="Node" %}

```javascript
// require the gorider module and set it up with your keys
const grClient = require('gorider')({client_id, client_secret_id, apiToken});

const deliveryId = 'YOUR_DELIVERY_ID'
const deliveryUpdate = await grClient.deliveries.cancelDelivery({
    id: deliveryId,
    reason: "Cancelled by the buyer"
})
```

{% endtab %}
{% endtabs %}

## UPDATE Ongoing Delivery&#x20;

<mark style="color:orange;">`PUT`</mark> `https://api.gorider.co/api/oauth2/v1/delivery/:delivery/update`

#### Path Parameters

| Name       | Type   | Description |
| ---------- | ------ | ----------- |
| deliveryId | String |             |

#### Query Parameters

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| client\_id<mark style="color:red;">\*</mark> | String |             |

#### Headers

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | String |             |

{% tabs %}
{% tab title="cURL" %}

```
curl -XPUT https://api.gorider.co/v1/delivery/:deliveryId?client_id={client_id}&client_secret_id={client_secret_id}
    -H "Authorization: Bearer {token}"
    -H "Content-Type: application/json"
    -d '{ "arrival": { "placeId": "ChIJh_jHSBFu5kcRATQwxUT8k7o", "contact": { "phoneNumber": "+33633443344" } } }'
```

{% endtab %}

{% tab title="Node" %}

```javascript
// require the gorider module and set it up with your keys
const grClient = require('gorider')({client_id, client_secret_id, apiToken});

const deliveryId = 'YOUR_DELIVERY_ID'
const deliveryPricing = await grClient.deliveries.getPricing({
    deliveryId: deliveryId
    arrival: "121 rue du faubourg saint-denis, 75010"
})

// deliveryPricing will only rebill the distance
const deliveryUpdate = await grClient.deliveries.updateDelivery({
    id: deliveryId,
    arrival: placeId
})
```

{% endtab %}
{% endtabs %}
