Skip to content

Book Your First Shipment

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.

  1. Get an API key

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

  2. 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}]}'
  3. Keep the tracking number

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

Create a new shipment
Track a shipment
Track a shipment
InputsThe carrier tracking numbertrackingNumberstringrequired= CC-2025-0001The shipment behind the tracking number. Track a shipment Inputs: trackingNumber Outputs: shipmentId, statusfindShipmentGET/shipments/{trackingNumber}trackingNumberinputtrackingNumberChecks$statusCode == 200On failure · first match runsstatus 404→ stop the workflow(unknownNumber)Outputs$response.body#/idshipmentIdresponse body /id$response.body#/statusstatusresponse body /statusEvery tracking event of the shipment. Get shipment tracking events Outputs: eventslistEventsGET/shipments/{shipmentId}/eventsshipmentIdstepfindShipment.shipmentIdChecks$statusCode == 200Outputs$response.bodyeventsresponse bodyOutputsFrom stepshipmentIdfindShipmentstatuseventslistEvents