Skip to main content
GET
/
v1
/
facilities
/
{facility_id}
Get Facility
const options = {
  method: 'GET',
  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));
{
  "id": "<string>",
  "name": "<string>",
  "address": {},
  "country": "<string>",
  "type": "<string>",
  "status": "<string>",
  "co2e": {},
  "co2e_biomass": {},
  "logistic_factor": {},
  "categories": {},
  "cups_list": {},
  "facility_purpose_type": {},
  "created_at": {},
  "updated_at": {}
}

Get Facility

Retrieve detailed information about a specific facility in your organization.

Request

Path Parameters

facility_id
uuid
required
The UUID of the facility to retrieveExample: 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

id
string
Unique identifier (UUID)
name
string
Facility name
address
string | null
Physical address
country
string
ISO country code
type
string
Facility type
status
string
Status: active or archived
co2e
number | null
CO2e emissions in kg
co2e_biomass
number | null
CO2e from biomass
logistic_factor
number | null
Logistic factor (0-1)
categories
array[string] | null
Consumption categories
cups_list
array[string] | null
CUPS codes
facility_purpose_type
string | null
Purpose type
created_at
datetime
Creation timestamp
updated_at
datetime | null
Last update timestamp

Example

curl -X GET "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

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Madrid Office",
  "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"],
  "cups_list": ["ES0021000000000001AA"],
  "facility_purpose_type": "facilities",
  "created_at": "2024-11-24T10:30:00Z",
  "updated_at": "2024-11-24T10:30:00Z"
}

Common Errors

403 Forbidden

Cause: Facility does not belong to the organization specified in x-organization-id
{
  "detail": "Facility doesn't belong to organization"
}

404 Not Found

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