cobank.ai

API-Referenz

v1, April 2026

Diese Seite ist derzeit nur auf Englisch verfügbar.

Authentication

API keys are generated in Settings → Workspace → API Key. Pass the key as a Bearer token in the Authorization header:

Authorization: Bearer sk_cobank_a1b2c3d4e5f6...

Send requests to www.cobank.ai — the apex cobank.ai redirects there, and HTTP clients drop the Authorization header across a host change, so a request sent to the apex arrives without your key.

Keys are hashed server-side with SHA-256. cobank never stores the raw key. If you lose the key, revoke it in Settings and generate a new one.

POST /api/ingest

Push structured invoice data from ERPs, accounting software, or custom integrations. Each request can contain up to 100 invoices.

Request

POST https://www.cobank.ai/api/ingest
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

{
  "invoices": [
    {
      "vendor_name": "Kuehne + Nagel AG",
      "invoice_date": "2026-03-10",
      "total_amount": 29835.60,
      "currency": "CHF",
      "region": "CH",
      "line_items": [
        {
          "description": "FCL Container Rotterdam-Shanghai",
          "spend_amount": 9200,
          "quantity": 1,
          "unit_of_measure": "TEU"
        },
        {
          "description": "Inland transport Zurich-Rotterdam",
          "spend_amount": 3400,
          "quantity": 28,
          "unit_of_measure": "t",
          "distance_km": 820
        }
      ]
    }
  ]
}

Invoice fields

FieldTypeDescription
vendor_namestringrequiredSupplier / vendor name
invoice_datestringrequiredISO date (YYYY-MM-DD)
total_amountnumberoptionalInvoice total. If omitted, computed from line items.
vat_ratenumberoptionalDer auf dem Beleg ausgewiesene Mehrwertsteuersatz, angegeben als Prozentwert – also 19 für 19 %, nicht 0,19. Damit wird der Rechnungsbetrag netto gestellt, bevor er mit Ihren Positionen abgeglichen wird.
net_amountnumberoptionalDer Rechnungsbetrag ohne Steuer, in derselben Währung wie total_amount. Wenn Ihr System diesen Wert kennt, hat er Vorrang vor vat_rate, denn dann wird nichts aus einem Satz abgeleitet.
currencystringoptionalISO 4217 code. Default: CHF
regionstringoptionalISO country code. Default: CH
entity_idstring (uuid)optionalThe legal entity this invoice belongs to, as your system of record states it. It is used as sent: if the buyer printed on the invoice is a different one of your entities, the invoice still goes to entity_id and the disagreement is returned as entity_conflict. An id that is not one of your entities refuses that invoice; it is listed in errors.
buyerobjectoptionalWho the invoice is addressed to, as printed on it. When entity_id is absent, it decides the entity against your entity register by the rules below — never by a guess. It does not change how a line is classified or what it emits. Fields below.
line_itemsarrayrequiredAt least one line item per invoice

Buyer fields

FieldTypeDescription
namestringoptionalCompared with each entity's legal name and the other names it is known by on invoices (set on the entity in your workspace settings), ignoring case, punctuation, legal forms (GmbH, AG, Sp. z o.o.) and umlaut spelling. If no entity matches, the invoice is stored with no entity; when one entity's name is clearly the closest, it is shown as a suggestion in Documents — it is never applied.
vat_idstringoptionalCompared with each entity's VAT / UID and registration number, ignoring spaces and punctuation. A match to one entity decides it and outranks the name; when two of your entities carry the same identifier, the name decides between them, or the invoice is stored with no entity.
customer_numberstringoptionalYour customer number at the supplier. Recorded with the decision; not used to make it.
street, postal_code, city, countrystringoptionalAccepted, not used to decide: an address does not say which legal entity bought.
Every buyer field is a string of at most 200 characters, or null. An unknown field or a value of another type refuses the whole request before anything is written: 400 invalid_buyer, with field naming it.

Line item fields

FieldTypeDescription
descriptionstringrequiredLine item description. The classifier uses this to assign an emission factor.
spend_amountnumberrequiredAmount in invoice currency
quantitynumberoptionalPhysical quantity (kWh, kg, km, TEU, etc.)
unit_of_measurestringoptionalUnit label for quantity
weight_tonnesnumberoptionalWeight in metric tonnes (for freight)
distance_kmnumberoptionalDistance in km (for freight/travel)
Providing physical quantities (kWh, t, km) produces higher-confidence results than spend-only. Physical method = 0.85–0.95 confidence; spend-based = 0.55–0.75.

Response (success)

{
  "processed": 1,
  "invoices": [
    {
      "invoice_id": "bb387bb1-a2a3-4933-af02-3475a7753a68",
      "vendor_name": "Kuehne + Nagel AG",
      "line_items_created": 2,
      "total_kgco2e": 1287.40,
      "entity_id": "5c1f0e2a-7d4b-4f6e-9a3c-2b8d1e0f4a71",
      "entity_basis": "document_id",
      "entity_conflict": false
    }
  ],
  "errors": []
}

How the entity was decided (entity_basis)

Each invoice in the response carries entity_id, entity_basis and entity_conflict.

ValueMeaning
explicitYou sent entity_id and it was used. entity_conflict is true when the buyer named a different one of your entities.
document_idThe buyer's VAT ID matched one, and only one, of your entities.
document_nameThe buyer's name matched one, and only one, of your entities, by its legal name or one of its other names. When two of your entities share the buyer's VAT ID, the name only has to tell those two apart.
sole_entityYour register holds one entity; every invoice is on it.
unresolvedThe buyer matched none of your entities, or none was sent. Stored with no entity; it reads “Needs an entity” in Documents until someone assigns it.
ambiguousThe buyer matched more than one of your entities. Stored with no entity.
no_entitiesYour workspace has not declared an entity register.

Response (partial failure)

{
  "processed": 1,
  "invoices": [{ ... }],
  "errors": [
    {
      "index": 1,
      "vendor_name": "Bad Invoice",
      "error": "Missing invoice_date"
    }
  ]
}

Rate limits

LimitValue
Invoices per request100
Requests per minute, per workspace10

Error codes

HTTPMeaning
400Validation error (missing fields, empty array)
401Missing or invalid API key
429Rate limit exceeded
500Server error (retry)
503Your entity register could not be read, so nothing was written (retry)

Example (curl)

curl -X POST https://www.cobank.ai/api/ingest \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "invoices": [{
      "vendor_name": "Office AG",
      "invoice_date": "2026-04-01",
      "total_amount": 1200,
      "currency": "CHF",
      "line_items": [{
        "description": "Office supplies",
        "spend_amount": 1200
      }]
    }]
  }'

POST /api/workpaper

Auditor workpaper operations. Requires JWT authentication from an auditor account.

Actions

ActionDescription
generate-sampleCreate a risk-weighted sample (ISA 530) for an engagement
save-assertionSave/update a workpaper assertion on a line item
re-performRe-run emission calculation for comparison
completeMark engagement as completed (all items tested)
export-evidenceDownload evidence package as ZIP

Example: export evidence

POST https://www.cobank.ai/api/workpaper
Authorization: Bearer <jwt>
Content-Type: application/json

{ "action": "export-evidence", "engagement_id": "UUID" }

Response: application/zip containing:

FileContent
metadata.jsonEngagement details, period totals, testing summary
workpapers.jsonPer-item assertion status, risk scores, factor details
audit-trail.jsonSHA-256 hash chain entries for the period
source-documents/*.pdfOriginal invoices (if available, max 10)
The engagement must be completed before export. Call complete first.

Webhooks

Coming in v2. Webhook notifications for invoice processing completion, period close, and amendment events.