Skip to main content

Quickstart

This guide will take you from zero to making your first API call in less than 5 minutes.

Prerequisites

You’ll need:
  • An account at app.dcycle.io
  • Your organization must have API enabled (contact support if you don’t see it)

Step 1: Get your API Key

1

Log in to Dcycle

Go to app.dcycle.io and log in to your account.
2

Navigate to API settings

Go to Organization Settings → API Keys
3

Generate a new API Key

Click “Generate API Key”
The API Key is only shown once. Save it in a secure place.
4

Copy your credentials

You’ll need three values:
  • API Key: The key you just generated
  • Organization ID: Your organization UUID
  • User ID: Your user UUID

Step 2: Set up your Environment Variables

Save your credentials securely:
export DCYCLE_API_KEY="your-api-key-here"
export DCYCLE_ORG_ID="your-organization-id-here"
export DCYCLE_USER_ID="your-user-id-here"
Never save your API Key in source code or commit it to Git repositories.

Step 3: Make your First Call

Let’s calculate the emissions of a sample shipment:
curl -X POST "https://api.dcycle.io/api/v1/logistics/shipment" \
  -H "Authorization: Bearer ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}" \
  -H "x-user-id: ${DCYCLE_USER_ID}" \
  -H "Content-Type: application/json" \
  -d '{
    "origin": "Madrid, Spain",
    "destination": "Barcelona, Spain",
    "toc": "van_diesel",
    "load": 1000,
    "load_unit": "kg",
    "year": 2024
  }'

Expected Response

If everything works correctly, you’ll receive a response like this:
{
  "co2e": 245.5,
  "distance_km": 620.0,
  "toc": "van_diesel",
  "load": 1000,
  "load_unit": "kg",
  "origin": "Madrid, Spain",
  "destination": "Barcelona, Spain",
  "year": 2024,
  "emission_factor": 0.000396,
  "methodology": "ISO 14083"
}
Congratulations! You’ve calculated your first CO2 emission with Dcycle.

Next Steps

Now that you’ve made your first call, explore more functionality:

Troubleshooting

Error 401: Unauthorized

Your API Key is invalid or has expired. Check:
  • You copied the complete API Key
  • You’re using the correct Authorization: Bearer header format
  • Your organization has API enabled

Error 400: Bad Request

The data sent is invalid. Check:
  • JSON format is correct
  • Required fields are present
  • Values are in the expected format

Need more help?

Check our Support & Resources page for troubleshooting tips, guides, and contact information.