> ## Documentation Index
> Fetch the complete documentation index at: https://docs.declaw.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# File Info

> Get metadata for a file or directory inside a sandbox.

Returns metadata about a specific file or directory: its name, full path, type,
and size in bytes. Proxies the envd response status code — returns `404` if the
path does not exist.

## Path Parameters

<ParamField path="sandbox_id" type="string" required>
  The sandbox identifier. Format: `sbx-<8 chars>`.
</ParamField>

## Query Parameters

<ParamField query="path" type="string" required>
  Absolute path of the file or directory to inspect.

  Example: `/home/user/script.py`
</ParamField>

## Response

<ResponseField name="name" type="string">
  Filename or directory name (not the full path).
</ResponseField>

<ResponseField name="path" type="string">
  Full absolute path inside the sandbox.
</ResponseField>

<ResponseField name="type" type="string">
  Entry type: `"file"`, `"dir"`, or `"symlink"`.
</ResponseField>

<ResponseField name="size" type="integer">
  Size in bytes. `0` for directories.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.declaw.ai/sandboxes/sbx-a1b2c3d4/files/info?path=/home/user/script.py" \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```python Python theme={null}
  from declaw import Sandbox

  sbx = Sandbox.connect("sbx-a1b2c3d4", api_key="YOUR_API_KEY", domain="api.declaw.ai")
  info = sbx.files.get_info("/home/user/script.py")
  print(info.name, info.type, info.size)
  ```

  ```typescript TypeScript theme={null}
  import { Sandbox } from "@declaw/sdk";

  const sbx = await Sandbox.connect("sbx-a1b2c3d4", {
    apiKey: "YOUR_API_KEY",
    domain: "api.declaw.ai",
  });
  const info = await sbx.files.getInfo("/home/user/script.py");
  console.log(info.name, info.type, info.size);
  ```
</CodeGroup>

```json Response theme={null}
{
  "name": "script.py",
  "path": "/home/user/script.py",
  "type": "file",
  "size": 1024
}
```

## Error Responses

| Status | Cause                               |
| ------ | ----------------------------------- |
| `401`  | Missing or invalid API key          |
| `404`  | Path not found or sandbox not found |
| `502`  | envd daemon unreachable             |
| `503`  | Sandbox has no VM                   |
