Skip to content
techrace/
TECHRACE DOCUMENTATION

Connect accounts

Send your customer through the platform's own login once; Techrace stores and renews the access for you.

The connect flow

  1. Your server calls POST /connect-sessions with the profile, the provider and your return_url.
  2. Send the customer's browser (redirect or popup) to the returned url. The link expires after a short time and works once.
  3. The customer approves the permissions on the platform's screen and, where needed, picks Pages, accounts or channels.
  4. Techrace sends them back to return_url and emits account.connected for each new connection.
curl -X POST "https://YOUR_DOMAIN/api/v1/projects/$TECHRACE_PROJECT_ID/connect-sessions" \
  -H "Authorization: Bearer $TECHRACE_API_KEY" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "customer_id": "8f1c2a4e-6b3d-4e21-9a77-1d0c5b2e9f10",
  "provider": "facebook",
  "return_url": "https://your-app.com/integrations/done"
}
EOF
Response
JSON
{
  "id": "0a6f2c9d-1e4b-4d73-9f58-7b3e2a1c8d05",
  "url": "https://YOUR_DOMAIN/connect#token=cs_…",
  "expires_at": "2026-11-14T10:15:00.000Z"
}

Request fields

FieldTypeRequiredDescription
customer_iduuidYesThe profile the connection belongs to
providerstringYesfacebook, instagram, threads, metaads, youtube, gmail, googleads or searchconsole
return_urlURLYesWhere the customer lands afterwards. https, or http://localhost (any port) while testing; no #fragment
reconnect_connection_iduuidNoRenew an existing connection instead of adding one
google_ads_manager_id10 digitsNoGoogle Ads only: connect through a manager account
google_ads_customer_id10 digitsNoGoogle Ads only: a specific client account

Reading the result on return_url

OutcomeQuery parameters
Connected?connected=facebook&customer_id=…&connection_id=…
Cancelled?error=access_denied&provider=facebook
Link expired?error=expired&provider=facebook
Something failed?error=failed&provider=facebook

Reconnect and disconnect

When a token stops working, calls return 409 account_reconnection_required and your webhook receives account.disconnected. Create a new connect link with reconnect_connection_id to renew it in place:

curl -X POST "https://YOUR_DOMAIN/api/v1/projects/$TECHRACE_PROJECT_ID/connect-sessions" \
  -H "Authorization: Bearer $TECHRACE_API_KEY" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "customer_id": "$CUSTOMER_ID",
  "provider": "facebook",
  "return_url": "https://your-app.com/integrations/done",
  "reconnect_connection_id": "$CONNECTION_ID"
}
EOF