pex

Connectors API

Connect external platforms (Google Ads, HubSpot, Stripe, etc.) via OAuth, manage connections, and trigger data syncs. All endpoints require authentication except the OAuth callback.

List Connectors

GET/api/connectors

List all connected integrations for the current project

curl https://your-instance.com/api/connectors \ -H "x-api-key: apex_key_abc123"

Returns an array of connector objects:

[
  {
    "type": "google_ads",
    "status": "connected",
    "lastSync": "2025-01-15T10:00:00Z",
    "accountName": "Acme Corp Ads",
    "connectedAt": "2025-01-01T08:00:00Z"
  }
]

Connect a Platform

POST/api/connectors

Register a new connector configuration

ParameterTypeDescription
typerequiredstringConnector type: google_ads, google_analytics, hubspot, stripe, meta_ads, linkedin_ads, quickbooks
credentialsobjectAPI key credentials for non-OAuth connectors

Info

Most connectors use OAuth and should be connected through the OAuth flow below rather than this endpoint directly.

Disconnect a Platform

DELETE/api/connectors

Remove a connector and revoke stored credentials

ParameterTypeDescription
typerequiredstringConnector type to disconnect
curl -X DELETE https://your-instance.com/api/connectors \ -H "Content-Type: application/json" \ -H "x-api-key: apex_key_abc123" \ -d '{ "type": "google_ads" }'

OAuth Flow

Start Authorization

GET/api/connectors/:type/auth

Redirect user to the platform's OAuth consent screen

ParameterTypeDescription
typerequiredstringConnector type (path parameter)

Open this URL in the browser to initiate the OAuth flow. The user is redirected to the platform (e.g. Google, HubSpot) to grant access, then returned to the callback URL.

https://your-instance.com/api/connectors/google_ads/auth

OAuth Callback

GET/api/connectors/:type/callback

Receives the OAuth authorization code and exchanges it for tokens

Warning

This endpoint is called by the OAuth provider after the user grants access. Do not call it directly.

On success, the user is redirected to the dashboard sensors page with the connector shown as connected.

Trigger Sync

GET/api/sync/run

Trigger a data sync for all connected connectors

curl "https://your-instance.com/api/sync/run" \ -H "x-api-key: apex_key_abc123"

Initiates a sync across all connected platforms. Returns immediately with a sync job ID. Data flows into the analytics pipeline asynchronously.

{
  "status": "started",
  "syncId": "sync_789",
  "connectors": ["google_ads", "hubspot", "stripe"]
}

Tip

Syncs run automatically on a schedule. Use this endpoint to trigger an immediate refresh after connecting a new platform or when you need up-to-date data.