# List entities for a sync

URL: https://docs.sparklayer.io/ignite/api/list-entities
Operation: `GET /v1/{siteEnv}/{siteId}/sync/{syncDataType}` (operationId `getPage`)
OpenAPI spec: https://docs.sparklayer.io/openapi/ignite.yaml

SparkLayer calls this endpoint during a full sync to page through every entity of the given type. Return one page of entities and a `next_page` value; SparkLayer requests the next page with it in the `page` query parameter. Return an empty string or `null` for `next_page` to end the sync.

`GET /v1/{siteEnv}/{siteId}/sync/{syncDataType}`

> This is an Ignite endpoint: your integration service implements it and SparkLayer calls it.

### Request SparkLayer sends

```http
GET /v1/live/bobs-store/sync/products HTTP/1.1
Host: ignite.example.com
```

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `siteEnv` | string | Yes | The SparkLayer environment the request is for, such as `live`. Store it, with the site ID, when SparkLayer connects your platform. Example: `live` |
| `siteId` | string | Yes | The SparkLayer site ID the request is for, such as `bobs-store`. Store it, with the environment, when SparkLayer connects your platform. Length: min 1. Example: `bobs-store` |
| `syncDataType` | "customers" \| "products" \| "purchases" \| "stock" | Yes | The type of entity to list. Example: `products` |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | string | | The page number to return |

### Responses your service returns

#### 200: A list of entity ids

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | object[] | | |
| `items[].id` | string | | The id of the entity |
| `items[].payload` | string \| null | | Optional - the payload to send back to the integration during the item sync |
| `next_page` | string \| null | | The next page id of entity ids. An empty string or null ends the full sync. |

```json
{
  "items": [
    {
      "id": "<id>",
      "payload": "<payload>"
    }
  ],
  "next_page": "<next_page>"
}
```

#### 422: Unprocessable entity

`application/problem+json`: the standard error body (below).

#### 429: Rate limit exceeded

#### 500: Internal server error

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `api_response` | string | | API response error for sync log |
| `friendly_error` | string | | Friendly error message to display in sync log |
| `external_url` | string | | A url to access to problem on |
| `visible_name` | string | | A display name for the problem |

```json
{
  "api_response": "<api_response>",
  "friendly_error": "<friendly_error>",
  "external_url": "<external_url>",
  "visible_name": "<visible_name>"
}
```

### Error body

Error responses with a body use this RFC 7807 problem details object. See [Errors](https://docs.sparklayer.io/developers/errors.md) for every status code and which errors to retry.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | string (uri) | Yes | A URI reference that identifies the problem. |
| `title` | string | Yes | A short, human-readable summary of the problem type. |
| `status` | integer | | The HTTP status code generated by the origin server for this occurrence of the problem. |
| `detail` | string | | A human-readable explanation specific to this occurrence of the problem. |

```json
{
  "type": "about:blank",
  "title": "invalid-request-contents",
  "status": 0,
  "detail": "<detail>"
}
```
