API Docs

Global settings

Get supply order by ID

Returns a Supply Order by its ID

POST/https://api-get-supply-order-by-id-kigtdz23uq-ew.a.run.app

Headers

Content-Type
application/json
string
x-api-key
<API_KEY>
string

Body Parameters

supply_order_id
Required, not empty.
id
string

cURL

curl -i \
  -X POST \
  -H "Content-Type: application/json" \
  -H "x-api-key: <API_KEY>" \
  -d '{
    "supply_order_id": "id"
  }' \
  https://api-get-supply-order-by-id-kigtdz23uq-ew.a.run.app

Response

200 Success

The Supply Order exists and was returned successfully.

{
  "id": "supplyDocumentId",
  "currency": "CHF",
  "total": 490,
  "invoices": [
    {
      "name": "Invoice name",
      "url": "https://example.com/invoice.pdf",
      "date": "2026-08-05T23:00:00Z"
    }
  ],
  "payments": [
    {
      "id": "paymentId",
      "amount": 200,
      "currency": "CHF",
      "date": "2026-08-06T10:00:00Z"
    }
  ]
}

currency may be null if the stored value is missing or invalid.

invoices is always an array. An invoice with a valid name and url, but a missing or invalid date, is returned with:

{
  "name": "Invoice name",
  "url": "https://example.com/invoice.pdf",
  "date": null
}

204 Successful preflight

Returned for a valid OPTIONS CORS preflight request. The response has no body.

400 Invalid payload

Returned when supply_order_id is missing, empty, contains /, or when the payload contains unsupported fields.

{
  "success": false,
  "message": "Invalid payload",
  "errors": [
    {
      "path": "supply_order_id",
      "message": "supply_order_id is required"
    }
  ]
}

An invalid Firestore document ID may return:

{
  "success": false,
  "message": "Invalid payload",
  "errors": [
    {
      "path": "supply_order_id",
      "message": "supply_order_id must be a valid document ID"
    }
  ]
}

401 Unauthorized

Returned when the x-api-key header is missing or invalid.

{
  "error": "Unauthorized"
}

403 Origin not allowed

Only applies to OPTIONS preflight requests sent from a disallowed browser origin.

{
  "error": "Origin not allowed"
}

404 Supply Order not found

Returned when supply/{supply_order_id} does not exist.

{
  "error": "Supply order not found"
}

405 Method not allowed

Returned when the endpoint receives a method other than POST or OPTIONS.

{
  "error": "Method not allowed"
}

The response includes the following header:

Allow: POST

500 API key is not configured

Returned when PRODUCT_PRICES_API_KEY is not available in the function environment.

{
  "error": "API key is not configured"
}