Switch active organization
POST
/v2/portal/auth/switch-organization
curl --request POST \ --url https://api.sipstack.com/v2/portal/auth/switch-organization \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "organizationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'import requests
url = "https://api.sipstack.com/v2/portal/auth/switch-organization"
payload = { "organizationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }headers = { "Authorization": "Bearer <token>", "Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())const url = 'https://api.sipstack.com/v2/portal/auth/switch-organization';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"organizationId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}import axios from 'axios';
const options = { method: 'POST', url: 'https://api.sipstack.com/v2/portal/auth/switch-organization', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, data: {organizationId: '2489E9AD-2EE2-8E00-8EC9-32D5F69181C0'}};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}For multi-organization accounts — re-scopes the session to another organization the user belongs to and returns a new JWT (cookie is updated too).
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ” Media type application/json
object
organizationId
required
string format: uuid
Example generated
{ "organizationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Responses
Section titled “ Responses ”Session re-scoped; response includes the new token.
Not authenticated.
User does not belong to the target organization.