Skip to main content
POST
/
users
/
{id}
/
sdk-token
Create a SDK token for a user
curl --request POST \
  --url https://api.tapti.ai/users/{id}/sdk-token \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "user_platforms": [
    "YOUTUBE",
    "TIKTOK"
  ],
  "enabled_scopes": [
    "PROFILE_READ"
  ],
  "callback_url": "https://your-app.com/api/oauth/callback",
  "redirect_url": "https://your-app.com/dashboard/accounts"
}
'
{
  "oauth_portal_url": "https://oauth-portal.example.com?sdk_token=8pjBUEbqcA3bkKEBTmZ2WsduYwMH6UU23byRiU2rs.........&origin=https://your-app.com/dashboard/accounts"
}
Create a SDK token for a user. This token is required for client-side operations and OAuth portal access.

OAuth Portal Integration

The SDK token is essential for using Tapti’s OAuth Portal, where your users can securely connect their social media accounts:
// 1. Generate SDK token on your backend
const sdkToken = await tapti.user().createSDKToken(userId);

// 2. Redirect user to OAuth Portal
const oauthUrl = `https://oauth.tapti.dev?sdk_token=${sdkToken}`;
// Optional: Specify platform to skip selection screen
const youtubeOauthUrl = `https://oauth.tapti.dev?sdk_token=${sdkToken}&platform=youtube`;
The OAuth Portal provides a secure, branded experience for connecting social media accounts without requiring you to implement complex OAuth flows.

Security Considerations

  • SDK tokens are short-lived and user-specific - Never store tokens in localStorage or expose them in client-side source code - Generate new tokens just before redirecting to the OAuth Portal - Include only necessary platform permissions

Authorizations

x-api-key
string
header
required

Path Parameters

Body

application/json

The SDK token to create

user_platforms
enum<string>[]
required

The platforms to create the SDK token for

Available options:
YOUTUBE,
TIKTOK,
INSTAGRAM,
INSTAPRO,
FACEBOOK,
X,
LINKEDIN
Example:
["YOUTUBE", "TIKTOK"]
enabled_scopes
enum<string>[]
required

The scopes to create the SDK token for

Available options:
PROFILE_READ,
PROFILE_WRITE,
CONTENT_READ,
CONTENT_WRITE,
ANALYTICS_READ,
COMMENTS_READ,
COMMENTS_WRITE
Example:
["PROFILE_READ"]
callback_url
string
required

The callback URL to send the account connection response to

Example:

"https://your-app.com/api/oauth/callback"

redirect_url
string
required

The redirect URL to redirect the user after successful authentication

Example:

"https://your-app.com/dashboard/accounts"

Response

SDK token created successfully

oauth_portal_url
string
required

The OAuth portal URL to redirect the user to

Example:

"https://oauth-portal.example.com?sdk_token=8pjBUEbqcA3bkKEBTmZ2WsduYwMH6UU23byRiU2rs.........&origin=https://your-app.com/dashboard/accounts"