# Get sync diagnostics

> The work queued, in flight, locked and waiting for a rescrape per app and table of a sync, and how much of it is stuck.

Source: https://docs.stacksync.com/api-reference/syncs/get_sync_diagnostics

`GET https://api.stacksync.com/v1/workspaces/{workspace_id}/bases/{base_id}/diagnostics`

- Operation: `get_sync_diagnostics`
- Resource: Syncs
- Access: read-only

## Authentication

- `Authorization: Bearer <key>`: A workspace API key (workspace_…, created by a workspace owner under Workspace settings > Stacksync API) acts with editor rights on that workspace only; a user API key (user_…, created under Profile > Stacksync API) acts as that user in every workspace they belong to. POST, PUT and PATCH requests must send Content-Type: application/json. Every authentication failure answers 403.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | integer | Yes | The workspace. List the ones your key can reach with GET /v1/workspaces. |
| `base_id` | string (uuid) | Yes | The sync. |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `region` | string (besg \| usnv) | Yes | The region of the sync |
| `stuck_threshold_in_seconds` | integer, at least 1, default 3600 | No | Work older than this is counted as stuck, in seconds |

## Returns

### 200 OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `base_id` | string | Yes |  |
| `stuck_threshold_in_seconds` | integer | Yes |  |
| `apps` | array of object (BaseAppDiagnostics) | Yes |  |
| `apps[].app_id` | string | Yes |  |
| `apps[].tables` | array of object (BaseTableDiagnostics) | Yes |  |
| `apps[].tables[].table_mapping_id` | string | Yes |  |
| `apps[].tables[].table_name` | string | Yes |  |
| `apps[].tables[].change_queue_count` | integer \| null | No |  |
| `apps[].tables[].change_queue_future_count` | integer \| null | No |  |
| `apps[].tables[].change_queue_stuck_count` | integer \| null | No |  |
| `apps[].tables[].ongoing_write_count` | integer \| null | No |  |
| `apps[].tables[].ongoing_write_stuck_count` | integer \| null | No |  |
| `apps[].tables[].record_locks_count` | integer \| null | No |  |
| `apps[].tables[].record_locks_stuck_count` | integer \| null | No |  |
| `apps[].tables[].rescrape_count` | integer \| null | No |  |
| `apps[].tables[].rescrape_stuck_count` | integer \| null | No |  |

## Example request

```bash
curl -X GET "https://api.stacksync.com/v1/workspaces/{workspace_id}/bases/{base_id}/diagnostics?region=besg" \
  -H "Authorization: Bearer $STACKSYNC_API_KEY"
```

## Example response (200)

```json
{
  "base_id": "<base_id>",
  "stuck_threshold_in_seconds": 0,
  "apps": [
    {
      "app_id": "<app_id>",
      "tables": [
        {
          "table_mapping_id": "<table_mapping_id>",
          "table_name": "<table_name>",
          "change_queue_count": 0,
          "change_queue_future_count": 0,
          "change_queue_stuck_count": 0,
          "ongoing_write_count": 0,
          "ongoing_write_stuck_count": 0,
          "record_locks_count": 0,
          "record_locks_stuck_count": 0,
          "rescrape_count": 0,
          "rescrape_stuck_count": 0
        }
      ]
    }
  ]
}
```

## Errors

| Status | Meaning | Body |
| --- | --- | --- |
| 400 | Bad Request | `{ "error": string, "msg": string, "field": string \| null }` |
| 403 | Forbidden | `{ "error": string, "msg": string, "field": string \| null }` |
| 404 | Not Found | `{ "error": string, "msg": string, "field": string \| null }` |

## Related

- [API Reference overview](https://docs.stacksync.com/api-reference): base URLs, regions, pagination, idempotency and errors
- [Authentication](https://docs.stacksync.com/api-reference/authentication): API keys and the 403 answers
- OpenAPI document: https://docs.stacksync.com/openapi.json
- [List syncs](https://docs.stacksync.com/api-reference/syncs/list_syncs)
- [Get a sync](https://docs.stacksync.com/api-reference/syncs/get_sync)
- [Get the status of a sync](https://docs.stacksync.com/api-reference/syncs/get_sync_status)
- [Get sync metrics](https://docs.stacksync.com/api-reference/syncs/get_sync_metrics)
- [Create a sync](https://docs.stacksync.com/api-reference/syncs/create_sync)
- [Update sync settings](https://docs.stacksync.com/api-reference/syncs/update_sync_settings)
- [Edit a sync](https://docs.stacksync.com/api-reference/syncs/edit_sync)
- [Delete a sync](https://docs.stacksync.com/api-reference/syncs/delete_sync)
- [Rename a sync](https://docs.stacksync.com/api-reference/syncs/rename_sync)
- [Switch a sync on or off](https://docs.stacksync.com/api-reference/syncs/switch_sync)
- [Set the change capture method](https://docs.stacksync.com/api-reference/syncs/set_sync_app_cdc_method)
- [Set the rate limit of an app](https://docs.stacksync.com/api-reference/syncs/set_sync_app_rate_limit)
- [Set Salesforce Bulk API access](https://docs.stacksync.com/api-reference/syncs/set_sync_app_bulk_api_access)
- [Set delete protection of an app](https://docs.stacksync.com/api-reference/syncs/set_sync_app_delete_protection)