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

# Integrations API

> Inspect and manage integration connection status.

## GET /v1/integrations

List all integrations configured for the current workspace.

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.flokit.ai/v1/integrations \
    -H "Authorization: Bearer $FLOKIT_API_KEY"
  ```

  ```typescript Node.js / TypeScript theme={null}
  const response = await fetch('https://api.flokit.ai/v1/integrations', {
    headers: {
      'Authorization': `Bearer ${process.env.FLOKIT_API_KEY}`,
    },
  });

  const data = await response.json();
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "integrations": [
    {
      "id": "int_01hx4j7revenuecat",
      "type": "revenuecat",
      "status": "connected",
      "last_synced_at": "2024-03-15T13:00:00Z",
      "error_message": null
    },
    {
      "id": "int_01hx4j7appsflyer",
      "type": "appsflyer",
      "status": "connected",
      "last_synced_at": "2024-03-15T12:45:00Z",
      "error_message": null
    },
    {
      "id": "int_01hx4j7stripe",
      "type": "stripe",
      "status": "error",
      "last_synced_at": "2024-03-14T22:00:00Z",
      "error_message": "Webhook signature verification failed — check your signing secret"
    }
  ]
}
```

### Integration object fields

| Field            | Type           | Description                                                                                                                |
| ---------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `id`             | string         | Unique integration identifier                                                                                              |
| `type`           | string         | Integration type: `revenuecat`, `adapty`, `appsflyer`, `adjust`, `stripe`, `app_store_connect`, `google_play`, `warehouse` |
| `status`         | string         | `connected`, `error`, `syncing`, or `disconnected`                                                                         |
| `last_synced_at` | string         | ISO 8601 timestamp of the last successful sync                                                                             |
| `error_message`  | string \| null | Error detail when `status` is `error`; `null` otherwise                                                                    |

***

## GET /v1/integrations/{id}

Get full details for a specific integration, including sync statistics.

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.flokit.ai/v1/integrations/int_01hx4j7revenuecat \
    -H "Authorization: Bearer $FLOKIT_API_KEY"
  ```

  ```typescript Node.js / TypeScript theme={null}
  const integrationId = 'int_01hx4j7revenuecat';

  const response = await fetch(
    `https://api.flokit.ai/v1/integrations/${integrationId}`,
    {
      headers: {
        'Authorization': `Bearer ${process.env.FLOKIT_API_KEY}`,
      },
    }
  );

  const data = await response.json();
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "integration": {
    "id": "int_01hx4j7revenuecat",
    "type": "revenuecat",
    "status": "connected",
    "last_synced_at": "2024-03-15T13:00:00Z",
    "error_message": null,
    "sync_stats": {
      "events_last_24h": 4821,
      "events_total": 1204739,
      "earliest_event_at": "2023-08-01T00:00:00Z"
    }
  }
}
```

***

## POST /v1/integrations/{id}/sync

Trigger a manual sync for an integration. Useful after configuration changes or to recover from a sync error without waiting for the next scheduled sync.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.flokit.ai/v1/integrations/int_01hx4j7stripe/sync \
    -H "Authorization: Bearer $FLOKIT_API_KEY"
  ```

  ```typescript Node.js / TypeScript theme={null}
  const response = await fetch(
    `https://api.flokit.ai/v1/integrations/${integrationId}/sync`,
    {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${process.env.FLOKIT_API_KEY}`,
      },
    }
  );

  const data = await response.json();
  // { status: 'ok', sync_id: 'sync_01hx4j7k...' }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "status": "ok",
  "sync_id": "sync_01hx4j7k9m2n3p5q6r8s"
}
```

The sync runs asynchronously. Check the integration status via `GET /v1/integrations/{id}` or subscribe to `integration.error` webhooks to be notified of sync failures.
