Skip to main content
POST
http://localhost:3000
/
memberships
/
batch
curl -X POST 'https://api.example.com/memberships/batch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '[
    {
      "id": "membership_jane_eng",
      "subjectId": "subject_jane",
      "scopeId": "scope_engineering"
    },
    {
      "id": "membership_agent_eng",
      "subjectId": "subject_agent",
      "scopeId": "scope_engineering"
    }
  ]'
[
  {
    "id": "membership_jane_eng",
    "subjectId": "subject_jane",
    "scopeId": "scope_engineering"
  },
  {
    "id": "membership_agent_eng",
    "subjectId": "subject_agent",
    "scopeId": "scope_engineering"
  }
]

Overview

Batch creation allows you to add multiple subjects to scopes in a single API call.
ID Format: All IDs use a namespaced UUIDv7 format: membership_{uuidv7}.

Request Body

Array of membership objects:
[].id
string
Optional client-provided ID. Useful for referencing in role assignments.
[].subjectId
string
required
ID of the subject to add
[].scopeId
string
required
ID of the scope to add the subject to

Response

Returns an array of created membership objects.
curl -X POST 'https://api.example.com/memberships/batch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '[
    {
      "id": "membership_jane_eng",
      "subjectId": "subject_jane",
      "scopeId": "scope_engineering"
    },
    {
      "id": "membership_agent_eng",
      "subjectId": "subject_agent",
      "scopeId": "scope_engineering"
    }
  ]'
[
  {
    "id": "membership_jane_eng",
    "subjectId": "subject_jane",
    "scopeId": "scope_engineering"
  },
  {
    "id": "membership_agent_eng",
    "subjectId": "subject_agent",
    "scopeId": "scope_engineering"
  }
]