Skip to main content
POST
← Facilities API Create one or many facilities. Creating a facility calculates nothing, so the request is synchronous: it answers 201 Created with every facility, in the order you sent them, ready to use as facility_id in your consumption data.
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 created; the answer lists every invalid record, so you can fix them all at once.
  2. Every facility is created in one transaction and returned, in the order sent. source_row_index is the position of the record in records, and client_row_id echoes yours.
  3. country decides where the facility is. It is required and stored as sent. address is optional and only informative: it is not geocoded (unlike POST /v1/facilities, which replaced the country with the one Google found for the address).

Request

Headers

string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa
string
required
1 to 255 characters, unique per batch. A retry with the same key and body answers the same facilities (with Idempotent-Replayed: true) instead of creating them 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 created; 200 with {"dry_run": true, "submitted": n, "valid": n} when every record is valid.

Body Parameters

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

Response

201 Created with items: one per record, in the order sent, each with source_row_index, client_row_id and the created facility (the same object as Get Facility, with UTC timestamps ending in Z).

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 1,000, no Idempotency-Key), 422 IDEMPOTENCY_KEY_REUSED for a key already used with another body.

Retries and idempotency

  • Network error or timeout: retry with the same Idempotency-Key and body. If the first request was accepted you get the same facilities back, with Idempotent-Replayed: true, and nothing is duplicated.
  • 422 BULK_RECORDS_REJECTED: nothing was created. Fix the records and send the batch again.

Limits

Delete Facilities (v2)

Delete up to 1,000 facilities with their data

Create Wastes (v2)

Load wastes into the new facilities