Skip to main content
POST
http://localhost:3000
/
roles
/
batch
curl -X POST 'https://api.example.com/roles/batch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '[
    {
      "id": "role_viewer",
      "name": "Viewer",
      "description": "Read-only access",
      "scopeId": "scope_acme"
    },
    {
      "id": "role_editor",
      "name": "Editor",
      "description": "Can read and write",
      "scopeId": "scope_acme"
    },
    {
      "id": "role_admin",
      "name": "Admin",
      "description": "Full access",
      "scopeId": "scope_acme"
    }
  ]'
[
  {
    "id": "role_viewer",
    "name": "Viewer",
    "description": "Read-only access",
    "scopeId": "scope_acme"
  },
  {
    "id": "role_editor",
    "name": "Editor",
    "description": "Can read and write",
    "scopeId": "scope_acme"
  },
  {
    "id": "role_admin",
    "name": "Admin",
    "description": "Full access",
    "scopeId": "scope_acme"
  }
]

Overview

Batch creation allows you to create multiple roles in a single API call.
ID Format: All IDs use a namespaced UUIDv7 format: role_{uuidv7}.

Request Body

Array of role objects:
[].id
string
Optional client-provided ID
[].name
string
required
Display name for the role
[].description
string
Description of the role
[].scopeId
string
required
ID of the scope where this role is defined

Response

Returns an array of created role objects.
curl -X POST 'https://api.example.com/roles/batch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '[
    {
      "id": "role_viewer",
      "name": "Viewer",
      "description": "Read-only access",
      "scopeId": "scope_acme"
    },
    {
      "id": "role_editor",
      "name": "Editor",
      "description": "Can read and write",
      "scopeId": "scope_acme"
    },
    {
      "id": "role_admin",
      "name": "Admin",
      "description": "Full access",
      "scopeId": "scope_acme"
    }
  ]'
[
  {
    "id": "role_viewer",
    "name": "Viewer",
    "description": "Read-only access",
    "scopeId": "scope_acme"
  },
  {
    "id": "role_editor",
    "name": "Editor",
    "description": "Can read and write",
    "scopeId": "scope_acme"
  },
  {
    "id": "role_admin",
    "name": "Admin",
    "description": "Full access",
    "scopeId": "scope_acme"
  }
]