Create a connected account
Creates 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.
Authorization
Authorization: Bearer $TOKEN, an access token from the client credentials grant. See Authentication.
Body
connected_accountobjectrequiredShow 2 child attributes
api_configobjectauthorization_detailsobjectShow 4 child attributes
google_dwdobjectoauth_tokenobjectstatic_authobjecttrusted_idpobjectdb_user. Responses include access_key_id and expiry, never the secret key or session token.connectorstringrequiredidentifierstringorganization_id.organization_idstringidentifier, such as a Scalekit organization ID. Ignored when identifier is set.user_idstringorganization_id, keys the account to one user in that organization. Ignored when identifier is set.scalekit_client.actions.create_connected_account
Create a new connected account
scalekit_client.actions.create_connected_account( connection_name: str, identifier: str, authorization_details: Optional[Dict[str, Any]] = None, organization_id: Optional[str] = None, user_id: Optional[str] = None, api_config: Optional[Dict[str, Any]] = None,) -> CreateConnectedAccountResponseParameters
connection_namestrrequiredidentifierstrrequiredauthorization_detailsOptional[Dict[str, Any]]organization_idOptional[str]user_idOptional[str]api_configOptional[Dict[str, Any]]Returns CreateConnectedAccountResponse: The created connected account details
From scalekit-sdk-python 2.19.1.
Also called by scalekit_client.actions.get_or_create_connected_account.
scalekit.actions.createConnectedAccount
Create a new connected account. This helper accepts a high-level payload and builds the underlying CreateConnectedAccount message.
scalekit.actions.createConnectedAccount( params: { connectionName: string; identifier: string; authorizationDetails: MessageInitShape<typeof CreateConnectedAccountSchema>['authorizationDetails']; organizationId?: string; userId?: string; apiConfig?: Record<string, unknown>; },): Promise<CreateConnectedAccountResponse>Parameters
connectionNamestringrequiredidentifierstringrequiredauthorizationDetailsMessageInitShape<typeof CreateConnectedAccountSchema>['authorizationDetails']required{ case: "oauthToken", value }, or an API key or other static values as { case: "staticAuth", value }. To have the user connect their own account instead, use getAuthorizationLink.organizationIdstringidentifier, such as a Scalekit organization ID. Ignored when identifier is set.userIdstringorganization_id, keys the account to one user in that organization. Ignored when identifier is set.apiConfigRecord<string, unknown>Returns Promise<CreateConnectedAccountResponse>.
From @scalekit-sdk/node 2.18.0.
Also called by scalekit.actions.getOrCreateConnectedAccount.
Response 200
connected_accountobjectShow 13 child attributes
api_configobjectauthorization_detailsobjectoauth_token, static_auth, google_dwd or trusted_idp.Show 4 child attributes
google_dwdobjectoauth_tokenobjectstatic_authobjecttrusted_idpobjectdb_user. Responses include access_key_id and expiry, never the secret key or session token.authorization_typestring (enum)OAUTHAPI_KEYBASIC_AUTHBEARER_TOKENCUSTOMBASICOAUTH_M2MTRELLO_OAUTH1GOOGLE_DWDTRUSTED_IDPSMART_FHIRNO_AUTHconnection_idstringconnectorstringidstringidentifierstringis_org_wide_credentialbooleanfalse for a user's own account.last_used_atstringproviderstringGMAIL or SLACK.statusstring (enum)ACTIVEEXPIREDPENDING_AUTHPENDING_VERIFICATIONDISCONNECTEDtoken_expires_atstringupdated_atstringErrors
Every error has the same body: code, message and details. See Errors and rate limits.
400Invalid request - missing required fields, invalid authorization details, or validation failed. Error code RESOURCE_ALREADY_EXISTS when the user already has a connected account on this connection; update it instead.401Authentication required - missing or invalid access token404Not found - no connection with this name exists in the environment. Error code RESOURCE_NOT_FOUND.Used in
- Apify Actor with per-user OAuth via Scalekit
- Authorize a user
- Build a daily briefing agent with Vercel AI SDK and Scalekit AgentKit
- Build a Mastra agent with Scalekit AgentKit tools
- Build a multi-agent email triage crew with CrewAI
- Build a multi-user GitHub PR summarizer agent
- Build an agent that books meetings and drafts emails
- FastRouter + Scalekit tool calling
- Manage connected accounts
- Migrate from Composio to Scalekit
- Quickstart
- Trace AgentKit tool calls in LangSmith