# List record files

List the files attached to one record, such as a signed contract on a deal. A file is listed only when the acting member can read both the record and the file.

POST https://api.brigg.app/v1/operations/records.ListRecordFiles

## Access & visibility

Allow `records.ListRecordFiles` on your API key.

**Acting member required.** Send `Brigg-Act-As` with an [approved member account ID](https://developer.brigg.app/authentication#member-delegation). The key supplies permissions; the member selects whose data is used.

The selected member must be active and approved by the credential. This selects whose private data is used; the credential supplies permissions. Private ownership and project boundaries still apply.

[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 |
| --- | --- | --- | --- |
| `record_id` | string | Yes | The record whose attached files to list. At least 1 character. |
| `limit` | integer | No | Maximum number of matching results to return. This operation does not provide a continuation cursor. Range: 1 to 500. |

## Response

Returns **200 OK** with a JSON body.

This operation has no continuation cursor. An empty `items` array means no matching visible results were returned.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `record_id` | string | Yes | The record the files are attached to. |
| `truncated` | boolean | Yes | True when the record has more files than this page holds. |
| `items` | array of [Attached file](#attached-file-response-items) | Yes | Files attached to the record that the acting member can read, newest first. truncated is true when the record has more files than limit. This operation has no cursor pagination. |

### Attached file · response.items[]

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `file_id` | string | Yes | The file's stable ID; the documents operations read and download it. |
| `filename` | string | Yes | The file's name as uploaded, with its extension. |
| `size_bytes` | number or null | Yes | The stored file's length, or null while it is being verified. |
| `content_type` | string or null | Yes | The stored file's media type, e.g. `application/pdf`. |
| `created_at` | number | Yes | Time the file was created, in Unix milliseconds. |

## 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. Supply Brigg-Act-As with a member authorized by the key’s delegation grant. The selected member must be active and approved by the credential. This selects whose private data is used; the credential supplies permissions. Private ownership and project boundaries still apply. |
| 404 | `not_found` | The record does not exist, was deleted, or is not readable with this credential and acting member. A known ID does not grant access. |
| 429 | `rate_limited` | Wait for Retry-After before retrying. |

## Next steps

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

## Examples

### Example request

Fictional values. Replace IDs and business details with values from your workspace.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/records.ListRecordFiles' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Brigg-Act-As: $BRIGG_ACT_AS" \
  --data-raw '{
  "record_id": "e_company_example"
}'
```

#### TypeScript


```typescript
const actAs = process.env.BRIGG_ACT_AS;
if (!actAs) throw new Error("Set BRIGG_ACT_AS to an approved member account ID.");

const response = await fetch("https://api.brigg.app/v1/operations/records.ListRecordFiles", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
    "Brigg-Act-As": actAs,
  },
  body: JSON.stringify({
    "record_id": "e_company_example"
  }),
});
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 = {
  "record_id": "e_company_example"
}
request = Request(
    "https://api.brigg.app/v1/operations/records.ListRecordFiles",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
        "Brigg-Act-As": os.environ["BRIGG_ACT_AS"],
    },
    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
{
  "record_id": "e_company_example",
  "truncated": false,
  "items": [
    {
      "file_id": "f_contract_example",
      "filename": "contract.pdf",
      "size_bytes": 48213,
      "content_type": "application/pdf",
      "created_at": 1794301200000
    }
  ]
}
```

## JSON schemas


```json-schema-request
{
  "type": "object",
  "properties": {
    "record_id": {
      "type": "string",
      "minLength": 1,
      "description": "The record whose attached files to list."
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 500,
      "description": "Maximum number of matching results to return. This operation does not provide a continuation cursor."
    }
  },
  "required": [
    "record_id"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "record_id": "e_company_example"
    }
  ]
}
```


```json-schema-response
{
  "type": "object",
  "properties": {
    "record_id": {
      "type": "string",
      "description": "The record the files are attached to."
    },
    "truncated": {
      "type": "boolean",
      "description": "True when the record has more files than this page holds."
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "description": "The file's stable ID; the documents operations read and download it."
          },
          "filename": {
            "type": "string",
            "description": "The file's name as uploaded, with its extension."
          },
          "size_bytes": {
            "type": [
              "number",
              "null"
            ],
            "description": "The stored file's length, or null while it is being verified."
          },
          "content_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "The stored file's media type, e.g. `application/pdf`."
          },
          "created_at": {
            "type": "number",
            "description": "Time the file was created, in Unix milliseconds."
          }
        },
        "required": [
          "file_id",
          "filename",
          "size_bytes",
          "content_type",
          "created_at"
        ],
        "additionalProperties": false,
        "title": "Attached file"
      },
      "description": "Files attached to the record that the acting member can read, newest first. truncated is true when the record has more files than limit. This operation has no cursor pagination."
    }
  },
  "required": [
    "record_id",
    "items",
    "truncated"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "record_id": "e_company_example",
      "truncated": false,
      "items": [
        {
          "file_id": "f_contract_example",
          "filename": "contract.pdf",
          "size_bytes": 48213,
          "content_type": "application/pdf",
          "created_at": 1794301200000
        }
      ]
    }
  ]
}
```

