Flowion Docs

Environments

Environments group a charging station fleet within an organization (e.g. prod/staging) and are what command/read authorization is actually scoped to.

9 endpoints

Fleet-health counts for one environment.

get/v1/environments/{environment_id}/fleet-healthRequires a bearer token

Parameters

NameInTypeDescription
environment_id*pathstring<uuid>Environment id

Responses

StatusBodyDescription
200FleetHealthSummaryThe environment's fleet-health summary
401ErrorBodyMissing, invalid, or expired bearer token
404ErrorBodyNo environment with this id exists, or you cannot access it

Lists an organization's environments, paginated.

get/v1/organizations/{organization_id}/environmentsRequires a bearer token

Parameters

NameInTypeDescription
organization_id*pathstring<uuid>Organization id
pagequeryinteger<int32>1-indexed page number. Defaults to 1.
per_pagequeryinteger<int32>Environments per page, capped at 100. Defaults to 20.

Responses

StatusBodyDescription
200ListEnvironmentsResponseA page of the organization's environments
401ErrorBodyMissing, invalid, or expired bearer token
404ErrorBodyNo organization with this id exists, or the caller is not a member of it

Creates an environment in the organization. Requires the caller to be an Owner or Admin.

post/v1/organizations/{organization_id}/environmentsRequires a bearer token

Parameters

NameInTypeDescription
organization_id*pathstring<uuid>Organization id

Request bodyCreateEnvironmentRequest

FieldTypeDescription
name*string
slug*string

Responses

StatusBodyDescription
201EnvironmentSummaryThe newly created environment
401ErrorBodyMissing, invalid, or expired bearer token
403ErrorBodyThe caller is a member but not an Owner or Admin
404ErrorBodyNo organization with this id exists, or the caller is not a member of it
409ErrorBodyAn environment with this name or slug already exists in the organization

Fetches a single environment of an organization, by id.

get/v1/organizations/{organization_id}/environments/{environment_id}Requires a bearer token

Parameters

NameInTypeDescription
organization_id*pathstring<uuid>Organization id
environment_id*pathstring<uuid>Environment id

Responses

StatusBodyDescription
200EnvironmentSummaryThe environment
401ErrorBodyMissing, invalid, or expired bearer token
404ErrorBodyNo organization or environment with this id exists, or the caller is not a member of the organization

Updates an environment's settings — its `name` and/or `time_zone`.

patch/v1/organizations/{organization_id}/environments/{environment_id}Requires a bearer token

Requires the caller to be an Owner or Admin of the organization, the same "settings action" bucket as organizations::update::update_organization. Renaming never changes slug — see this module's doc comment.

Parameters

NameInTypeDescription
organization_id*pathstring<uuid>Organization id
environment_id*pathstring<uuid>Environment id

Request bodyUpdateEnvironmentRequest

FieldTypeDescription
namestring | nullNew name for the environment. Omit the field entirely to leave it unchanged; an explicit null is rejected rather than silently ignored, since name is NOT NULL on the row and has no "clear it" state. Does not change slug — see this module's doc comment. This borrows price_zone's Option<Option<T>> shape purely to tell a present null from an absent key, and then rejects the case price_zone accepts. Rejecting it in Deserialize instead would be shorter, but a deserialization failure is an axum JsonRejection: it answers 422 carrying axum's own error body, not the { error, message } every other rejection in this API returns since the Phase 7 hardening. Failing in the handler keeps one shape.
price_zonestring | nullWhich ENTSO-E bidding zone (EIC code) this environment's charging_stations should be priced against. Send null to clear it; omit the field entirely to leave it unchanged.
time_zonestring | nullThe IANA time zone (e.g. Europe/Stockholm) an operator reads this environment's timestamps in. Send null to clear it; omit the field entirely to leave it unchanged. Validated against the IANA database — see sites::update's equivalent field for why.

Responses

StatusBodyDescription
200EnvironmentSummaryThe updated environment
400ErrorBodyThe name is empty, too long, or explicitly null; the time zone is not an IANA name; or price_zone is included in the request
401ErrorBodyMissing, invalid, or expired bearer token
403ErrorBodyThe caller is a member but not an Owner or Admin
404ErrorBodyNo organization or environment with this id exists, or the caller cannot access it
409ErrorBodyAn environment with this name already exists in the organization

Deletes an environment. Requires the caller to be an Owner or Admin.

delete/v1/organizations/{organization_id}/environments/{environment_id}Requires a bearer token

Parameters

NameInTypeDescription
organization_id*pathstring<uuid>Organization id
environment_id*pathstring<uuid>Environment id

Responses

StatusBodyDescription
204The environment was deleted
401ErrorBodyMissing, invalid, or expired bearer token
403ErrorBodyThe caller is a member but not an Owner or Admin
404ErrorBodyNo organization or environment with this id exists, or the caller cannot access it
409ErrorBodyThe environment is the organization's default

Redesignates the organization's default environment. Idempotent when `environment_id` is already the default. Requires the caller to be an Owner or Admin.

post/v1/organizations/{organization_id}/environments/{environment_id}/defaultRequires a bearer token

Parameters

NameInTypeDescription
organization_id*pathstring<uuid>Organization id
environment_id*pathstring<uuid>Environment id

Responses

StatusBodyDescription
200EnvironmentSummaryThe updated (now-default) environment
401ErrorBodyMissing, invalid, or expired bearer token
403ErrorBodyThe caller is a member but not an Owner or Admin
404ErrorBodyNo organization or environment with this id exists, or the caller cannot access it

Fetches a single environment of an organization, by slug.

get/v1/organizations/{organization_id}/environments/by-slug/{slug}Requires a bearer token

Slugs are only unique within an organization (see migrations/0018_environments_slug.sql), so the lookup is scoped by organization_id directly rather than checked after the fact.

Parameters

NameInTypeDescription
organization_id*pathstring<uuid>Organization id
slug*pathstringEnvironment slug

Responses

StatusBodyDescription
200EnvironmentSummaryThe environment
401ErrorBodyMissing, invalid, or expired bearer token
404ErrorBodyNo organization with this id exists, no environment with this slug exists in it, or the caller is not a member of the organization

Fleet-health counts for every environment in the organization, one row each (including environments with zero charging_stations).

get/v1/organizations/{organization_id}/environments/fleet-healthRequires a bearer token

Parameters

NameInTypeDescription
organization_id*pathstring<uuid>Organization id

Responses

StatusBodyDescription
200ListFleetHealthResponseOne fleet-health summary per environment in the organization
401ErrorBodyMissing, invalid, or expired bearer token
404ErrorBodyNo organization with this id exists, or you are not a member of it