---
agentTools:
  projectIndex: https://sparqle-api.readme.io/llms.txt
---

# Getting Started with the Sparqle API

This Documentation page will help you get started with the Sparqle API.

### Authentication

All API requests processed through the Sparqle platform are authenticated with an API credential linked to your company account, which can be found in the [Sparqle Dashboard](https://staging.sparqle.tech/) > Settings page.

Authenticate your request by sending an API key in the `api-key` HTTP request header.

```curl Request Header
POST /orders
Host: https://staging-v2.sparqle.tech/
Content-Type: application/json
api-key: YOUR_API_KEY
```

### [Orders](https://sparqle-api.readme.io/reference/orders)

Create delivery orders directly on the Sparqle API.

The `locationId` is a reference to your location's address. Please contact [Support](mailto:support@sparqle.com) to request your location id.

### [Labels](https://sparqle-api.readme.io/reference/orders)

For your created order you can retrieve a label with a **GET** to `/orders/label/{orderId}?orientation=portrait`. The result is a *base64* encoded value that can be converted to a PDF. For each of the collo there's a separate page in the PDF. Specify query parameter `orientation` with value `portrait` to get the labels in portrait mode.

```Text Response - Example Label
{
    "label": "JVBERi0xLjM....lRU9GCg=="
}
```

<br />

```Text Request - Example Return
```

### Webhooks

Sparqle sends webhooks for every order update. In each webhook the body contains the full order object. Provide your webhook url and preferred events to our support team.

> 🚧 The following statuses are supported:
>
> **ERROR, DRAFT, EXPECTED, IN\_TRANSIT, OUT\_FOR\_DELIVERY, AWAITING\_NEXT\_ATTEMPT, FAILED, MISSING, COMPLETED, REJECTED, CANCELLED, RETURNED**

```Text Example Order Webhook
{
    "labels": [],
    "id": 581,
    "createdAt": "2023-12-01T09:02:48.031Z",
    "updatedAt": "2023-12-01T09:02:48.031Z",
    "orderId": "AB5B6DOP2",
    "orderRef": "12345",
    "orderType": "SAME_DAY",
    "status": "DRAFT",
    "invoiceId": null,
    "invoiceLineItemId": null,
    "createdBy": null,
    "attempt": 0,
    "name": “Package",
    "description": "ABC",
    "length": 200,
    "width": 200,
    "height": 200,
    "weight": 400,
    "deliveryDate": "2023-11-27T00:00:00.000Z",
    "pickupName": “Rituals - Spuistraat”,
    "pickupAddress": "Spuistraat 13, 2511 BC Den Haag, Netherlands",
    "pickupAddressLat": "52.0771428",
    "pickupAddressLng": "4.3115002",
    "pickupPhone": null,
    "pickupTimeStart": "14:00",
    "pickupTimeEnd": "18:00",
    "pickupDuration": 2,
    "pickupNote": null,
    "deliveryName": "Sparqle HQ",
    "deliveryEmail": "example@gmail.com",
    "deliveryAddress": "IJsbaanpad 2, 1076 CV Amsterdam",
    "deliveryAddressLat": 52.3413986,
    "deliveryAddressLng": 4.8538871,
    "deliveryPhone": "+31932780701",
    "deliveryTimeStart": "15:00",
    "deliveryTimeEnd": "21:00",
    "deliveryDuration": 2,
    "deliveryNote": null,
    "region": "Amsterdam",
    "isDispatch": false,
    "load": 1,
    "types": [],
    "pickupEta": null,
    "deliveryEta": null,
    "unscheduledReason": null,
    "packageWas": null,
    "neighbourAddress": null,
    "pods": [],
    "signature": null,
    "riderNote": null,
    "failedReason": null,
    "pickupStatus": "DRAFT",
    "deliveryStatus": "DRAFT",
    "arrivedAt": null,
    "completedAt": null,
    "failedAt": null,
    "locationId": "8ABC19NJF7O",
    "companyId": 61
}

```