A connection is an outside account linked to Lucra: a brand's ad accounts and Shopify store, or a creator's Instagram and TikTok.
provider | Who | Used for |
|---|---|---|
meta, tiktok, google, snapchat | Brand | Ad accounts campaigns run on |
shopify | Brand | Products and sample orders |
instagram, tiktok | Creator | Posts for organic programs |
GET /v1/connections lists them. People sign in to the platform themselves, but never to Lucra: send them to the url from POST /v1/connections with a provider (Shopify also needs shop, the store's .myshopify.com domain). Call it with the brand's key, a partner key with Lucra-Account: acct_… for a brand, or a partner key with Lucra-Account: crtr_… for a creator on its roster. The platform sends them back to your returnUrl (an https page on the key's embed origins) with status=connected or status=error; then wait for the connection.connected webhook or read GET /v1/connections. connection.expired means it needs reconnecting the same way.
Ad account setup
After an ad platform sign-in the connection is setup_needed. GET /v1/connections/:id/setup lists the ad accounts, pages, and identities the person can pick from; pass a pick (like businessCenterId) to list what's under it. Save the picks with PATCH /v1/connections/:id and selection. Disconnect with status: "disconnected".
Posts and syncs
As a creator, GET /v1/connections/:id/posts lists the posts Lucra mirrors from an account, and POST /v1/connections/:id/syncs mirrors them now. For a brand's Shopify connection, the same sync imports its catalog into products.
Hosted links
Stripe steps are connections too: provider: "stripe" sets up payouts (identity and bank until verified, then managing them; send country the first time for a creator) and provider: "card" adds or manages a brand's payment method. Everything around them, before and after, is in the API.
Endpoints
/v1/connections/:idGet a connection
lucra.connections.retrieve({ path: { id } })Path parameters
idstringrequired
Response20012 fieldsShow
idconn_…providerenumThe platform connected.
metatiktokgooglesnapchatshopifyinstagramstatusstringThe platform connection's state, e.g. connected, active, expired; a shop is connected or reconnect_required.
namestringnullableThe ad account, the shop domain, or the creator's handle.
handlestringnullableA creator's handle on the platform; null for a brand's connections.
avatarUrlstringnullableA short-lived link to a creator account's profile photo.
lastSyncedAtstringnullableerrorstringnullableWhy a creator account's last sync failed, e.g. token_expired.
activeCampaignsintegerLive campaigns (or ones needing attention) on an ad platform connection. Campaigns only; `canDisconnect` covers every reason a disconnect is refused.
canDisconnectbooleanWhether a disconnect would be accepted now: you manage the account's connections (or it's your own creator account), and no campaign, ad operation or ad plan is active on it.
createdAtstringupdatedAtstring
/v1/connections/:id/setupList an ad platform's accounts, pages and identities to pick from, and the ones picked
lucra.connections.setup.retrieve({ path: { id }, query })Path parameters
idstringrequired
Query parameters
adAccountIdstringThe ad account campaigns run in (Meta, Google, Snapchat).
advertiserIdstringTikTok's advertiser account.
businessCenterIdstringTikTok's business center; send it to list the advertisers under it.
businessIdstringMeta's business; send it to list the ad accounts and pages under it.
identityIdstringThe TikTok identity ads post as.
organizationIdstringSnapchat's organization; send it to list its ad accounts.
pageIdstringThe Facebook page Meta ads post as.
profileIdstringSnapchat's public profile ads post as.
/v1/connectionsList connected ad platforms, Shopify and creator social accounts
lucra.connections.list({ query })Query parameters
limitintegercursorstringcreatedAfterstringOnly items created at or after this time.
createdBeforestringOnly items created before this time.
Response200A page of items, 12 fields each, and nextCursorShow
idconn_…providerenumThe platform connected.
metatiktokgooglesnapchatshopifyinstagramstatusstringThe platform connection's state, e.g. connected, active, expired; a shop is connected or reconnect_required.
namestringnullableThe ad account, the shop domain, or the creator's handle.
handlestringnullableA creator's handle on the platform; null for a brand's connections.
avatarUrlstringnullableA short-lived link to a creator account's profile photo.
lastSyncedAtstringnullableerrorstringnullableWhy a creator account's last sync failed, e.g. token_expired.
activeCampaignsintegerLive campaigns (or ones needing attention) on an ad platform connection. Campaigns only; `canDisconnect` covers every reason a disconnect is refused.
canDisconnectbooleanWhether a disconnect would be accepted now: you manage the account's connections (or it's your own creator account), and no campaign, ad operation or ad plan is active on it.
createdAtstringupdatedAtstring
/v1/connections/:id/syncsSync a connected shop's catalog, or, as a creator, mirror a social account's posts now
lucra.connections.syncs.create({ path: { id } })Path parameters
idstringrequired
/v1/connectionsConnect a platform, payouts or a card: returns the hosted page to send the person to
lucra.connections.create({ body })Body
providerenumrequiredA brand connects meta, google, snapchat, tiktok or shopify; a creator (`Lucra-Account: crtr_…`) instagram or tiktok. stripe sets up payouts on Stripe (identity and bank until verified, then managing them), for a creator or the account itself; card adds or manages the card Lucra charges a brand.
metagooglesnapchattiktokinstagramshopifystripecardshopstringWith shopify: the store's domain, like acme.myshopify.com.
countryenumWith stripe, for a creator: their payout country, required the first time.
ATBEBGCAHRCYCZDKEEFIFRDEGRHUISIEITLVLILTLUMTNLNOPLPTROSKSIESSECHGBUSreturnUrlstringWhere the person comes back to, with `status=connected` or `status=error` added: your own https page (its origin must be on the key's embed origins), a page of the Lucra app (a path), or `lucra-creators:` for the Lucra iOS app. Defaults to a hosted done page (for stripe and card, the matching settings page).
checkoutenumWith card: hosted (the default) returns Stripe's page at `url` (its billing portal once a card is saved); elements returns `clientSecret` to save a new card in your own form with Stripe's Payment Element (Checkout elements, setup mode), which then replaces the card charged.
hostedelements
Response2013 fieldsShow
urlstringnullableSend the person here: they finish on the platform or Stripe, never on Lucra. The connection.connected (or creator.payouts_updated) webhook, or GET /v1/connections, shows the result. Null with `checkout: elements`.
clientSecretstringnullableWith card and `checkout: elements`: the Checkout Session's client secret for Stripe's Payment Element (`initCheckoutElementsSdk`); null otherwise. Stripe's setup webhook saves the card.
expiresAtstringnullableWhen the page stops working; null when it doesn't expire.
/v1/connections/:idPick a brand's ad account, page and identity after signing in, or disconnect a connection
lucra.connections.update({ path: { id }, body })Path parameters
idstringrequired
Body
statusstringDisconnects it: Lucra forgets the platform's tokens. An ad platform with live campaigns (see canDisconnect) is refused.
disconnectedselectionobjectA brand's ad platform picks, from GET /v1/connections/:id/setup: send the IDs it lists (e.g. adAccountId and pageId) to save them.
Show 8 child fieldsHide child fields
adAccountIdstringThe ad account campaigns run in (Meta, Google, Snapchat).
advertiserIdstringTikTok's advertiser account.
businessCenterIdstringTikTok's business center; send it to list the advertisers under it.
businessIdstringMeta's business; send it to list the ad accounts and pages under it.
identityIdstringThe TikTok identity ads post as.
organizationIdstringSnapchat's organization; send it to list its ad accounts.
pageIdstringThe Facebook page Meta ads post as.
profileIdstringSnapchat's public profile ads post as.
Response20012 fieldsShow
idconn_…providerenumThe platform connected.
metatiktokgooglesnapchatshopifyinstagramstatusstringThe platform connection's state, e.g. connected, active, expired; a shop is connected or reconnect_required.
namestringnullableThe ad account, the shop domain, or the creator's handle.
handlestringnullableA creator's handle on the platform; null for a brand's connections.
avatarUrlstringnullableA short-lived link to a creator account's profile photo.
lastSyncedAtstringnullableerrorstringnullableWhy a creator account's last sync failed, e.g. token_expired.
activeCampaignsintegerLive campaigns (or ones needing attention) on an ad platform connection. Campaigns only; `canDisconnect` covers every reason a disconnect is refused.
canDisconnectbooleanWhether a disconnect would be accepted now: you manage the account's connections (or it's your own creator account), and no campaign, ad operation or ad plan is active on it.
createdAtstringupdatedAtstring
/v1/connections/:id/postsList the posts Lucra mirrors from a creator's connected account, newest first
lucra.connections.posts.list({ path: { id } })Path parameters
idstringrequired
Response200A page of items, 12 fields each, and nextCursorShow
idstringThe post's ID on its platform.
platformenuminstagramtiktokurlstringnullabletitlestringnullablecaptionstringnullablepublishedAtstringnullabledurationLabelstringnullabledurationSecondsnumbernullablethumbnailUrlstringnullablevideoUrlstringnullablethumbnailImageobjectnullableShow 5 child fieldsHide child fields
fileIdstringnullableurlstringwidthnumbernullableheightnumbernullableblurHashstringnullable
metricsobjectnullableShow 6 child fieldsHide child fields
viewsnumberlikesnumbernullablecommentsnumbernullablesharesnumbernullablesavesnumbernullableengagementsnumbernullable