# On resource IDs (/api/using-the-api/on-resource-ids)

How prefixed ids such as orders/{id} address a resource.

Every resource in the Connect API has a unique id that Spoke generates. Every
resource representation the API returns shows that id in the following format:

```json
{
  "id": "collectionName/resourceId"
}
```

So an order comes back as:

```json
{
  "id": "orders/W3kJpzQm9q4LV2BdH7sNuT"
}
```

Ids are unique per collection, so `orders/...`, `couriers/...`, and
`pickupLocations/...` name an order, a courier, and a pickup location
respectively.

This means that to act on a resource directly you append its id to the base
address exactly as it came back:

```bash
curl "https://api.spoke.com/connect/v1/`serializedId`" \
  -H "Authorization: Bearer <api-key>"
```

For the order above that is:

```bash
curl "https://api.spoke.com/connect/v1/orders/W3kJpzQm9q4LV2BdH7sNuT" \
  -H "Authorization: Bearer <api-key>"
```

Sub-resources hang off the same id, so that order's labels are at
`orders/W3kJpzQm9q4LV2BdH7sNuT/shippingLabels`.

The endpoint reference below writes the same paths in OpenAPI template
notation, as `/orders/{id}`. That describes the URL you just built, so there is
no second id format to keep track of.

Send ids back in the form you received them. `courierId` on
`POST /orders:submit`, and `pickupLocationId` on an order, both take the full
prefixed value.