{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/trimcarbon-com/json-schema/trimcarbon-com-offset-schema.json",
  "title": "Offset",
  "description": "One purchase of carbon credits through the API.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/trimcarbon-com-openapi.json#/components/schemas/Offset",
  "type": "object",
  "properties": {
    "object": {
      "type": "string",
      "const": "offset"
    },
    "id": {
      "type": "string"
    },
    "livemode": {
      "type": "boolean",
      "description": "False for test keys: nothing was charged or retired."
    },
    "status": {
      "type": "string",
      "enum": [
        "processing",
        "placed",
        "refunded"
      ],
      "description": "`processing` until the credits are bought and retired; `placed` once they are; `refunded` if we could not place the order and returned the charge to your balance."
    },
    "kg": {
      "type": "integer",
      "description": "kg of CO₂ offset."
    },
    "amount_cents": {
      "type": "integer",
      "description": "What the purchase took from your balance."
    },
    "currency": {
      "type": "string",
      "const": "usd"
    },
    "rate_millicents_per_kg": {
      "type": "integer",
      "description": "Your rate in thousandths of a cent per kg: 4000 is $0.04/kg ($40 per tonne)."
    },
    "requested": {
      "type": "object",
      "properties": {
        "kg": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "amount_cents": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "kg",
        "amount_cents"
      ],
      "additionalProperties": false,
      "description": "What you asked for: kg, or an amount to spend."
    },
    "reference": {
      "type": [
        "string",
        "null"
      ]
    },
    "certificate_url": {
      "format": "uri",
      "description": "The public certificate on trimcarbon.com, once the order is placed. Null for test offsets.",
      "type": [
        "string",
        "null"
      ]
    },
    "created": {
      "type": "string",
      "format": "date-time"
    },
    "placed": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "object",
    "id",
    "livemode",
    "status",
    "kg",
    "amount_cents",
    "currency",
    "rate_millicents_per_kg",
    "requested",
    "reference",
    "certificate_url",
    "created",
    "placed"
  ],
  "additionalProperties": false
}