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

# Get Records

Fetch records for a specific entity with optional filtering and token-based pagination. This endpoint is used by the AppFlow connector to pull data from Superleap during flow execution.

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication, [click here](https://app.superleap.com/settings/apiAccess) to generate one
</ParamField>

<ParamField header="Content-Type" type="string" default="application/json" required>
  application/json
</ParamField>

### Path Parameters

<ParamField path="object_slug" type="string" required>
  The entity identifier for the object (e.g., "lead", "user", "opportunity"). Use the [List Objects](/api-reference/appflow/list_objects) endpoint to discover available identifiers.
</ParamField>

### Body

<ParamField body="query" type="object" required>
  Query object containing field selection and filter parameters

  <Expandable title="Properties">
    <ParamField body="fields" type="string[]" required>
      List of field names to include in the response. Use the [Get Object](/api-reference/appflow/get_object) endpoint to discover available fields.

      <Expandable title="Example">
        ```json theme={null}
        ["name", "email", "phone", "created_at"]
        ```
      </Expandable>
    </ParamField>

    <ParamField body="filter" type="object">
      Filter conditions to apply to the query

      <Expandable title="Properties">
        <ParamField body="and" type="object[]">
          Array of conditions that must all be satisfied (AND logic)

          <Expandable title="Filter Condition">
            <ParamField body="field" type="string" required>
              Field name to filter on
            </ParamField>

            <ParamField body="operator" type="string" required>
              Comparison operator (e.g., `gte`, `lte`, `eq`)
            </ParamField>

            <ParamField body="value" type="any" required>
              Value to compare against
            </ParamField>
          </Expandable>
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="next_token" type="string">
  Pagination token returned from a previous response. Pass `null` for the first request. When the response includes a `next_token`, pass it in the next request to retrieve the following page of results.
</ParamField>

### Example Request

```bash theme={null}
curl --location --request POST 'https://app.superleap.com/api/v1/appflow/objects/lead/records' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SUPERSECRETREDACTEDKEY' \
--data '{
    "query": {
        "fields": [
            "name",
            "email"
        ],
        "filter": {
            "and": [
                {
                    "field": "updated_at",
                    "operator": "gte",
                    "value": 1757134404000
                }
            ]
        }
    },
    "next_token": null
}'
```

### Example Response

```json theme={null}
{
    "success": true,
    "data": {
        "records": [
            {
                "email": null,
                "id": "xk40vL_CrqDIiR6",
                "name": "Fakiyat",
                "updated_at": "2025-11-05T18:45:22.372Z"
            },
            {
                "email": null,
                "id": "xk40vL_lFM1am8Z",
                "name": "Fakiyat",
                "updated_at": "2025-11-05T18:45:22.372Z"
            },
            {
                "email": "asdf@gmail.com",
                "id": "xk40vL_myqHgKhu",
                "name": "Eric Collins",
                "updated_at": "2025-11-06T10:12:45.001Z"
            }
        ],
        "next_token": "eyJpZCI6InhrNDB2TF9xeUNuS1V6bCIsIm51bWJlcl9vZl9yZWNvcmRzIjozMDAwLCJ1cGRhdGVkX2F0IjoxNzcxNzA3MTU1NjgyfQ=="
    }
}
```

### Response Fields

| Field             | Type           | Description                                                                |
| ----------------- | -------------- | -------------------------------------------------------------------------- |
| `success`         | boolean        | Whether the request was successful                                         |
| `data.records`    | array          | List of record objects with the requested fields                           |
| `data.next_token` | string \| null | Pagination token for the next page. `null` when there are no more results. |

### Pagination

Records are returned in pages. When the response includes a non-null `next_token`:

1. Pass the `next_token` value in your next request to retrieve the following page
2. Continue paginating until `next_token` is `null`
3. Each page may contain up to 3000 records

### Incremental Sync

For incremental data syncs, filter by a timestamp field (e.g., `updated_at`) using the `gte` operator with a Unix timestamp in milliseconds. This allows you to fetch only records that have been modified since your last sync.

```json theme={null}
{
    "query": {
        "fields": ["name", "email"],
        "filter": {
            "and": [
                {
                    "field": "updated_at",
                    "operator": "gte",
                    "value": 1757134404000
                }
            ]
        }
    },
    "next_token": null
}
```
