Skip to main content

List environment templates

List environment templates in the current workspace with cursor pagination.

Endpoint

GET /agents/environments/templates Returns 200 and a list envelope.

Query parameters

limit integer (optional)Number of items per page, default 20; 1..100 is recommendedorder string (optional)Sort direction, asc or desc, defaults to descafter string (optional)The last_id from the previous page; the cursor item is excludedbefore string (optional)The first_id from the previous page, for reverse pagination; cannot be used with afterPassing both after and before returns 400. An invalid cursor or a missing template returns 404.

Request example

curl -sS "$BASE_URL/agents/environments/templates?limit=20&order=desc" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "OpenAI-Beta: agents=v1"

Response fields

object stringList object type, fixed as listdata arrayEnvironment templates on this page; [] when emptyfirst_id string / nullFirst item ID on this page; null for an empty pagelast_id string / nullLast item ID on this page; null for an empty page; use it as afterhas_more booleanWhether the current scan direction has another pageEach template in data[] contains id, object, name, created_at, updated_at, packages, network, desktop, capability_directories, skills, plugins, and files. Field meanings are the same as in Retrieve an environment template.

Response example

{
  "object": "list",
  "data": [
    {
      "id": "envtmpl_xxx",
      "name": "example-template",
      "object": "agent.environment.template",
      "created_at": 1794452344,
      "updated_at": 1794452344,
      "packages": {"python": [], "system": [], "npm": []},
      "network": {"access": "disabled", "allowed_domains": []},
      "desktop": {"enabled": false},
      "capability_directories": ["/workspace/skills"],
      "skills": [],
      "plugins": [],
      "files": []
    }
  ],
  "first_id": "envtmpl_xxx",
  "last_id": "envtmpl_xxx",
  "has_more": false
}

Error codes

HTTP statusError type / codeSolution
400invalid_request_error / invalid_request_errorFix limit, order, after, or before as described in the query parameters
401authentication_error / invalid_api_keySend a valid Authorization: Bearer $DASHSCOPE_API_KEY header
404not_found_error / not_found_errorUse a valid cursor in the current collection
500server_error / server_errorRetry later. If it keeps failing, submit a ticket with x-request-id