Permissions
Valar controls access with path-based permission rules organized by namespace: a rule on myproject also applies to myproject/web. See Permission management for the evaluation rules and CLI commands.
Endpoints
| Method | Path | Action |
|---|---|---|
GET |
/v2/projects/{project}/permissions |
List permissions |
POST |
/v2/projects/{project}/permissions |
Update a permission |
POST |
/v2/projects/{project}/permissions?mode=check |
Check a permission |
List permissions
GET /v2/projects/{project}/permissions?namespace={namespace}&prefix={prefix}
Returns all permission rules matching a namespace and path prefix. Both query parameters are required.
| Parameter | Description |
|---|---|
namespace |
Required. One of legacy, service, or kv. |
prefix |
Required. Resource path prefix, such as myproject for a project or myproject/web for one service. |
curl "https://api.valar.dev/v2/projects/myproject/permissions?namespace=service&prefix=myproject" \
-H "Authorization: Bearer $TOKEN"[
{
"path": {"namespace": "service", "items": ["myproject"]},
"user": {"type": "human", "identifier": ["myuser"]},
"action": "write",
"state": "allow"
},
{
"path": {"namespace": "service", "items": ["myproject"]},
"user": {"type": "human", "identifier": ["anonymous"]},
"action": "invoke",
"state": "allow"
}
]Important
You need
managepermission on the path to list its permissions.
Update a permission
POST /v2/projects/{project}/permissions
Sets a permission rule for a path, user, and action.
| Field | Description |
|---|---|
path |
Target resource with namespace (legacy, service, or kv) and items path segments. |
user |
Subject with type (human or service) and identifier segments. |
action |
One of read, write, invoke, or manage. |
state |
allow grants access, forbid denies it, and unset removes an explicit rule so inherited rules apply (the CLI uses clear for unset). |
curl -X POST https://api.valar.dev/v2/projects/myproject/permissions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"path": {"namespace": "service", "items": ["myproject", "web"]},
"user": {"type": "human", "identifier": ["anonymous"]},
"action": "invoke",
"state": "forbid"
}'{
"modified": true
}The modified boolean reports whether the rule changed. If the rule already had the requested state, modified is false. See Permission management for user matching (anonymous, authenticated, and exact usernames).
Check a permission
POST /v2/projects/{project}/permissions?mode=check
Checks whether a user is allowed an action without changing any rules.
curl -X POST "https://api.valar.dev/v2/projects/myproject/permissions?mode=check" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"path": {"namespace": "service", "items": ["myproject", "web"]},
"user": {"type": "human", "identifier": ["anonymous"]},
"action": "invoke"
}'{
"allowed": false
}