# ReadFile returns raw file content over HTTP; Stat exposes file metadata.


[API catalog](/reference/api/) · [Docker Sandboxes overview](/reference/api/sandboxes/latest/) · [Product manual](https://docs.docker.com/ai/sandboxes-api/) · [OpenAPI specification](/reference/api/sandboxes/api.yaml)

API version: v1


> This API is experimental. Features, interfaces,
> and behavior may change.




`GET /v1/files/content`

ReadFile returns raw file content over HTTP; Stat exposes file metadata.
Content above the unary message cap is refused, never truncated.

## Connection and access

[API connection and authentication guidance](/reference/api/sandboxes/latest/#authentication)


Server: `{endpoint}`

`endpoint`: The sandbox API base URL from Sandbox.core.endpoint.uri; preserve its path prefix when appending /v1 routes. HTTP endpoints require a scoped endpoint bearer; direct Unix sockets use socket access control.

Effective security: alternatives are OR; schemes within an alternative are AND. An empty array declares no HTTP authentication requirement.

```json
[
  {
    "sandboxBearer": []
  }
]
```

## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request GET \
  --header "Authorization: Bearer ${TOKEN}" \
  --header 'Accept: application/octet-stream' \
  'https://sandbox.invalid/v1/files/content?path=%3CPATH%3E'
```



## Parameters

### path

Location: query. Required: yes.

path is the sandbox path of a regular file.

```json
{
  "description": "path is the sandbox path of a regular file.",
  "in": "query",
  "name": "path",
  "pointer": "/paths/~1v1~1files~1content/get/parameters/0",
  "required": true,
  "schema": {
    "minLength": 1,
    "title": "path",
    "type": "string"
  }
}
```

## Request and responses

### Response 200 application/octet-stream

Success


Schema:

```json
{
  "contentMediaType": "application/octet-stream"
}
```



Headers:

```json
{
  "Content-Length": {
    "description": "Exact byte count of the complete file; this response does not use chunked transfer encoding.",
    "required": true,
    "schema": {
      "minimum": 0,
      "type": "integer"
    }
  }
}
```








### Response default application/json

The structured Error body identifies the failure with a stable code and optional typed details.


Schema:

```json
{
  "$ref": "#/components/schemas/Error"
}
```









Schema example:
```json
{
  "code": "notFound",
  "details": [],
  "message": "sandbox not found"
}
```


## Complete operation contract

```json
{
  "description": "ReadFile returns raw file content over HTTP; Stat exposes file metadata.\nContent above the unary message cap is refused, never truncated.",
  "operationId": "readFile",
  "parameters": [
    {
      "description": "path is the sandbox path of a regular file.",
      "in": "query",
      "name": "path",
      "required": true,
      "schema": {
        "minLength": 1,
        "title": "path",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/octet-stream": {
          "schema": {
            "contentMediaType": "application/octet-stream"
          }
        }
      },
      "description": "Success",
      "headers": {
        "Content-Length": {
          "description": "Exact byte count of the complete file; this response does not use chunked transfer encoding.",
          "required": true,
          "schema": {
            "minimum": 0,
            "type": "integer"
          }
        }
      }
    },
    "default": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "description": "The structured Error body identifies the failure with a stable code and optional typed details."
    }
  },
  "security": [
    {
      "sandboxBearer": []
    }
  ],
  "servers": [
    {
      "url": "{endpoint}",
      "variables": {
        "endpoint": {
          "default": "https://sandbox.invalid",
          "description": "The sandbox API base URL from Sandbox.core.endpoint.uri; preserve its path prefix when appending /v1 routes. HTTP endpoints require a scoped endpoint bearer; direct Unix sockets use socket access control."
        }
      }
    }
  ],
  "summary": "ReadFile returns raw file content over HTTP; Stat exposes file metadata.",
  "tags": [
    "Files"
  ],
  "x-sbx-authenticated-only": false,
  "x-sbx-conditional-permissions": [],
  "x-sbx-http-transfer": {
    "response": {
      "bytesField": "data",
      "mediaType": "application/octet-stream"
    }
  },
  "x-sbx-plane": "data",
  "x-sbx-request-schema": {
    "$ref": "#/components/schemas/FilesReadFileRequest"
  },
  "x-sbx-required-permissions": [
    "sandboxesFilesRead"
  ],
  "x-sbx-response-schema": {
    "$ref": "#/components/schemas/FilesReadFileResponse"
  },
  "x-sbx-serving-surface": "sandboxEndpoint"
}
```

## Referenced schemas

- [#/components/schemas/Error](/reference/api/sandboxes/latest/schemas/Error/)

- [#/components/schemas/FilesReadFileRequest](/reference/api/sandboxes/latest/schemas/FilesReadFileRequest/)

- [#/components/schemas/FilesReadFileResponse](/reference/api/sandboxes/latest/schemas/FilesReadFileResponse/)




