Skip to main content

Plants

Manage generation plants for the authenticated customer. Each plant belongs to the customer tied to the Bearer API key.

Base path: /api/v0/plants/

Requires Bearer API key.


Data model (JSON)

FieldTypeRequired (create)Description
idUUIDSet by server.
namestringYesPlant name or external ID (unique per customer; often matches forecast plant codes).
latstring or numberYesLatitude, decimal degrees (e.g. 42.94972).
lonstring or numberYesLongitude, decimal degrees (e.g. -3.67893).
installed_capacity_mwstring or numberYesInstalled capacity (MW).
nominal_capacity_mwstring or numberYesNominal capacity (MW).
areastringYesRegion/map code (e.g. ESP).
technology_typestringYes"wind" or "solar".
last_training_cnn_atstringNoLast CNN training time, e.g. YYYY-MM-DD HH:MM, or empty.
last_training_trees_atstringNoLast tree-model training time, or empty.
agrupationstringYesOptional cluster for aggregated forecasts.
customer_display_namestringNoOptional label on this record.
timezonestringYesIANA timezone (e.g. Europe/Madrid).
created_atISO datetimeServer timestamps.
updated_atISO datetime

List plants

GET https://api.ravenwits.com/api/v0/plants/

Returns a JSON array of plant objects for the logged-in customer.

Request

curl --request GET \
--url 'https://api.ravenwits.com/api/v0/plants/' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your-api-key}'

Response

200 OK — array of plants, e.g.:

[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "NORTH_PLANT",
"lat": "42.9497200",
"lon": "-3.6789300",
"installed_capacity_mw": "18.000",
"nominal_capacity_mw": "18.000",
"area": "ESP",
"technology_type": "wind",
"last_training_cnn_at": "2025-01-15 08:30",
"last_training_trees_at": "",
"agrupation": "",
"customer_display_name": "",
"timezone": "Europe/Madrid",
"created_at": "2025-03-01T12:00:00Z",
"updated_at": "2025-03-01T12:00:00Z"
}
]

Create plant

POST https://api.ravenwits.com/api/v0/plants/

Body: JSON object with required fields (see table). Optional fields may be omitted or "".

Request

curl --request POST \
--url 'https://api.ravenwits.com/api/v0/plants/' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your-api-key}' \
--data '{
"name": "NORTH_PLANT",
"lat": 42.94972,
"lon": -3.67893,
"installed_capacity_mw": 18.0,
"nominal_capacity_mw": 18.0,
"area": "ESP",
"technology_type": "wind",
"last_training_cnn_at": "",
"last_training_trees_at": "",
"agrupation": "",
"customer_display_name": "",
"timezone": "Europe/Madrid"
}'

Response

201 Created — full plant object including id, created_at, updated_at.

400 Bad Request — validation errors (e.g. duplicate name for that customer).


Get one plant

GET https://api.ravenwits.com/api/v0/plants/{plant_id}/

plant_id is the plant UUID.


Update plant

PATCH https://api.ravenwits.com/api/v0/plants/{plant_id}/

Send only fields to change (partial update). To rename a plant, include the new name in the body.

PUT https://api.ravenwits.com/api/v0/plants/{plant_id}/

Full replacement: send all writable fields (same as create).

Request (PATCH example)

curl --request PATCH \
--url 'https://api.ravenwits.com/api/v0/plants/{plant_id}/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your-api-key}' \
--data '{"nominal_capacity_mw": 20.0, "last_training_cnn_at": "2025-03-14 10:00"}'

Response

200 OK — updated plant object.

404 Not Found — wrong UUID or plant belongs to another customer.


Delete plant

DELETE https://api.ravenwits.com/api/v0/plants/{plant_id}/

Permanently deletes the plant with the given UUID. Only plants owned by the authenticated customer can be deleted.

Request

curl --request DELETE \
--url 'https://api.ravenwits.com/api/v0/plants/{plant_id}/' \
--header 'Authorization: Bearer {your-api-key}'

Response

204 No Content — plant deleted, empty response body.

404 Not Found — wrong UUID or plant belongs to another customer:

{
"detail": "Not found."
}

Errors

StatusMeaning
403Missing or invalid Bearer API key.
404Plant not found or not owned by customer.
400Validation error (e.g. duplicate name, invalid technology_type).