Switch company
curl --request POST \
--url https://staging.api.prexsell.com/v2/auth/switch-company \
--header 'Content-Type: application/json' \
--data '
{
"companyId": "cmp_xyz789"
}
'{
"data": {
"user": {
"id": "usr_abc123def456",
"email": "user@example.com",
"firstName": "Іван",
"lastName": "Петренко"
},
"access": {
"contextType": "COMPANY",
"companyId": "cmp_xyz789",
"partnerId": null,
"role": "ADMIN",
"company": {
"id": "cmp_xyz789",
"name": "Prexsell Bus Lines",
"slug": "prexsell-bus-lines",
"tier": "PRO"
}
},
"session": {
"id": "ses_q1w2e3r4t5",
"contextType": "COMPANY",
"companyId": "cmp_xyz789",
"userId": "usr_abc123def456",
"expiresAt": "2026-06-28T00:00:00.000Z",
"lastUsedAt": "2026-05-28T12:00:00.000Z",
"revokedAt": null
},
"availableAccesses": []
}
}Auth
Switch company
Updates the current session to operate in the context of a different company the user has access to. Issues a new access token scoped to the target company.
POST
/
v2
/
auth
/
switch-company
Switch company
curl --request POST \
--url https://staging.api.prexsell.com/v2/auth/switch-company \
--header 'Content-Type: application/json' \
--data '
{
"companyId": "cmp_xyz789"
}
'{
"data": {
"user": {
"id": "usr_abc123def456",
"email": "user@example.com",
"firstName": "Іван",
"lastName": "Петренко"
},
"access": {
"contextType": "COMPANY",
"companyId": "cmp_xyz789",
"partnerId": null,
"role": "ADMIN",
"company": {
"id": "cmp_xyz789",
"name": "Prexsell Bus Lines",
"slug": "prexsell-bus-lines",
"tier": "PRO"
}
},
"session": {
"id": "ses_q1w2e3r4t5",
"contextType": "COMPANY",
"companyId": "cmp_xyz789",
"userId": "usr_abc123def456",
"expiresAt": "2026-06-28T00:00:00.000Z",
"lastUsedAt": "2026-05-28T12:00:00.000Z",
"revokedAt": null
},
"availableAccesses": []
}
}Body
application/json
Request body for switching the active company context within the current session.
The identifier of the company context to switch into.
Example:
"cmp_xyz789"
Response
Company context switched. A new access token scoped to the target company is set as an HTTP-only cookie.
Full authentication payload returned after a successful login, token refresh, or session fetch.
Show child attributes
Show child attributes
⌘I
