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.
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
Section titled “Create the shipment”Get an API key
Create a key in the developer console and send it in the
X-API-Keyheader.Describe the cargo
Send the origin, destination and packages:
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}]}'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
trackingNumberyou need to track the shipment. Required