POST
/
orders
curl --request POST \
  --url https://api.cnaught.com/v1/orders \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "metadata": "example metadata",
  "description": "On behalf of Jane Smith",
  "amount_kg": 100.5,
  "notification_config": {
    "url": "https://www.example.com/callback"
  }
}'
{
  "id": "Gre28Fc35bt3",
  "order_number": "47726-53238-46633-33562-7433",
  "amount_kg": 100,
  "metadata": "Customer metadata",
  "price_usd_cents": 2350
}

Authorizations

Authorization
string
headerrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

X-Subaccount-Id
string

If present, scopes the operation to the subaccount with given id. See Subaccounts for more info.

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

application/json

Details for a generic order request that specifies credits amount (in kg of CO<sub>2</sub>)

amount_kg
number
required

The amount of credits to purchase, in kg of CO<sub>2</sub>. Must be a positive integer. Exactly one of amount_kg or total_price_usd_cents must be provided.

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.

Maximum length: 512
description
string | null

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

Maximum length: 512
notification_config
object | 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.

Response

201 - application/json
id
string

Identifier that can be used to retrieve the order details

order_number
string

Hex representation derived from the order id that will be shown on the certificate

created_on
string

Timestamp of when the order was created (in UTC)

metadata
string | null

Optional metadata that was provided with the order

Maximum length: 512
description
string | null

Optional public description for the order that will be shown on the certificate, as provided when order was placed

Maximum length: 512
amount_kg
number

Amount of credits purchased, in kg of CO<sub>2</sub>e

state
enum<string>

The current state of the order.

  • placed - the order has been placed, and is waiting to be matched against available credits in our system.
  • fulfilled - the order has been fulfilled by matching it against available credits in our system, which have been retired.
  • canceled - the order has been canceled
Available options:
placed,
fulfilled,
cancelled
price_usd_cents
number

Amount charged for the credits purchased, in cents (integer)

callback_url
string

Callback URL to invoke when status of the order changes, if specified in the order

certificate_public_url
string | null

URL for the publicly accessible page showing order details and the certificate. This will be null if the order state is cancelled

certificate_download_public_url
string | null

URL for downloading the certificate PDF. This will be null if the order state is cancelled

project_allocations
object[]

For fulfilled orders, a list of the projects that were used to fulfill the order

checkout_session_id
string | null

Id of the checkout session whose completion resulted in the creation of this order. Null if the order did not originate from a checkout session.