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));import requests
url = "https://api.dcycle.io/v1/facilities/{facility_id}"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.dcycle.io/v1/facilities/{facility_id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"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": {},
"invoices_in_review_count": 123,
"categories_without_data": 123,
"water_type": {},
"methane_burned": {},
"wwt_line": {
"id": "<string>",
"line_code": "<string>"
},
"sludge_line": {
"id": "<string>",
"line_code": "<string>"
},
"wwd_line": {
"id": "<string>",
"line_code": "<string>"
}
}Get Facility
Retrieve a single facility by its ID
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));import requests
url = "https://api.dcycle.io/v1/facilities/{facility_id}"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.dcycle.io/v1/facilities/{facility_id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"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": {},
"invoices_in_review_count": 123,
"categories_without_data": 123,
"water_type": {},
"methane_burned": {},
"wwt_line": {
"id": "<string>",
"line_code": "<string>"
},
"sludge_line": {
"id": "<string>",
"line_code": "<string>"
},
"wwd_line": {
"id": "<string>",
"line_code": "<string>"
}
}Get Facility
Retrieve detailed information about a specific facility in your organization.Request
Path Parameters
uuid
required
The UUID of the facility to retrieveExample:
550e8400-e29b-41d4-a716-446655440000Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faResponse
string
Unique identifier (UUID)
string
Facility name
string | null
Physical address
string
ISO country code
string
Facility type
string
Status:
active or archivednumber | null
CO2e emissions in kg
number | null
CO2e from biomass
number | null
Logistic factor (0-1)
array[string] | null
Consumption categories
array[string] | null
CUPS codes
string | null
Purpose type
datetime
Creation timestamp
datetime | null
Last update timestamp
integer
Number of enabled invoices linked to this facility with
status='review',
across all categories (electricity, water, heat, recharge). Defaults to 0.integer
Number of configured consumption categories that have no enabled invoices. Defaults to
0.string | null
Water type of the waste water treatment line (only for
waste_water_facilities)boolean | null
Whether methane is burned (only for
waste_water_facilities)object | null
object | null
object | null
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}"
import requests
import os
headers = {
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID")
}
facility_id = "550e8400-e29b-41d4-a716-446655440000"
response = requests.get(
f"https://api.dcycle.io/v1/facilities/{facility_id}",
headers=headers
)
facility = response.json()
print(f"{facility['name']}: {facility['co2e'] or 0} kg CO2e")
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID
};
const facilityId = '550e8400-e29b-41d4-a716-446655440000';
axios.get(`https://api.dcycle.io/v1/facilities/${facilityId}`, { headers })
.then(response => console.log(response.data));
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",
"invoices_in_review_count": 0,
"categories_without_data": 0,
"water_type": null,
"methane_burned": null,
"wwt_line": null,
"sludge_line": null,
"wwd_line": null,
"created_at": "2024-11-24T10:30:00Z",
"updated_at": "2024-11-24T10:30:00Z"
}
Common Errors
401 Unauthorized
Cause: Missing or invalid API key{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
403 Forbidden
Cause: The user is not a member of the organization, or facility does not belong to the organization specified inx-organization-id
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
{
"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"
}
Related Endpoints
List Facilities
Retrieve all facilities
Update Facility
Modify facility details
Was this page helpful?