curl -X POST 'https://api.example.com/scopes/batch' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '[
{
"id": "scope_engineering",
"typeId": "type_department",
"name": "Engineering",
"parentScopeId": "scope_env_production",
"memberships": [
{"subjectId": "subject_jane", "roleIds": ["role_admin"]}
]
},
{
"id": "scope_backend",
"typeId": "type_team",
"name": "Backend Team",
"parentScopeId": "scope_engineering",
"memberships": [
{"subjectId": "subject_jane", "roleIds": ["role_lead"]},
{"subjectId": "subject_bob", "roleIds": ["role_developer"]},
{"subjectId": "subject_alice", "roleIds": ["role_developer"]}
]
},
{
"id": "scope_frontend",
"typeId": "type_team",
"name": "Frontend Team",
"parentScopeId": "scope_engineering",
"memberships": [
{"subjectId": "subject_charlie", "roleIds": ["role_lead"]}
]
}
]'
[
{
"id": "scope_engineering",
"typeId": "type_department",
"name": "Engineering"
},
{
"id": "scope_backend",
"typeId": "type_team",
"name": "Backend Team"
},
{
"id": "scope_frontend",
"typeId": "type_team",
"name": "Frontend Team"
}
]
Create multiple scopes with inline memberships in a single request
curl -X POST 'https://api.example.com/scopes/batch' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '[
{
"id": "scope_engineering",
"typeId": "type_department",
"name": "Engineering",
"parentScopeId": "scope_env_production",
"memberships": [
{"subjectId": "subject_jane", "roleIds": ["role_admin"]}
]
},
{
"id": "scope_backend",
"typeId": "type_team",
"name": "Backend Team",
"parentScopeId": "scope_engineering",
"memberships": [
{"subjectId": "subject_jane", "roleIds": ["role_lead"]},
{"subjectId": "subject_bob", "roleIds": ["role_developer"]},
{"subjectId": "subject_alice", "roleIds": ["role_developer"]}
]
},
{
"id": "scope_frontend",
"typeId": "type_team",
"name": "Frontend Team",
"parentScopeId": "scope_engineering",
"memberships": [
{"subjectId": "subject_charlie", "roleIds": ["role_lead"]}
]
}
]'
[
{
"id": "scope_engineering",
"typeId": "type_department",
"name": "Engineering"
},
{
"id": "scope_backend",
"typeId": "type_team",
"name": "Backend Team"
},
{
"id": "scope_frontend",
"typeId": "type_team",
"name": "Frontend Team"
}
]
scope_{uuidv7}. You can optionally provide your own IDs for in-batch references.subjectId (required): The subject to add to this scoperoleIds (optional): Array of role IDs to assignparentScopeId and memberships to set up the complete structure in one request.curl -X POST 'https://api.example.com/scopes/batch' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '[
{
"id": "scope_engineering",
"typeId": "type_department",
"name": "Engineering",
"parentScopeId": "scope_env_production",
"memberships": [
{"subjectId": "subject_jane", "roleIds": ["role_admin"]}
]
},
{
"id": "scope_backend",
"typeId": "type_team",
"name": "Backend Team",
"parentScopeId": "scope_engineering",
"memberships": [
{"subjectId": "subject_jane", "roleIds": ["role_lead"]},
{"subjectId": "subject_bob", "roleIds": ["role_developer"]},
{"subjectId": "subject_alice", "roleIds": ["role_developer"]}
]
},
{
"id": "scope_frontend",
"typeId": "type_team",
"name": "Frontend Team",
"parentScopeId": "scope_engineering",
"memberships": [
{"subjectId": "subject_charlie", "roleIds": ["role_lead"]}
]
}
]'
[
{
"id": "scope_engineering",
"typeId": "type_department",
"name": "Engineering"
},
{
"id": "scope_backend",
"typeId": "type_team",
"name": "Backend Team"
},
{
"id": "scope_frontend",
"typeId": "type_team",
"name": "Frontend Team"
}
]
curl -X POST 'https://api.example.com/scopes/batch' \
-d '[
{"typeId": "type_team", "name": "Team A"},
{"typeId": "type_team", "name": "Team B"},
{"typeId": "type_team", "name": "Team C"}
]'
curl -X POST 'https://api.example.com/scopes/batch' \
-d '[
{
"id": "scope_dept",
"typeId": "type_department",
"name": "Engineering"
},
{
"typeId": "type_team",
"name": "Backend",
"parentScopeId": "scope_dept"
},
{
"typeId": "type_team",
"name": "Frontend",
"parentScopeId": "scope_dept"
}
]'
Was this page helpful?