Session cutover helper during an active import
POST /v1/sessions/migrate: Session cutover helper during an active import.
POST /v1/sessions/migrate
The app’s server-side SDK reads the user from the old provider (its userinfo endpoint; the token never reaches us) and sends the legacy profile ID. It resolves only through the import’s legacy IDs (profiles.legacy_ids under the import’s source) in organizations the import imported and has not rolled back, while the import is running or completed; each legacy ID resolves once (import_state_conflict afterwards). The email must still be in a verified domain of the organization. Audited (session.migrated).
- Scope
imports:write- Auth
- Secret key (
sk_…) - Since
- 1.0
Headers
Section titled “Headers”
Minor version; defaults to the environment’s pin.OhAuthCat-Versionstring
Honoured for 24 h; a replay returns the original response.Idempotency-Keystringmin length 1 · max length 255
Request body
Section titled “Request body”importstring Requiredlegacy_profile_idstring Requiredmin length 1
Responses
Section titled “Responses”- 200 OK SessionMigrateResult
- 400 Invalid request. Codes: parameter_invalid, parameter_missing, version_unsupported and resource-specific codes from the catalogue. Error
- 401 Codes: authentication_required, api_key_invalid. Error
- 403 Codes: api_key_scope_missing, ip_not_allowed, plan_limit_reached. Error
- 409 Codes: idempotency_key_reused and resource-specific conflicts. Error
- 429 Code: rate_limited. Retry-After is set. Error
- 503 Code: service_unavailable. Retry-After is set; writes are paused. Error
- default Any other error, including internal_error. Every code is in the error catalogue. Error
Errors share one shape; see the error code catalogue.
curl -X POST \ "https://api.ohauthcat.com/v1/sessions/migrate" \ -H "Authorization: Bearer $OHAUTHCAT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "import": "imp_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "legacy_profile_id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5"}'const response = await fetch("https://api.ohauthcat.com/v1/sessions/migrate", { method: "POST", headers: { Authorization: `Bearer ${process.env.OHAUTHCAT_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "import": "imp_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "legacy_profile_id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5" }),});const data = await response.json();import osimport requests
response = requests.post( "https://api.ohauthcat.com/v1/sessions/migrate", headers={"Authorization": f"Bearer {os.environ['OHAUTHCAT_API_KEY']}"}, json={ "import": "imp_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "legacy_profile_id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5", },)data = response.json(){ "profile": { "claims": {}, "risk": { "score": 0, "reasons": [ "impossible_travel" ], "degraded": true }, "custom_attributes": {}, "policy_hints": { "force_sso": true, "force_sso_excluded": true, "max_age_seconds": 1, "idp_initiated_allowed": true, "guest": true }, "access_policy": "guest", "email_verified": true, "idp_groups_verified": true, "id": "prof_01J9ZQ4M7K2X8V3N5B6C1D0E9F", "object": "profile", "organization_id": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "connection_id": "conn_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "connection_type": "saml", "idp_id": "0oa1b2c3d4E5F6g7h8i9", "email": "jane@acme.com", "email_domain_verified": true, "first_name": "Jane", "last_name": "Doe", "groups": [ "Engineering" ], "role": "admin", "attributes": {}, "raw_attributes": {}, "legacy_ids": { "workos": "org_01H8ZQ4M7K2X8V3N5B6C1D0E9F" } }}