# Environments

Generated from contract version `1.0.0` — the same document [`/v1/api/openapi.json`](/api/openapi/) serves.

## Prerequisites

- An API key in `x-api-key`, or a browser session cookie
- `X-Organization-Id` naming the workspace to act in, unless the session already has an active one
- The base URL for your deployment, `https://server.hlix.ai` by default

## Operations

| Method | Path | Operation |
| --- | --- | --- |
| `GET` | `/v1/api/environments/project/{projectId}` | [List a project's environments](#list-a-projects-environments) |
| `POST` | `/v1/api/environments/project/{projectId}` | [Create an environment](#create-an-environment) |
| `DELETE` | `/v1/api/environments/project/{projectId}/{id}` | [Delete an environment](#delete-an-environment) |
| `PATCH` | `/v1/api/environments/project/{projectId}/{id}` | [Update an environment](#update-an-environment) |

## List a project's environments

`GET /v1/api/environments/project/{projectId}` · operation ID `listProjectEnvironments`

**Parameters**

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | **yes** | string |  |
| `X-Organization-Id` | header | no | string | The workspace (organization) to act in. Omitted, the session's active organization is used. |

**Responses**

| Status | Body | Description |
| --- | --- | --- |
| `200` | Environment[] | Every environment on the project, active or not. |
| `400` | ApiError | The request named no active organization. |
| `401` | ApiError | No valid session or API key. |
| `403` | ApiError | Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project. |
| `404` | ApiError | The resource does not exist, or the caller is a task-scoped credential and this endpoint is outside its allowlist. |

## Create an environment

`POST /v1/api/environments/project/{projectId}` · operation ID `createProjectEnvironment`

**Parameters**

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | **yes** | string |  |
| `X-Organization-Id` | header | no | string | The workspace (organization) to act in. Omitted, the session's active organization is used. |

**Request body** — `application/json`, `CreateEnvironment` (required)

| Property | Type | Required | Notes |
| --- | --- | --- | --- |
| `config` | object | **yes** |  |
| `isActive` | boolean | no |  |
| `label` | string | **yes** | min length 1, max length 100 |

**Responses**

| Status | Body | Description |
| --- | --- | --- |
| `201` | Environment | The stored environment. |
| `400` | ValidationError \| ApiError | The JSON body failed schema validation (`ValidationError`), or the request named no active organization (`ApiError`). |
| `401` | ApiError | No valid session or API key. |
| `403` | ApiError | Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project. |
| `404` | ApiError | No such project in this workspace. A project belonging to ANOTHER workspace answers the same 404 — its existence is not confirmed. |
| `500` | ApiError | The environment could not be written. |

## Delete an environment

`DELETE /v1/api/environments/project/{projectId}/{id}` · operation ID `deleteProjectEnvironment`

**Parameters**

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | **yes** | string |  |
| `id` | path | **yes** | string |  |
| `X-Organization-Id` | header | no | string | The workspace (organization) to act in. Omitted, the session's active organization is used. |

**Responses**

| Status | Body | Description |
| --- | --- | --- |
| `200` | DeletedAck | The environment is gone. Deleting one that was never there answers the same 200 — the call is idempotent. |
| `400` | ApiError | The request named no active organization. |
| `401` | ApiError | No valid session or API key. |
| `403` | ApiError | Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project. |
| `404` | ApiError | The resource does not exist, or the caller is a task-scoped credential and this endpoint is outside its allowlist. |

## Update an environment

`PATCH /v1/api/environments/project/{projectId}/{id}` · operation ID `updateProjectEnvironment`

**Parameters**

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | **yes** | string |  |
| `id` | path | **yes** | string |  |
| `X-Organization-Id` | header | no | string | The workspace (organization) to act in. Omitted, the session's active organization is used. |

**Request body** — `application/json`, `UpdateEnvironment` (required)

| Property | Type | Required | Notes |
| --- | --- | --- | --- |
| `config` | object | no |  |
| `isActive` | boolean | no |  |
| `label` | string | no | min length 1, max length 100 |

**Responses**

| Status | Body | Description |
| --- | --- | --- |
| `200` | Environment | The updated environment. |
| `400` | ValidationError \| ApiError | The JSON body failed schema validation (`ValidationError`), or the request named no active organization (`ApiError`). |
| `401` | ApiError | No valid session or API key. |
| `403` | ApiError | Authenticated, but not a member of the named organization — or a client collaborator without the required access on this project. |
| `404` | ApiError | No such environment in this workspace. |

## If a request fails

These apply to every operation on this page.

- `400` — the body failed schema validation, or the request named no active organization. A `ValidationError` body carries the failing fields; an `ApiError` body carries only `error`.
- `401` — no valid session or API key.
- `403` — authenticated, but not a member of the named organization, or a client collaborator without the required access.
- `404` — no such resource **in this workspace**. Absent and not-visible are deliberately the same answer; do not infer cross-tenant existence from it.
- `409` — the expected revision or state is stale, or another operation currently owns the transition.
- `500` — the operation failed server-side. Retry only where an idempotency key makes that safe.

## Next steps

[API reference](/api/reference/)
  [API & OpenAPI](/api/openapi/)
  [TypeScript SDK](/sdk/typescript/)
  [CLI reference](/reference/cli/)