List managed environments in the current workspace with cursor pagination.
Endpoint
GET /agents/environments
Lists managed environments in the current workspace with cursor pagination. A successful call returns 200 and a list envelope.
Request parameters
| Field | Required | Type | Description |
|---|---|---|---|
limit | No | integer | Number of items per page, default 20, range 1–100 |
order | No | string | Sort direction, asc or desc, default desc |
after | No | string | The last_id from the previous page; the cursor item is excluded |
type | No | string | Environment type; openai_hosted or bailian_hosted; the value is validated but does not filter results, so do not rely on it to distinguish managed environments |
before currently returns 400.
Request example
Response example
Response fields
| Field | Type | Description |
|---|---|---|
object | string | List object type, fixed as list |
data | array | Environments on the current page; can be empty |
first_id | string / null | ID of the first item on the page; null for an empty page |
last_id | string / null | ID of the last item on the page; null for an empty page |
has_more | boolean | Whether the current direction has another page |
Error codes
| HTTP status | Error type / code | Solution |
|---|---|---|
400 | invalid_request_error / invalid_request_error | Fix limit and order as described in the query parameters, and remove before |
401 | invalid_request_error / workspace_required or user_required | Use an API key for the current workspace |
{"error":{"type","code","message","param"}}. Gateway errors can use a different structure.