Overview
Prerequisites
- An API key for authentication.
- The connector slug for the source type (e.g.
facebook-ads). See List Source Connectors.
Step 1: Create a draft source with a callback webhook
Create the source withdraft: true. Only connector_slug is required for a draft — you (or a third party) fill in the rest later.
Optionally attach a callback_webhook: Nekt POSTs to it once the third party finishes filling in the configuration through the setup link. Use the optional custom header to authenticate the call on your side.
callback_webhook object
callback_webhook is write-only. Responses never echo it back; they expose a read-only boolean has_callback_webhook so you can confirm one is configured. To remove a configured webhook, send "callback_webhook": null on an update.Step 2: Create a setup token
Generate a time-limited token scoped to this draft source, then build the link ashttps://app.nekt.ai/scl/{token} and share it with the third party.
The full
token is returned only on creation. When listing tokens it is redacted. To revoke a link, delete the token: DELETE /api/v1/sources/{source_slug}/setup-tokens/{id}/.Step 3: The third party fills in the configuration
The recipient openshttps://app.nekt.ai/scl/{token} and enters the connector credentials (or authenticates via OAuth for connectors that support it). No Nekt account is required, and the link is scoped strictly to this draft source.
When they submit, Nekt POSTs to your callback_webhook (if configured):
Use
config_completed to decide whether you can proceed to validation, or whether you need to send another setup link to collect the remaining fields.
Step 4: Validate the connector configuration
Start a validation for the draft source. This confirms the credentials work and discovers the available streams. The validation uses the configuration already saved on the draft (from the setup link), so you don’t need to send a request body.You may optionally pass
{ "config": { ... } } to merge extra fields into the saved configuration before validating.id with status in_progress. Poll it until the status is success or failed:
Step 5: Finalize the source
Once validation succeeds, complete the source by settingdraft: false along with the streams, output layer, and trigger. See Update Source for the full set of fields.
Setup tokens stop working once the source leaves draft. Any unused link for this source is invalidated when you finalize it.
Customize the OAuth flow
For OAuth connectors (Facebook Ads, Google Analytics GA4, and similar), you can drive the entire setup over the API instead of sharing a setup link, with one exception: the OAuth consent step. The provider’s login and “Authorize” screen must be opened in a browser by a human once per connected account. The authorization code must be exchanged through Nekt’s OAuth endpoints. The app’sclient_id/client_secret and the registered redirect URIs belong to Nekt, so you cannot exchange the code for a token on your own — the exchange has to go through Nekt’s callback.
The steps below use Facebook Ads as the example. For GA4, swap tap-facebook-ads for tap-google-analytics-ga4.
1
Create a draft source
Authenticate with your API key. Create the source with
draft: true and the connector slug.2
Open the consent screen in a browser
A human opens the initiate URL, which redirects to the provider’s login and authorize screen. Pass your own return URL as
redirect_uri.3
Capture the return
After the user authorizes, the provider redirects to your
redirect_uri with ?code=...&state=.... Store both values.4
Exchange the code for a token
Call the callback endpoint with the The response returns the
code, state, and the same redirect_uri from step 2. This call uses a user token, not your API key.access_token, refresh_token, and related fields.5
Save the token on the source
Authenticate with your API key. Patch the draft source with the
refresh_token from the previous step.Nekt injects the
client_id/client_secret at runtime, so you don’t need to send them.6
Validate
Start a validation, then poll it until the status is
success (see Step 4 above).7
Finalize the source
Patch the source with
draft: false plus the streams, output layer, and trigger (see Step 5 above). You can then Trigger Source to start the first extraction.