CNaughtCNaught
PricingSign In

Create Carbon Credits Order for Vehicle Ride

deprecated

[Deprecated] Use /quotes/ground-transport with passenger_car_van_or_suv as the vehicle_type to calculate ride emissions. Then pass the result to /orders to place the order.

Places an order for carbon credits for a vehicle ride of the given distance (in kilometers). The order will remain in the placed state until it can be matched to available credits, after which the order will be fulfilled and moved to the fulfilled state.

POST/orders/ride

Authorizations#

Authorization

string

header

required

Bearer authentication header of the form Bearer <token>, where <token> is your CNaught API key.

Headers#

X-Subaccount-Id

string

If present, the new order will be associated with the subaccount with given id.

Idempotency-Key

string

If present, a unique identifier that allows you to retry a request multiple times while only performing the action once. See Idempotency for more info.

Body#

Order Parameters

metadata

string | null

Optional metadata that can be provided with the order. Not shown on the certificate, and is intended for API clients to attach arbitrary metadata that can be retrieved with the order.

description

string | null

Optional public description for the order that will be shown on the certificate

notification_config

NotificationConfig | null

Optional configuration for a callback url to invoke with updates when the status of an order changes.

portfolio_id

string | null

Optional ID of the portfolio to use for fulfilling the order. If not specified, the account's default portfolio will be used.

distance_km

number

required

Distance of ride, in km

Response#

201

Order Details

Create Carbon Credits Order

Create Carbon Credits Order for Vehicle Ride

curl --request POST \
  --url https://api.cnaught.com/v1/orders/ride \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "metadata": "example metadata",
  "distance_km": 10.5,
  "notification_config": {
    "url": "https://www.example.com/callback"
  }
}'
{
  "id": "XYZ",
  "metadata": "Customer metadata",
  "amount_kg": 15,
  "price_usd_cents": 2350,
  "state": "placed"
}