Migrate external authentication connection
POST/marketplace/external-auth/migration
Migrates an external authentication connection credentials (basic or oauth2) for a specific app and location. This endpoint validates the app configuration, stores credentials safely in CRM's native encrypted storage. With this the lifecycle of the token is managed by CRM.
Request
API Version
v3- application/json
- Body
- Example (auto)
Bodyrequired
Type of authentication - basic or oauth2
oauth2basicLocation ID
App ID
App Version ID
Connection identifier
API Key (supported when type is basic)
Basic auth credentials as key/value pairs (supported when type is basic). Keys are validated against the app version externalAuthConfig.fields.
Access token (required when type is oauth2)
Refresh token. Omit only when the provider issues long-lived, non-refreshable tokens (e.g. TikTok Marketing API, ClickUp) and therefore never returns one. Callers are responsible for supplying it whenever their app has a refresh endpoint configured: the migration stores exactly what it is given and replaces any previously stored secret, so omitting a refresh token the connection needs will leave it unable to refresh once the access token expires. Must be a non-empty string when supplied — null is rejected.
Access token expiry time in milliseconds (optional for oauth2)
Timestamp for access token expiry (optional for oauth2)
OAuth2 scopes (optional for oauth2)
Display name for the connection (optional, defaults to accountId)
Account email metadata for the migrated connection
Source of the account identity metadata
providermanualWhether this is the default connection for the location (optional, defaults to false)
{
"type": "oauth2",
"locationId": "location_12345",
"appId": "507f1f77bcf86cd799439011",
"appVersionId": "507f1f77bcf86cd799439012",
"accountId": "my-connection-identifier",
"apiKey": "sk_test_1234567890",
"basicCredentials": {
"password": "p@ssw0rd"
},
"accessToken": "ya29.a0AfH6SMBx...",
"refreshToken": "1//0gHq5F...",
"expiryIn": 3600000,
"expiryAt": 1735689600000,
"scopes": [
"contacts.readonly",
"contacts.write"
],
"displayName": "My Connection Display Name",
"identitySource": "manual",
"isDefault": false
}
Connection migrated successfully
- application/json
- Schema
- Example (auto)
Schema
Indicates if the migration was successful
Unique identifier for the migrated connection
Message describing the result
{
"success": true,
"identifier": "migration_12345",
"message": "Connection migrated successfully"
}