# Get file

Read file metadata under the caller's current file and record permissions. This never returns a storage key or a download credential.

POST https://api.brigg.app/v1/operations/documents.GetFile

## Access & visibility

Allow `documents.GetFile` on your API key.

**Workspace access by default.** Private member data requires [approved member delegation](https://developer.brigg.app/authentication#member-delegation) through `Brigg-Act-As`; the key supplies permissions while private ownership and project boundaries remain enforced.

[Set up authentication](https://developer.brigg.app/authentication) · [Choose permissions](https://developer.brigg.app/permissions)

## Request fields

Send a JSON object with the following fields. Required fields must be included; omit optional fields you do not need.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `file_id` | string | Yes | Use a file_id returned by this listing or by CompleteUpload. It is not an upload ID, storage path or filename. [documents.ListDocuments](https://developer.brigg.app/reference/documents/ListDocuments). At least 1 character. |

## Metadata, content and scan readiness

This reads metadata only. Use [Get file download](https://developer.brigg.app/reference/documents/GetFileDownload) to obtain a temporary binary download URL, or [Read text document](https://developer.brigg.app/reference/documents/ReadTextDocument) for collaborative text content.

`scan_status` can be `clean`, `threats_found`, `unsupported`, `failed` or null. Null means no verdict is recorded; it is **not** proof that the file is safe or ready. It can occur for content without a binary, legacy content, or a scan that has not reported yet. The download operation checks current readiness and access again.

A threat, unsupported scan or failed scan is not fixed by retrying the same download in a tight loop. Use its returned error to distinguish pending work from a blocked file. Never infer that a non-null size or a successful metadata read authorizes access to bytes.

## Response

Returns **200 OK** with a JSON body.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `file_id` | string | Yes | Stable file ID returned by documents.CompleteUpload, documents.ListDocuments or a document creation operation. Use the same ID for downloads, attachments and supported file-based workflows. Do not use a filename or storage path. |
| `filename` | string | Yes | Original filename, including its extension. |
| `content_type` | string or null | Yes | Media type of the file, such as application/pdf. Null when no binary file exists. |
| `size_bytes` | number or null | Yes | File size in bytes. Null for a document without a downloadable binary file. |
| `visibility` | string | Yes | Who may read the completed file. Personal files belong to the approved acting member; workspace files use shared access. Allowed: `"personal"`, `"workspace"`. |
| `scan_status` | string or null | Yes | Recorded scan verdict: clean, threats_found, unsupported, failed, or null when no verdict is recorded. Null does not guarantee download readiness; GetFileDownload rechecks the current scan and permissions. |

## Errors & retries

This operation reads data. It needs no idempotency key and can be retried after a transient failure.

For rate limits, follow the server’s retry guidance and back off. See [HTTP errors](https://developer.brigg.app/http#errors) and [safe retries and limits](https://developer.brigg.app/reliability).

| HTTP status | Code | What to do |
| --- | --- | --- |
| 400 | `invalid_json` | Send a JSON object with Content-Type: application/json. |
| 400 | `invalid_input` | Check the request fields and types. |
| 401 | `invalid_key` | The workspace API key is missing, invalid or revoked. |
| 403 | `forbidden` | Check the key’s operation and resource grants. If Brigg-Act-As is supplied, the key must be authorized to delegate to that member. |
| 404 | `not_found` | The requested operation or resource is not available to this credential. |
| 429 | `rate_limited` | Wait for Retry-After before retrying. |

## Next steps

- [Get file download](https://developer.brigg.app/reference/documents/GetFileDownload)
- [Read text document](https://developer.brigg.app/reference/documents/ReadTextDocument)
- [List documents](https://developer.brigg.app/reference/documents/ListDocuments)

[Download OpenAPI](https://developer.brigg.app/openapi.json) · [Versioning & retirement](https://developer.brigg.app/versioning)

## Examples

### Uploaded PDF metadata

A binary file with a recorded clean scan. Request a fresh download URL separately.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/documents.GetFile' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "file_id": "f_agreement"
}'
```

#### TypeScript


```typescript
const response = await fetch("https://api.brigg.app/v1/operations/documents.GetFile", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "file_id": "f_agreement"
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error} — ${result.message}`);
console.log(result);
```

#### Python


```python
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError

payload = {
  "file_id": "f_agreement"
}
request = Request(
    "https://api.brigg.app/v1/operations/documents.GetFile",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urlopen(request) as response:
        print(json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))
    raise
```

#### Response example


```json
{
  "file_id": "f_agreement",
  "filename": "Agreement.pdf",
  "content_type": "application/pdf",
  "size_bytes": 48231,
  "visibility": "workspace",
  "scan_status": "clean"
}
```

### Document without binary metadata

Null is unknown or inapplicable metadata, not a zero-byte PDF. Read collaborative content through ReadTextDocument when applicable.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/documents.GetFile' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "file_id": "f_notes"
}'
```

#### TypeScript


```typescript
const response = await fetch("https://api.brigg.app/v1/operations/documents.GetFile", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "file_id": "f_notes"
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error} — ${result.message}`);
console.log(result);
```

#### Python


```python
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError

payload = {
  "file_id": "f_notes"
}
request = Request(
    "https://api.brigg.app/v1/operations/documents.GetFile",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urlopen(request) as response:
        print(json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))
    raise
```

#### Response example


```json
{
  "file_id": "f_notes",
  "filename": "Project notes",
  "content_type": null,
  "size_bytes": null,
  "visibility": "personal",
  "scan_status": null
}
```

## JSON schemas


```json-schema-request
{
  "type": "object",
  "properties": {
    "file_id": {
      "type": "string",
      "minLength": 1,
      "description": "Use a file_id returned by this listing or by CompleteUpload. It is not an upload ID, storage path or filename. [documents.ListDocuments](https://developer.brigg.app/reference/documents/ListDocuments)."
    }
  },
  "required": [
    "file_id"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "file_id": "f_agreement"
    }
  ]
}
```


```json-schema-response
{
  "type": "object",
  "properties": {
    "file_id": {
      "type": "string",
      "description": "Stable file ID returned by documents.CompleteUpload, documents.ListDocuments or a document creation operation. Use the same ID for downloads, attachments and supported file-based workflows. Do not use a filename or storage path."
    },
    "filename": {
      "type": "string",
      "description": "Original filename, including its extension."
    },
    "content_type": {
      "type": [
        "string",
        "null"
      ],
      "description": "Media type of the file, such as application/pdf. Null when no binary file exists."
    },
    "size_bytes": {
      "type": [
        "number",
        "null"
      ],
      "description": "File size in bytes. Null for a document without a downloadable binary file."
    },
    "visibility": {
      "type": "string",
      "enum": [
        "personal",
        "workspace"
      ],
      "description": "Who may read the completed file. Personal files belong to the approved acting member; workspace files use shared access."
    },
    "scan_status": {
      "type": [
        "string",
        "null"
      ],
      "description": "Recorded scan verdict: clean, threats_found, unsupported, failed, or null when no verdict is recorded. Null does not guarantee download readiness; GetFileDownload rechecks the current scan and permissions."
    }
  },
  "required": [
    "file_id",
    "filename",
    "content_type",
    "size_bytes",
    "visibility",
    "scan_status"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "file_id": "f_agreement",
      "filename": "Agreement.pdf",
      "content_type": "application/pdf",
      "size_bytes": 48231,
      "visibility": "workspace",
      "scan_status": "clean"
    }
  ]
}
```

