Skip to main content
DELETE
/
v1
/
facilities
/
{facility_id}
Delete Facility
const options = {
  method: 'DELETE',
  headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};

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

Delete Facility

Soft-delete a facility from your organization. The facility is marked as disabled (enabled=false) and associated supply contracts are deactivated.
Side Effects: Deleting a facility will deactivate all linked supply contracts and trigger a DELETE_FACILITY event for downstream processing.

Request

Path Parameters

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

Headers

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

Response

Returns HTTP 204 No Content on successful deletion. No response body.

Example

curl -X DELETE "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}"

Successful Response

HTTP/1.1 204 No Content

Common Errors

403 Forbidden

Cause: Facility does not belong to the organization
{
  "detail": "Facility doesn't belong to organization"
}

404 Not Found

Cause: Facility not found
{
  "code": "NOT_FOUND",
  "detail": "Facility with id=UUID('...') not found"
}

Best Practices

Consider archiving a facility instead of deleting if you want to preserve historical data:
# Archive instead of delete
response = requests.put(
    f"https://api.dcycle.io/v1/facilities/{facility_id}",
    headers=headers,
    json={"status": "archived"}
)