curl -X POST 'https://api.example.com/resource-policies/batch' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '[
{
"scopeId": "scope_org",
"name": "Finance Read Access",
"target": {
"kind": "collection",
"collectionId": "collection_finance_docs"
},
"actions": ["read"],
"effect": "allow",
"subjectCondition": {
"==": [{"var": "subject.meta.department"}, "finance"]
}
},
{
"scopeId": "scope_org",
"name": "Block Archived",
"target": {
"kind": "collection",
"collectionId": "collection_archived"
},
"actions": ["*"],
"effect": "deny",
"priority": 100
}
]'
[
{
"id": "policy_0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"scopeId": "scope_org",
"name": "Finance Read Access",
"target": {
"kind": "collection",
"collectionId": "collection_finance_docs"
},
"actions": ["read"],
"effect": "allow",
"subjectCondition": {
"==": [{"var": "subject.meta.department"}, "finance"]
},
"createdAt": "2024-01-15T10:30:00Z"
},
{
"id": "policy_0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5c",
"scopeId": "scope_org",
"name": "Block Archived",
"target": {
"kind": "collection",
"collectionId": "collection_archived"
},
"actions": ["*"],
"effect": "deny",
"priority": 100,
"createdAt": "2024-01-15T10:30:00Z"
}
]
Create multiple resource policies at once
curl -X POST 'https://api.example.com/resource-policies/batch' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '[
{
"scopeId": "scope_org",
"name": "Finance Read Access",
"target": {
"kind": "collection",
"collectionId": "collection_finance_docs"
},
"actions": ["read"],
"effect": "allow",
"subjectCondition": {
"==": [{"var": "subject.meta.department"}, "finance"]
}
},
{
"scopeId": "scope_org",
"name": "Block Archived",
"target": {
"kind": "collection",
"collectionId": "collection_archived"
},
"actions": ["*"],
"effect": "deny",
"priority": 100
}
]'
[
{
"id": "policy_0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"scopeId": "scope_org",
"name": "Finance Read Access",
"target": {
"kind": "collection",
"collectionId": "collection_finance_docs"
},
"actions": ["read"],
"effect": "allow",
"subjectCondition": {
"==": [{"var": "subject.meta.department"}, "finance"]
},
"createdAt": "2024-01-15T10:30:00Z"
},
{
"id": "policy_0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5c",
"scopeId": "scope_org",
"name": "Block Archived",
"target": {
"kind": "collection",
"collectionId": "collection_archived"
},
"actions": ["*"],
"effect": "deny",
"priority": 100,
"createdAt": "2024-01-15T10:30:00Z"
}
]
policy_{uuidv7}allow or denycurl -X POST 'https://api.example.com/resource-policies/batch' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '[
{
"scopeId": "scope_org",
"name": "Finance Read Access",
"target": {
"kind": "collection",
"collectionId": "collection_finance_docs"
},
"actions": ["read"],
"effect": "allow",
"subjectCondition": {
"==": [{"var": "subject.meta.department"}, "finance"]
}
},
{
"scopeId": "scope_org",
"name": "Block Archived",
"target": {
"kind": "collection",
"collectionId": "collection_archived"
},
"actions": ["*"],
"effect": "deny",
"priority": 100
}
]'
[
{
"id": "policy_0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
"scopeId": "scope_org",
"name": "Finance Read Access",
"target": {
"kind": "collection",
"collectionId": "collection_finance_docs"
},
"actions": ["read"],
"effect": "allow",
"subjectCondition": {
"==": [{"var": "subject.meta.department"}, "finance"]
},
"createdAt": "2024-01-15T10:30:00Z"
},
{
"id": "policy_0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5c",
"scopeId": "scope_org",
"name": "Block Archived",
"target": {
"kind": "collection",
"collectionId": "collection_archived"
},
"actions": ["*"],
"effect": "deny",
"priority": 100,
"createdAt": "2024-01-15T10:30:00Z"
}
]
Was this page helpful?