GET
GET /agents/environments/{environment_id}/files — OpenAI API
OpenAI API key (required); https://api.openai.com/v1
OpenAI APIList agent environment files
- Base URL
- https://api.openai.com/v1
- Auth
- Authorization: Bearer <OPENAI_API_KEY>
- Last verified
- 2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 266 tokens · Vary: Accept
→ 266 tokens · Vary: Accept
Critical gotchas
The Responses API is the primary interface for new text and tool workflows; Chat Completions remains a separate compatibility API.
Audio transcription uploads use multipart form data rather than a JSON request body.
cURL
curl -X GET 'https://api.openai.com/v1/agents/environments/environment-id/files?path=example-path&limit=10&order=asc&page=example-page' \ -H "Authorization: Bearer $OPENAI_API_KEY"
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| environment_id | path | string | Yes | The ID of the environment. |
| path | query | string | No | Restrict the listing to this absolute workspace directory. |
| limit | query | integer | No | The maximum number of files to return, between 1 and 100. |
| order | query | string | No | Sort by case-sensitive path components. Defaults to descending. |
| page | query | string | No | The opaque token from the previous page. Keep the same path, order, and limit. |
Response 200 OK
{
"object": "page",
"data": [
{
"object": "agent.environment.file",
"environment_id": "string",
"path": "string",
"size_bytes": 0
}
],
"next": "string",
"has_more": true
} Get a free OpenAI API key → sponsored Affiliate link - we may earn a commission, at no extra cost to you.