Switch the active Application in an authenticated session
/v1/auth/switch-applicationRequest body
application_id *stringApplication ID to switch to
Code samples
curl -X POST "https://api.canopy.dev/v1/auth/switch-application" \
-H "Content-Type: application/json" \
-d '{
"application_id": "string"
}'const response = await fetch("https://api.canopy.dev/v1/auth/switch-application", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"application_id": "string"
}),
});
const data = await response.json();import requests
response = requests.post(
"https://api.canopy.dev/v1/auth/switch-application",
headers={
"Content-Type": "application/json"
},
json={
"application_id": "string",
},
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"application_id": "string",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.canopy.dev/v1/auth/switch-application", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}Responses
200 Fresh access + refresh tokens issued for the new Application
{
"access_token": "string",
"token_type": "string",
"expires_in": 0,
"user": {
"id": "string",
"email": "string",
"first_name": "string",
"last_name": "string"
},
"default_environment_slug": "string"
}application/json
access_token *stringtoken_type *stringexpires_in *numberuserAuthUserDtodefault_environment_slugstring
401 Invalid or expired token
403 This token is not authorized for this endpoint (wrong principal type — e.g., admin token on identity-only endpoint, or vice versa)