Logout and revoke tokens
/v1/auth/logoutRequest body
revoke_allbooleanRevoke all sessions
Code samples
curl -X POST "https://api.canopy.dev/v1/auth/logout" \
-H "Content-Type: application/json" \
-d '{
"revoke_all": false
}'const response = await fetch("https://api.canopy.dev/v1/auth/logout", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"revoke_all": false
}),
});
const data = await response.json();import requests
response = requests.post(
"https://api.canopy.dev/v1/auth/logout",
headers={
"Content-Type": "application/json"
},
json={
"revoke_all": False,
},
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"revoke_all": false,
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.canopy.dev/v1/auth/logout", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}Responses
200 Tokens revoked
{
"revoked_count": 0
}application/json
revoked_count *number
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)