Skip to content

Create a resource permission.

POST
/api/admin/resource-permissions
Code sample: Shell / cURL
curl --request POST \
--url https://auth.example.com/api/admin/resource-permissions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "subject_type": "user", "subject_id": "user_123", "resource_type": "document", "resource_id": "doc_456", "actions": [ "read", "update" ], "is_active": true }'

Grant ID-level actions on a resource to a user, role, or organization subject. Duplicate subject/resource grants return conflict.

Media type application/json
object
subject_type
required
string
Allowed values: user role org
subject_id
required
string
resource_type
required
string
resource_id
required
string
actions
required
Array<string>
condition
object
key
additional properties
expires_at
integer format: int64
is_active
boolean
default: true
key
additional properties
Example
{
"subject_type": "user",
"subject_id": "user_123",
"resource_type": "document",
"resource_id": "doc_456",
"actions": [
"read",
"update"
],
"is_active": true
}

Resource permission response.

Media type application/json
object
id
required
string
tenant_id
required
string
subject_type
required
string
Allowed values: user role org
subject_id
required
string
resource_type
required
string
resource_id
required
string
actions
required
Array<string>
condition
object
key
additional properties
expires_at
integer format: int64
is_active
required
boolean
granted_by
string
created_at
required
integer format: int64
updated_at
required
integer format: int64
key
additional properties
Example
{
"id": "rp_123",
"tenant_id": "tenant_123",
"subject_type": "user",
"subject_id": "user_123",
"resource_type": "document",
"resource_id": "doc_456",
"actions": [
"read",
"update"
],
"condition": null,
"expires_at": null,
"is_active": true,
"granted_by": null,
"created_at": 1770000000,
"updated_at": 1770000000
}

Error response.

Media type application/json
object
error
string
message
string
error_description
string
key
additional properties
Example generated
{
"error": "example",
"message": "example",
"error_description": "example"
}

Error response.

Media type application/json
object
error
string
message
string
error_description
string
key
additional properties
Example generated
{
"error": "example",
"message": "example",
"error_description": "example"
}

Error response.

Media type application/json
object
error
string
message
string
error_description
string
key
additional properties
Example generated
{
"error": "example",
"message": "example",
"error_description": "example"
}

Error response.

Media type application/json
object
error
string
message
string
error_description
string
key
additional properties
Example generated
{
"error": "example",
"message": "example",
"error_description": "example"
}

Error response.

Media type application/json
object
error
string
message
string
error_description
string
key
additional properties
Example generated
{
"error": "example",
"message": "example",
"error_description": "example"
}