Get a role
/api/v1/roles/{id}Authentication
- Bearer Token
AuthorizationJWT access token
- API Key
X-API-KeyAPI key for management-tier access
Path Parameters
| Name | Required | Type | Description |
|---|---|---|---|
id | string |
Code samples
curl -X GET "https://api.canopy.dev/api/v1/roles/value" \ -H "X-API-Key: $CANOPY_API_KEY"
const response = await fetch("https://api.canopy.dev/api/v1/roles/value", {
method: "GET",
headers: {
"X-API-Key": "$CANOPY_API_KEY"
},
});
const data = await response.json();import requests
response = requests.get(
"https://api.canopy.dev/api/v1/roles/value",
headers={
"X-API-Key": "$CANOPY_API_KEY"
},
)
data = response.json()package main
import (
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.canopy.dev/api/v1/roles/value", nil)
req.Header.Set("X-API-Key", "$CANOPY_API_KEY")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}Responses
200 Role returned
{
"id": "string",
"application_id": "string",
"name": "string",
"description": "string",
"is_system_role": false,
"system_key": "string",
"is_active": false,
"created_at": "2026-04-20T12:00:00.000Z",
"updated_at": "2026-04-20T12:00:00.000Z",
"version": 0,
"permission_count": 0
}application/json
id *stringapplication_id *stringname *stringdescriptionstringis_system_role *booleansystem_keystringis_active *booleancreated_at *string (date-time)updated_at *string (date-time)version *numberOptimistic-lock version. Send back as the `If-Match` header when updating to detect concurrent edits.
permission_countnumberNumber of permissions currently assigned to this role. Populated on list responses; omitted on single-role responses where the join isn't computed.
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)
404 Role not found