Skip to main content
POST
← Invoices API Create one or many electricity invoices. The request checks every record and writes them at once; their emissions (market-based, location-based, generation and transmission & distribution) are calculated in the background. The answer is 202 Accepted with a job: follow it with GET /v2/ingest-jobs/{id} or the ingest_job.finished webhook. This route only takes what an electricity invoice has. The other categories get their own route; until then they keep POST /v1/invoices.
Beta. Part of the bulk ingest API, currently in beta. The contract may still change before general availability.

How it works

  1. Every record is checked. If any is invalid the whole request is rejected with 422 and nothing is written; the answer lists every invalid record, so you can fix them all at once.
  2. The invoices are written at once, with status loading. An invoice split across facilities (facility_percentages) becomes one invoice per facility, each with its share of quantity and total_spend.
  3. The job calculates their emissions in the background. Each invoice ends active, or error when it could not be calculated (see the job’s items).
  4. When every chunk is done the job is completed (or completed_with_errors) and ingest_job.finished is sent to your webhook endpoints.

Request

Headers

string
required
Your API key for authentication
string
required
Your organization UUID
string
required
1 to 255 characters, unique per batch. A retry with the same key and body returns the original job instead of creating the invoices again; the same key with another body is 422 IDEMPOTENCY_KEY_REUSED.

Query Parameters

boolean
default:"false"
Check only: the same 422 for invalid records, nothing written, no job; 200 with {"dry_run": true, "submitted": n, "valid": n} when every record is valid.

Body Parameters

array[object]
required
The invoices to create, 1 to 5,000.

Response

202 Accepted, the job (entity_type: invoices, operation: create) and a Location header to it. GET /v2/ingest-jobs/{id}/items has one item per record, in the order sent, whose entity_id is the invoice’s id (for a split invoice, the id of its first facility’s invoice).

Errors

Problem details. Per-record codes in errors[].error_code: 401 for a missing or invalid API key, 403 LOGGED_USER_NOT_MEMBER when the key’s user is not a member of the organization, 422 REQUEST_VALIDATION_FAILED for a malformed body (no records, more than 5,000, no Idempotency-Key), 422 IDEMPOTENCY_KEY_REUSED for a key already used with another body.

Limits

Delete Invoices (v2)

Delete invoices of any category

Get Ingest Job

Follow the calculation