Update the admin's resume-state for this Application
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/me/stateAuthentication
- Bearer Token
AuthorizationJWT access token
Request body
environment_slug *stringSlug of the env the admin is now active in. Must be a real env in this Application.
Code samples
curl -X PUT "https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/me/state" \
-H "Authorization: Bearer $CANOPY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"environment_slug": "string"
}'const response = await fetch("https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/me/state", {
method: "PUT",
headers: {
"Authorization": "Bearer $CANOPY_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"environment_slug": "string"
}),
});
const data = await response.json();import requests
response = requests.put(
"https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/me/state",
headers={
"Authorization": "Bearer $CANOPY_TOKEN",
"Content-Type": "application/json"
},
json={
"environment_slug": "string",
},
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"environment_slug": "string",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("PUT", "https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/me/state", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer $CANOPY_TOKEN")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}Responses
200 Records the admin's currently-active env so the dashboard can resume them on the same env after sign-out / device switch.
{
"environment_slug": "string"
}application/json
environment_slug *stringSlug of the env the admin should land on for this App. Resolved server-side from the admin's last-active env, falling back to the App's default. Null only when the App has no envs.
400 The supplied `environment_slug` does not exist in this Application
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)