Connected Accounts
Create a connected account
Changed onCreates a connected account for one user and one connection, with credentials your app already holds: OAuth tokens, or an API key or other static credentials. To have the user connect their own account instead, send them an authorization link. Returns the account with its ID and status.
post/api/v1/connected_accounts
Request
- Base URLhttps://$SCALEKIT_ENVIRONMENT_URL
- AuthOAuth 2Client credentialsToken URLhttps://$SCALEKIT_ENVIRONMENT_URL/oauth/token
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Example request
{
"connected_account": {
"api_config": {
"base_url": "https://api.custom-domain.com",
"rate_limit": 1000,
"timeout": 30
},
"authorization_details": {
"google_dwd": {
"access_token": "ya29.a0AfH6SMBx...",
"scopes": [
"openid",
"https://www.googleapis.com/auth/userinfo.email"
],
"subject": "user@example.com"
},
"oauth_token": {
"access_token": "ya29.a0AfH6SMBx...",
"domain": "example.com",
"refresh_token": "1//0gHJxZ-Lb2...",
"scopes": [
"https://www.googleapis.com/auth/drive.readonly",
"https://www.googleapis.com/auth/userinfo.email"
]
},
"static_auth": {
"details": {
"api_key": "sk_live_...",
"api_secret": "..."
}
},
"trusted_idp": {
"access_key_id": "ASIA...",
"db_user": "analytics_reader"
}
}
},
"connector": "notion",
"identifier": "user@example.com",
"organization_id": "org_121312434123312",
"user_id": "user_121312434123312"
}Response
Connected account created successfully with authentication credentials stored securely
Example response
{
"connected_account": {
"api_config": {
"base_url": "https://api.custom-domain.com",
"rate_limit": 1000,
"timeout": 30
},
"authorization_details": {
"google_dwd": {
"access_token": "ya29.a0AfH6SMBx...",
"scopes": [
"openid",
"https://www.googleapis.com/auth/userinfo.email"
],
"subject": "user@example.com"
},
"oauth_token": {
"access_token": "ya29.a0AfH6SMBx...",
"domain": "example.com",
"refresh_token": "1//0gHJxZ-Lb2...",
"scopes": [
"https://www.googleapis.com/auth/drive.readonly",
"https://www.googleapis.com/auth/userinfo.email"
]
},
"static_auth": {
"details": {
"api_key": "sk_live_...",
"api_secret": "..."
}
},
"trusted_idp": {
"access_key_id": "ASIA...",
"db_user": "analytics_reader"
}
},
"connection_id": "conn_24834495392086178",
"connector": "notion",
"id": "ca_24834495392086178",
"identifier": "user@example.com",
"last_used_at": "2024-03-20T14:30:00Z",
"provider": "GMAIL",
"token_expires_at": "2024-12-31T23:59:59Z",
"updated_at": "2024-03-20T15:04:05Z"
}
}Changes
- breaking
removed the success response with the status
- info
added the non-success response with the status
- info
removed the non-success response with the status
- info
added the success response with the status
- breaking
- warning
added the new
NO_AUTHenum value to the/response property for the response status
- warning