# Book Your First Shipment

> Create a shipment and track it, with the live API console embedded in the page.

This guide books an interstellar shipment with the Shipment API and then tracks it. It is written in Markdoc, so it can use the portal's tags.

> **Tip: Try it in the page**
> The console below is the real Shipment API reference. Fill in the request and choose **Try** to send it to the mock server.

## Create the shipment

**Get an API key**

Create a key in the developer console and send it in the `X-API-Key` header.

**Describe the cargo**

Send the origin, destination and packages:

**cURL**

```sh
curl -X POST https://api.cosmocargo.dev/v1/shipments \
  -H "X-API-Key: $COSMO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"origin": "Earth", "destination": "Mars Colony Alpha", "packages": [{"weightKg": 42}]}'
```

**JavaScript**

```js
const response = await fetch('https://api.cosmocargo.dev/v1/shipments', {
  method: 'POST',
  headers: { 'X-API-Key': process.env.COSMO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({ origin: 'Earth', destination: 'Mars Colony Alpha', packages: [{ weightKg: 42 }] }),
});
const shipment = await response.json();
```

**Keep the tracking number**

The response contains the `trackingNumber` you need to track the shipment. Required

`POST /shipments` Create a new shipment ([Shipment API](/cosmo-cargo/apis/shipments))

## Track it

`GET /shipments/{trackingNumber}` Track a shipment ([Shipment API](/cosmo-cargo/apis/shipments))

## Both calls as a workflow
