Accounts

Create a connect link

Create a one-time hosted link your user opens to connect a social account through OAuth, without a Relaycast login.

POST https://social-publish-api.onrender.com/v1/accounts/connect-links

Lets your own users connect their social accounts to your project from inside your app. You create a link, send your user to its url, they approve access on the platform's consent screen, and Relaycast sends them back to your redirectUrl with the result. Your users never need a Relaycast account.

  1. Your server calls this endpoint and gets a url.
  2. Your app redirects the user (or opens a popup) to that url.
  3. The user signs in to the platform and approves access.
  4. Relaycast redirects to your redirectUrl with status=connected and the new accountId, or status=error and an error code.
  5. Publish to the account with its id, as with any other account.

A link works once and expires after expiresInMinutes. Create a new link each time a user wants to connect. To show your own app name and logo on the consent screen instead of Relaycast's, connect through your own OAuth app with oauthAppId.

Treat the url like a password until it's used: anyone who opens it can connect an account to your project. Create links on your server, never in client-side code, so your API key stays private.

Headers

HeaderRequiredDescription
x-access-keyYes*Your API key. *Or send Authorization: Bearer <key>.
content-typeYesapplication/json

Body

FieldTypeRequiredDescription
platformstringYesAny OAuth platform, for example youtube, facebook, instagram, linkedin, tiktok. Bluesky uses Connect Bluesky instead.
redirectUrlstringYesWhere to send the user when they're done. Must be https (http is allowed for localhost only). Up to 2,048 characters. Your own query parameters are kept.
statestringNoAny value up to 500 characters, returned unchanged to redirectUrl. Use it to match the result to your user or session.
groupIdstringNoPut the new account(s) in this social group.
oauthAppIdstringNoConnect through one of your project's own OAuth apps for this platform.
viastringNoAlternative connect flow. facebook connects Instagram through Facebook Login (Instagram professional accounts linked to a Facebook Page).
expiresInMinutesintegerNo5 to 10,080 (7 days). Default 60.

Request

curl -X POST https://social-publish-api.onrender.com/v1/accounts/connect-links \
  -H "x-access-key: $RELAYCAST_API_KEY" \
  -H "content-type: application/json" \
  -d '{ "platform": "youtube", "redirectUrl": "https://app.example.com/integrations/done", "state": "user_42" }'
const res = await fetch("https://social-publish-api.onrender.com/v1/accounts/connect-links", {
  method: "POST",
  headers: {
    "x-access-key": process.env.RELAYCAST_API_KEY!,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    platform: "youtube",
    redirectUrl: "https://app.example.com/integrations/done",
    state: "user_42",
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const { data: link } = await res.json();
// Send your user to link.url
import os, requests

res = requests.post(
    "https://social-publish-api.onrender.com/v1/accounts/connect-links",
    headers={"x-access-key": os.environ["RELAYCAST_API_KEY"]},
    json={"platform": "youtube", "redirectUrl": "https://app.example.com/integrations/done", "state": "user_42"},
)
res.raise_for_status()
link = res.json()["data"]  # send your user to link["url"]

Response

Response 201
{
  "data": {
    "id": "5b0c7e1a-2f3d-4c5b-8a9e-1d2c3b4a5f6e",
    "url": "https://social-publish-kappa.vercel.app/connect/3q2-Xb8…",
    "platform": "youtube",
    "status": "pending",
    "accountIds": [],
    "error": null,
    "errorDetail": null,
    "redirectUrl": "https://app.example.com/integrations/done",
    "state": "user_42",
    "groupId": null,
    "oauthAppId": null,
    "expiresAt": "2026-11-02T10:00:00.000Z",
    "completedAt": null,
    "createdAt": "2026-11-02T09:00:00.000Z"
  }
}

The url is only returned here. Relaycast stores a hash of it, so it can't be shown again.

Back at your redirectUrl

Relaycast adds these query parameters:

ParameterWhenDescription
statusAlwaysconnected or error.
connectLinkIdAlwaysThe link's id.
platformAlwaysThe platform from the link.
accountIdConnectedThe connected account's id.
accountIdsConnectedComma-separated ids. One login can grant several accounts, for example several Facebook Pages.
errorErrorOne of the codes below.
detailSometimesThe platform's own explanation, when it gave one.
stateIf you sent oneYour state, unchanged.
https://app.example.com/integrations/done?connectLinkId=5b0c7e1a-…&platform=youtube&status=connected&accountId=7c6b5a49-…&accountIds=7c6b5a49-…&state=user_42

Don't rely on the query string alone for anything sensitive: confirm with Get a connect link from your server.

errorMeaning
access_deniedThe user cancelled on the consent screen.
link_expiredThe link expired before it was used. Create a new one.
link_usedThe link was already used. Create a new one.
no_accountsThe login worked but had nothing to publish to (for example, a Facebook user with no Pages).
connect_failedThe platform rejected the connection, or the project's account limit was reached. See detail.
provider_errorThe platform returned an error. See detail.
not_configured / app_not_configuredThe platform (or your OAuth app) is missing credentials on the server.
invalid_group / invalid_appThe group or OAuth app was deleted after the link was created.

Errors

StatusCodeWhen
400validation_errorA field is missing or invalid, for example an http redirect that isn't localhost.
400unsupported_platformThe platform can't be connected with a link (Bluesky).
403project_suspendedThe project is suspended.

This page is also available as Markdown.