Skip to main content
PUT
/
v1
/
facilities
/
{facility_id}
Update Facility
const options = {
  method: 'PUT',
  headers: {
    'x-api-key': '<x-api-key>',
    'x-organization-id': '<x-organization-id>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: '<string>',
    address: '<string>',
    country: '<string>',
    type: '<string>',
    categories: {},
    cups_list: {},
    status: '<string>',
    logistic_factor: 123
  })
};

fetch('https://api.dcycle.io/v1/facilities/{facility_id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Update Facility

Update an existing facility in your organization. Only include the fields you want to change — all other fields remain unchanged.
Archiving Side Effects: Setting status to archived will also archive any linked logistic hub and deactivate associated supply contracts.

Request

Path Parameters

facility_id
uuid
required
The UUID of the facility to updateExample: 550e8400-e29b-41d4-a716-446655440000

Headers

x-api-key
string
required
Your API key for authentication
x-organization-id
string
required
Your organization UUID

Body Parameters

All fields are optional — only include what you want to change.
name
string
Facility name
address
string
Physical address
country
string
ISO country code
type
string
Facility type
categories
array[string]
Consumption categories
cups_list
array[string]
CUPS codes
status
string
Status: active or archived
logistic_factor
number
Logistic factor (0 to 1)

Response

Returns the updated facility object.

Example

curl -X PUT "https://api.dcycle.io/v1/facilities/550e8400-e29b-41d4-a716-446655440000" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Madrid HQ",
    "categories": ["heat", "electricity", "water", "recharge"]
  }'

Successful Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Madrid HQ",
  "type": "office",
  "country": "ES",
  "address": "Calle Gran Vía 1, Madrid",
  "status": "active",
  "co2e": 1250.5,
  "co2e_biomass": 0.0,
  "logistic_factor": 0.8,
  "categories": ["heat", "electricity", "water", "recharge"],
  "cups_list": ["ES0021000000000001AA"],
  "facility_purpose_type": "facilities",
  "created_at": "2024-11-24T10:30:00Z",
  "updated_at": "2024-12-01T15:45:00Z"
}