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
| Name | In | Type | Description |
|---|---|---|---|
| environment_id* | path | string<uuid> | Environment id |
Responses
| Status | Body | Description |
|---|---|---|
| 200 | FleetHealthSummary | The environment's fleet-health summary |
| 401 | ErrorBody | Missing, invalid, or expired bearer token |
| 404 | ErrorBody | No 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
| Name | In | Type | Description |
|---|---|---|---|
| organization_id* | path | string<uuid> | Organization id |
| page | query | integer<int32> | 1-indexed page number. Defaults to 1. |
| per_page | query | integer<int32> | Environments per page, capped at 100. Defaults to 20. |
Responses
| Status | Body | Description |
|---|---|---|
| 200 | ListEnvironmentsResponse | A page of the organization's environments |
| 401 | ErrorBody | Missing, invalid, or expired bearer token |
| 404 | ErrorBody | No 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
| Name | In | Type | Description |
|---|---|---|---|
| organization_id* | path | string<uuid> | Organization id |
Request bodyCreateEnvironmentRequest
| Field | Type | Description |
|---|---|---|
| name* | string | — |
| slug* | string | — |
Responses
| Status | Body | Description |
|---|---|---|
| 201 | EnvironmentSummary | The newly created environment |
| 401 | ErrorBody | Missing, invalid, or expired bearer token |
| 403 | ErrorBody | The caller is a member but not an Owner or Admin |
| 404 | ErrorBody | No organization with this id exists, or the caller is not a member of it |
| 409 | ErrorBody | An 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
| Name | In | Type | Description |
|---|---|---|---|
| organization_id* | path | string<uuid> | Organization id |
| environment_id* | path | string<uuid> | Environment id |
Responses
| Status | Body | Description |
|---|---|---|
| 200 | EnvironmentSummary | The environment |
| 401 | ErrorBody | Missing, invalid, or expired bearer token |
| 404 | ErrorBody | No 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
| Name | In | Type | Description |
|---|---|---|---|
| organization_id* | path | string<uuid> | Organization id |
| environment_id* | path | string<uuid> | Environment id |
Request bodyUpdateEnvironmentRequest
| Field | Type | Description |
|---|---|---|
| name | string | null | New 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_zone | string | null | Which 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_zone | string | null | The 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
| Status | Body | Description |
|---|---|---|
| 200 | EnvironmentSummary | The updated environment |
| 400 | ErrorBody | The name is empty, too long, or explicitly null; the time zone is not an IANA name; or price_zone is included in the request |
| 401 | ErrorBody | Missing, invalid, or expired bearer token |
| 403 | ErrorBody | The caller is a member but not an Owner or Admin |
| 404 | ErrorBody | No organization or environment with this id exists, or the caller cannot access it |
| 409 | ErrorBody | An 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
| Name | In | Type | Description |
|---|---|---|---|
| organization_id* | path | string<uuid> | Organization id |
| environment_id* | path | string<uuid> | Environment id |
Responses
| Status | Body | Description |
|---|---|---|
| 204 | — | The environment was deleted |
| 401 | ErrorBody | Missing, invalid, or expired bearer token |
| 403 | ErrorBody | The caller is a member but not an Owner or Admin |
| 404 | ErrorBody | No organization or environment with this id exists, or the caller cannot access it |
| 409 | ErrorBody | The 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
| Name | In | Type | Description |
|---|---|---|---|
| organization_id* | path | string<uuid> | Organization id |
| environment_id* | path | string<uuid> | Environment id |
Responses
| Status | Body | Description |
|---|---|---|
| 200 | EnvironmentSummary | The updated (now-default) environment |
| 401 | ErrorBody | Missing, invalid, or expired bearer token |
| 403 | ErrorBody | The caller is a member but not an Owner or Admin |
| 404 | ErrorBody | No 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
| Name | In | Type | Description |
|---|---|---|---|
| organization_id* | path | string<uuid> | Organization id |
| slug* | path | string | Environment slug |
Responses
| Status | Body | Description |
|---|---|---|
| 200 | EnvironmentSummary | The environment |
| 401 | ErrorBody | Missing, invalid, or expired bearer token |
| 404 | ErrorBody | No 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
| Name | In | Type | Description |
|---|---|---|---|
| organization_id* | path | string<uuid> | Organization id |
Responses
| Status | Body | Description |
|---|---|---|
| 200 | ListFleetHealthResponse | One fleet-health summary per environment in the organization |
| 401 | ErrorBody | Missing, invalid, or expired bearer token |
| 404 | ErrorBody | No organization with this id exists, or you are not a member of it |