Skip to main content
PUT
/
api
/
v2
/
public
/
migrate-token
curl -X PUT "https://app.refold.ai/api/v2/public/migrate-token" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "linked_account_id: YOUR_LINKED_ACCOUNT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "hubspot",
    "auth_object": {
      "oauth2": { "access_token": "YOUR_ACCESS_TOKEN", "refresh_token": "YOUR_REFRESH_TOKEN" }
    }
  }'
{
  "success": true,
  "message": "Token migrated successfully"
}
Import an existing auth object onto a linked account’s integration. The auth_object is validated against the named app’s auth schema, each value is encrypted, and the integration is created (or updated if it already exists) on the linked account identified by the linked_account_id header. Use this to bring credentials you already hold (e.g. migrating from another system) into Refold without sending the user through a connect flow.
Custom apps are not supported by this endpoint. Many native apps verify the credentials against the provider before storing them.

Authentication

x-api-key
string
required
Your Refold API key. Find it in Settings → Credentials.
linked_account_id
string
required
The linked account to attach the integration to.

Body Parameters

slug
string
required
The app slug being migrated.Example: hubspot
auth_object
object
required
An object with exactly one top-level key naming the auth type (oauth2, keybased, …). Its value is an object whose fields match the app’s auth-type schema.

Response

success
boolean
Whether the migration succeeded.
message
string
Confirmation message.
{
  "success": true,
  "message": "Token migrated successfully"
}
curl -X PUT "https://app.refold.ai/api/v2/public/migrate-token" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "linked_account_id: YOUR_LINKED_ACCOUNT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "hubspot",
    "auth_object": {
      "oauth2": { "access_token": "YOUR_ACCESS_TOKEN", "refresh_token": "YOUR_REFRESH_TOKEN" }
    }
  }'