Skip to main content
POST
Create a social-linking URL for a User Profile. The endpoint is still named generateJWT, but the token it returns is opaque and is not a JWT. See the Linking URL Overview for more details.
The linking URL is valid for 5 minutes. After 5 minutes you must generate a new linking URL. See the Max Pack expiresIn for additional options.
The returned token is an opaque string beginning ayr_ls_ — it is not a decodable JWT and carries no readable payload. Pass the url to your user as returned, and treat token as a credential you store rather than inspect. Links you created earlier still work.POST /profiles/link-sessions is the same operation without the legacy parameters, and it also lets you check or revoke a link. See Create a Link Session.

Header Parameters

string
Your X API Key (Consumer Key) from the X Developer Portal. Alternative to the twitterApiKey body parameter. When provided, the generated linking URL will use your X Developer App for OAuth linking.
string
Your X API Secret (Consumer Secret) from the X Developer Portal. Alternative to the twitterApiSecret body parameter. Required when X-Twitter-OAuth1-Api-Key is provided.
Recommended: Pass your X credentials via headers (X-Twitter-OAuth1-Api-Key and X-Twitter-OAuth1-Api-Secret) for consistency with all other Ayrshare API endpoints. The twitterApiKey and twitterApiSecret body parameters are still supported for backward compatibility.

Body Parameters

string
Domain of app. Please use the exact domain given during onboarding.Optional. When omitted, your account’s own domain is used. If you do send it, it must be a domain registered to your account.
string
deprecated
No longer used. Accepted and ignored, so existing integrations keep working without a change.Linking URLs are no longer signed, so there is no key to send. You can remove this field, and stop storing the private key for this purpose.
string
required
User Profile Key. The API Key cannot be used in this field.
boolean
default:false
Automatically logout the current session. Recommend not to use in production since it affects the performance.See Automatic Logout of a Profile Session for more information.
string
Specify a URL to redirect to when the “Done” button or logo image is clicked. The URL will be automatically shortened in the returned linking URL. Redirect the origin opener window by adding the query parameter origin=true to the redirect URL.
array
Specify the social networks to display in the linking page. This will override the social networks configured in the Social Networks page.
Only display Facebook, X/Twitter, LinkedIn, and TikTok
Override which Instagram linking flow is used when a user clicks the Instagram button on the social linking page for this URL. Valid values:
  • instagram: Direct Instagram Login, no Facebook Page required.
  • facebook: Link Instagram via a connected Facebook Page.
Force direct Instagram Login for this linking session
When omitted, the linking page uses your account-wide Instagram Login setting.See Instagram Link Method for more information.
boolean
deprecated
No longer used. Accepted and ignored.There is no signed token to verify — the returned token is validated by the linking page when your user opens the URL.
boolean
deprecated
No longer used. Accepted and ignored, since privateKey is no longer read.
number
default:5
Set the longevity of the token in minutes. Range: 1 minute to 2880 minutes.See JWT Expires In for more information.
object
default:5
Send a Connect Accounts email with a link for users to directly access their social linkage page.See Connect Accounts Email for more information.
When you include your X API credentials, the generated linking URL will initiate OAuth linking using your own X Developer App. Your end-users will see your app name on the X consent screen.
Required: Before using this feature, you must add these callback URLs to your X Developer App settings (under Authentication settings > Callback URI / Redirect URL):
  • https://profile.ayrshare.com/social-accounts
  • https://app.ayrshare.com/social-accounts
Without these, the OAuth flow will fail with a 403 Callback URL not approved error.