Skip to main content
External Auth MigrationVersion: v3

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.

Authorizations

Authorizationstringheaderrequired

Bearer authentication header of the form Bearer <token>, where <token> is your access token.

Scope:marketplace-external-auth-migration.write
Auth method:OAuth
Token type:Sub-Account Token

Request​

Headers

Versionstringrequired

API Version

Available optionsv3
Example:v3

Body

typestringrequired

Type of authentication - basic or oauth2

Available optionsoauth2basic
Example:oauth2
locationIdstringrequired

Location ID

Example:location_12345
appIdstringrequired

App ID

Example:507f1f77bcf86cd799439011
appVersionIdstringrequired

App Version ID

Example:507f1f77bcf86cd799439012
accountIdstringrequired

Connection identifier

Example:my-connection-identifier
apiKeystring

API Key (supported when type is basic)

Example:sk_test_1234567890
basicCredentialsobject

Basic auth credentials as key/value pairs (supported when type is basic). Keys are validated against the app version externalAuthConfig.fields.

Example
{
  "email": "[email protected]",
  "password": "p@ssw0rd"
}
accessTokenstring

Access token (required when type is oauth2)

Example:ya29.a0AfH6SMBx...
refreshTokenstring

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.

Example:1//0gHq5F...
expiryInnumber

Access token expiry time in milliseconds (optional for oauth2)

Example:3600000
expiryAtnumber

Timestamp for access token expiry (optional for oauth2)

Example:1735689600000
scopesstring[]

OAuth2 scopes (optional for oauth2)

Example:["contacts.readonly","contacts.write"]
displayNamestring

Display name for the connection (optional, defaults to accountId)

Example:My Connection Display Name
emailstring

Account email metadata for the migrated connection

identitySourcestring

Source of the account identity metadata

Available optionsprovidermanual
Example:manual
isDefaultboolean

Whether this is the default connection for the location (optional, defaults to false)

Example:false

Response

Connection migrated successfully

successbooleanrequired

Indicates if the migration was successful

Example:true
identifierstringrequired

Unique identifier for the migrated connection

Example:migration_12345
messagestring

Message describing the result

Example:Connection migrated successfully