Skip to main content

Data sources

By default, listening collections use Lantfly's own scrapers. Data sources let you add your own official API keys so collections can read more, and more steadily, from the platforms that offer an API. Open Settings → Data sources.

Only the owner and admins of an account manage data sources. Other members see a note to ask an admin.

Providers​

ProviderPlatformWhat you enter
YouTube Data APIYouTubeAPI key from your Google Cloud project
Instagram Graph APIInstagramAccess token and Instagram Business Account ID of your own Business or Creator account (through Facebook Login)
Reddit APIRedditClient ID and Client secret of your own Reddit app (a script or web app from reddit.com/prefs/apps)
Scraping vendorSeveral platformsAn API token of a supported third-party scraping vendor, used as a paid fallback

Add a key​

  1. Click Add data source.
  2. Pick the Provider, give the key a Name (for example "Marketing key"), and paste the secret fields.
  3. Click Add.

Secrets are stored encrypted. After saving, only the end of each value is shown, and they are never shown again. To change a secret, edit the key and paste the new value; fields you leave empty keep their value.

Check now tests a key right away and shows its status and, when the provider reports it, its usage and reset time.

Key status​

StatusMeaning
okThe key works.
exhaustedIts quota or credit is used up, until the provider's reset (or a recheck every 10 minutes when the reset is unknown).
invalidThe provider refused it. It is rechecked every 10 minutes.
cooldownTemporary errors; it is retried after a pause that grows up to 6 hours.

A key that is not ok is skipped and comes back on its own when a check succeeds. The list also shows when each key was Last used and Last checked, and its last error.

Order and switching​

Keys of a provider are tried from top to bottom; change their Order in the list. Under Which key, choose:

OptionBehavior
In order, next one on failureAlways the first working key in the order; the next one only when it fails. The default.
Rotate between keysEach run starts with the next working key, to spread quota across keys.
Only the chosen keyOne key per provider, never switches.

Under When every key of a provider is unusable, choose Go on with the free ways (the collection carries on with Lantfly's own scrapers, the default) or Stop and report it (the source ends with a status naming the provider, so you know to add or top up a key).

Prefer the vendor first puts the paid scraping vendor first instead of last. It is faster and steadier when platforms block a lot, but every collection then uses the vendor's credit. A listening project can override this in its own settings, and you can pick a key for a single collection when you collect now.

API​

RequestWhat it does
GET /api/v3/data-sourcesKeys (masked) with their status, the providers and their fields, and the settings
POST /api/v3/data-sourcesAdd a key: provider (youtube_api, instagram_graph, reddit, …), label, secret, optional priority, is_enabled
PATCH /api/v3/data-sources/:idChange label, is_enabled, priority or secret fields
DELETE /api/v3/data-sources/:idRemove a key
PATCH /api/v3/data-sources/priorities{ "ids": [...] } in the order to try them
PUT /api/v3/data-sources/settingscredential_mode (failover, round_robin, pinned), pinned_credentials, on_keys_exhausted (continue, stop), prefer_vendor
POST /api/v3/data-sources/credentials/:id/checkTest a key now
Add a YouTube Data API key
curl -s -X POST "https://lantfly.com/api/v3/data-sources" \
-H "Authorization: Bearer $LANTFLY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"provider": "youtube_api",
"label": "Marketing key",
"secret": { "api_key": "YOUR_YOUTUBE_API_KEY" }
}'

See Listening for how collections use these keys.