# List records

List the records of one type, with filtering, sorting and cursor pagination. Returns the same records and fields as the type's own list operation, and needs that operation in the credential's permissions as well. A type outside the credential's permissions is refused, never returned as an empty list.

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

## Access & visibility

Allow `records.ListRecords` 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 |
| --- | --- | --- | --- |
| `filters` | array of [object](#request-filters) | No | Conditions combined with AND. Address business fields as data.<field>, for example data.name. |
| `sort` | [object](#request-sort) | No | Sort order for the results. Defaults to updated_at descending, with id as a tie-breaker. |
| `limit` | integer | No | Maximum number of results to return in this page. Continue with next_cursor when returned. Greater than 0. |
| `cursor` | string | No | Copy next_cursor from the preceding response. Keep the same filters, sort and credential. At least 1 character. |
| `type` | string | Yes | Qualified type name from records.ListRecordTypes, e.g. `core:Company`. At least 1 character. |

### request.filters[]

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | string | Yes | What to compare: `id`, `created_at`, `updated_at`, `created_by`, `private`, or `data.<field>` with a field the type's `data_schema` names. At least 1 character. |
| `op` | string | Yes | Comparison operator. Use in with an array, or omit value for is_empty and is_not_empty. Allowed: `"eq"`, `"neq"`, `"contains"`, `"starts_with"`, `"gt"`, `"gte"`, `"lt"`, `"lte"`, `"in"`, `"has"`, `"is_empty"`, `"is_not_empty"`. |
| `value` | string or number or boolean or null or array of string or number or boolean or null | No | What to compare against. Omit for is_empty and is_not_empty; pass an array for in. |

### request.sort

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | string | Yes | What to order by: `id`, `created_at`, `updated_at`, `created_by`, `private`, or `data.<field>` with a field the type's `data_schema` names. At least 1 character. |
| `direction` | string | No | Sort direction: asc for ascending or desc for descending. Allowed: `"asc"`, `"desc"`. |

## Response

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

An empty `items` array means this page contains no matching visible results. Follow `next_cursor` when present.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | string | Yes | The qualified type the record belongs to, e.g. `core:Company`. |
| `items` | array of [Record](#record-response-items) | Yes | Records of the requested type visible under the credential's grants and the acting member's access, matching the requested filters. Pass next_cursor as cursor to continue when a next cursor is returned. |
| `next_cursor` | string | No | Pass this value as cursor to continue with the same filters, sort and credential. Omitted when there are no more results. |

### Record · response.items[]

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The record's stable ID. |
| `created_at` | number | Yes | Time the record was created, in Unix milliseconds. |
| `updated_at` | number | Yes | Time the record most recently changed, in Unix milliseconds. |
| `created_by` | string or null | Yes | Account that created the record, or null. |
| `private` | boolean | Yes | True when only the record's owner can see it. |
| `data` | map of JSON values | Yes | The record's fields: exactly those the type's own read operation returns, under the same names. |

## Pagination

Pass `next_cursor` as `cursor` on the next request, keeping the same query and acting identity. Stop when `next_cursor` is absent. Treat the cursor as opaque; never construct or edit it.

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

const query = {
  "type": "core:Company",
  "filters": [
    {
      "field": "data.city",
      "op": "eq",
      "value": "Oslo"
    }
  ],
  "limit": 10
};
let cursor;
do {
  const response = await fetch("https://api.brigg.app/v1/operations/records.ListRecords", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
      "Content-Type": "application/json",
      "Brigg-Act-As": actAs,
    },
    body: JSON.stringify({ ...query, ...(cursor ? { cursor } : {}) }),
  });
  const page = await response.json();
  if (!response.ok) throw new Error(`${response.status}: ${page.message}`);
  for (const item of page.items) {
    console.log(item); // Process or upsert each result.
  }
  cursor = page.next_cursor;
} while (cursor);
```


## 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` | No record type has this name in the workspace. Read the names with records.ListRecordTypes. |
| 429 | `rate_limited` | Wait for Retry-After before retrying. |
| 403 | `type_not_granted` | The credential's permissions do not include this record type together with the type's own list operation. Approve both, then retry; this is a permission, not an empty result. |
| 403 | `type_not_published` | This record type has no published read. Types declared by a workspace's own apps are not available through this operation. |

## 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.ListRecords' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Brigg-Act-As: $BRIGG_ACT_AS" \
  --data-raw '{
  "type": "core:Company",
  "filters": [
    {
      "field": "data.city",
      "op": "eq",
      "value": "Oslo"
    }
  ],
  "limit": 10
}'
```

#### 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.ListRecords", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
    "Brigg-Act-As": actAs,
  },
  body: JSON.stringify({
    "type": "core:Company",
    "filters": [
      {
        "field": "data.city",
        "op": "eq",
        "value": "Oslo"
      }
    ],
    "limit": 10
  }),
});
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 = {
  "type": "core:Company",
  "filters": [
    {
      "field": "data.city",
      "op": "eq",
      "value": "Oslo"
    }
  ],
  "limit": 10
}
request = Request(
    "https://api.brigg.app/v1/operations/records.ListRecords",
    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
{
  "type": "core:Company",
  "items": [
    {
      "id": "e_company_example",
      "created_at": 1794301200000,
      "updated_at": 1794301200000,
      "created_by": null,
      "private": false,
      "data": {
        "name": "Example AS",
        "city": "Oslo"
      }
    }
  ]
}
```

## JSON schemas


```json-schema-request
{
  "type": "object",
  "properties": {
    "filters": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "minLength": 1,
            "description": "What to compare: `id`, `created_at`, `updated_at`, `created_by`, `private`, or `data.<field>` with a field the type's `data_schema` names."
          },
          "op": {
            "type": "string",
            "enum": [
              "eq",
              "neq",
              "contains",
              "starts_with",
              "gt",
              "gte",
              "lt",
              "lte",
              "in",
              "has",
              "is_empty",
              "is_not_empty"
            ],
            "description": "Comparison operator. Use in with an array, or omit value for is_empty and is_not_empty."
          },
          "value": {
            "anyOf": [
              {
                "type": [
                  "string",
                  "number",
                  "boolean",
                  "null"
                ]
              },
              {
                "type": "array",
                "items": {
                  "type": [
                    "string",
                    "number",
                    "boolean",
                    "null"
                  ]
                }
              }
            ],
            "description": "What to compare against. Omit for is_empty and is_not_empty; pass an array for in."
          }
        },
        "required": [
          "field",
          "op"
        ],
        "additionalProperties": false
      },
      "description": "Conditions combined with AND. Address business fields as data.<field>, for example data.name."
    },
    "sort": {
      "type": "object",
      "properties": {
        "field": {
          "type": "string",
          "minLength": 1,
          "description": "What to order by: `id`, `created_at`, `updated_at`, `created_by`, `private`, or `data.<field>` with a field the type's `data_schema` names."
        },
        "direction": {
          "type": "string",
          "enum": [
            "asc",
            "desc"
          ],
          "description": "Sort direction: asc for ascending or desc for descending."
        }
      },
      "required": [
        "field"
      ],
      "additionalProperties": false,
      "description": "Sort order for the results. Defaults to updated_at descending, with id as a tie-breaker."
    },
    "limit": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "description": "Maximum number of results to return in this page. Continue with next_cursor when returned."
    },
    "cursor": {
      "type": "string",
      "minLength": 1,
      "description": "Copy next_cursor from the preceding response. Keep the same filters, sort and credential."
    },
    "type": {
      "type": "string",
      "minLength": 1,
      "description": "Qualified type name from records.ListRecordTypes, e.g. `core:Company`."
    }
  },
  "required": [
    "type"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "type": "core:Company",
      "filters": [
        {
          "field": "data.city",
          "op": "eq",
          "value": "Oslo"
        }
      ],
      "limit": 10
    }
  ]
}
```


```json-schema-response
{
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "description": "The qualified type the record belongs to, e.g. `core:Company`."
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The record's stable ID."
          },
          "created_at": {
            "type": "number",
            "description": "Time the record was created, in Unix milliseconds."
          },
          "updated_at": {
            "type": "number",
            "description": "Time the record most recently changed, in Unix milliseconds."
          },
          "created_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account that created the record, or null."
          },
          "private": {
            "type": "boolean",
            "description": "True when only the record's owner can see it."
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "The record's fields: exactly those the type's own read operation returns, under the same names."
          }
        },
        "required": [
          "id",
          "created_at",
          "updated_at",
          "created_by",
          "private",
          "data"
        ],
        "additionalProperties": false,
        "title": "Record"
      },
      "description": "Records of the requested type visible under the credential's grants and the acting member's access, matching the requested filters. Pass next_cursor as cursor to continue when a next cursor is returned."
    },
    "next_cursor": {
      "type": "string",
      "description": "Pass this value as cursor to continue with the same filters, sort and credential. Omitted when there are no more results."
    }
  },
  "required": [
    "type",
    "items"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "type": "core:Company",
      "items": [
        {
          "id": "e_company_example",
          "created_at": 1794301200000,
          "updated_at": 1794301200000,
          "created_by": null,
          "private": false,
          "data": {
            "name": "Example AS",
            "city": "Oslo"
          }
        }
      ]
    }
  ]
}
```

