Skip to main content
PATCH
https://api.dcycle.io
/
v1
/
invoices
/
{invoice_id}
curl -X PATCH "https://api.dcycle.io/v1/invoices/550e8400-e29b-41d4-a716-446655440000" \
  -H "x-organization-id: YOUR_ORGANIZATION_ID" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "active",
    "invoice_id": "INV-2024-001-UPDATED"
  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "type": "electricity",
  "status": "active",
  "quantity": 1500.00,
  "base_quantity": 3000.00,
  "unit_id": "ba80e6cb-86a4-4bb1-a0c5-8104365d523c",
  "start_date": "2024-01-01T00:00:00",
  "end_date": "2024-01-31T23:59:59",
  "invoice_id": "INV-2024-001-UPDATED",
  "facility_id": "660e8400-e29b-41d4-a716-446655440000",
  "facility_fuel_id": null,
  "supplier_id": "770e8400-e29b-41d4-a716-446655440000",
  "custom_emission_factor_id": null,
  "co2e": 245.5,
  "co2e_biomass": 0,
  "cups": "ES0021000000000001XX",
  "file_id": "880e8400-e29b-41d4-a716-446655440000",
  "file_url": "https://storage.dcycle.io/invoices/invoice-2024-001.pdf",
  "uploaded_by": "990e8400-e29b-41d4-a716-446655440000",
  "percentage": 0.5,
  "enabled": true,
  "created_at": "2024-02-01T10:30:00Z",
  "updated_at": "2024-02-15T14:22:00Z"
}

Overview

Updates an existing invoice with the provided fields. This is a partial update (PATCH), meaning only the fields included in the request body will be modified.

Path Parameters

invoice_id
UUID
required
The unique identifier of the invoice to update.Example: 550e8400-e29b-41d4-a716-446655440000

Request Body

uploaded_by
UUID
ID of the user who uploaded the invoice.
facility_id
UUID
ID of the facility to associate with this invoice.
supplier_id
UUID
ID of the energy supplier.
status
string
Invoice status.Allowed values: uploaded, loading, active, inactive, review, error
invoice_id
string
Invoice number/identifier from the utility provider.
cups
string
CUPS code for electricity invoices (Spanish market).

Response

Returns the updated invoice object with all fields.
curl -X PATCH "https://api.dcycle.io/v1/invoices/550e8400-e29b-41d4-a716-446655440000" \
  -H "x-organization-id: YOUR_ORGANIZATION_ID" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "active",
    "invoice_id": "INV-2024-001-UPDATED"
  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "type": "electricity",
  "status": "active",
  "quantity": 1500.00,
  "base_quantity": 3000.00,
  "unit_id": "ba80e6cb-86a4-4bb1-a0c5-8104365d523c",
  "start_date": "2024-01-01T00:00:00",
  "end_date": "2024-01-31T23:59:59",
  "invoice_id": "INV-2024-001-UPDATED",
  "facility_id": "660e8400-e29b-41d4-a716-446655440000",
  "facility_fuel_id": null,
  "supplier_id": "770e8400-e29b-41d4-a716-446655440000",
  "custom_emission_factor_id": null,
  "co2e": 245.5,
  "co2e_biomass": 0,
  "cups": "ES0021000000000001XX",
  "file_id": "880e8400-e29b-41d4-a716-446655440000",
  "file_url": "https://storage.dcycle.io/invoices/invoice-2024-001.pdf",
  "uploaded_by": "990e8400-e29b-41d4-a716-446655440000",
  "percentage": 0.5,
  "enabled": true,
  "created_at": "2024-02-01T10:30:00Z",
  "updated_at": "2024-02-15T14:22:00Z"
}