Open Inventory / Docs
EndpointsAccess controlApiAccessRoles

Create an access role

The API runs on your application instance. Schemas and field names come directly from the OpenAPI specification. Session-authenticated requests require a session on that instance.

POST
/api/access/roles

Requires an authenticated browser session with the roles.manage permission. Role keys are stable identifiers used by users and conditional rules.

Authorization

adminSession
cookieauthjs.session-token<token>

Authenticated Auth.js browser session cookie; each operation declares its required permission. Not restricted to administrators. HTTPS deployments use the secure-prefixed cookie variant.

Header Parameters

X-Organization-ID?string

Organization membership selected for this request. User-bound credentials may select any active membership; standalone tokens may only repeat their pinned organization ID.

Formatuuid

Request Body

application/json
  1. body
key*AccessRoleKey

Stable lowercase identifier for a built-in or custom role.

Match^[a-z][a-z0-9_-]{0,63}$
Length1 <= length <= 64
name*string
Length1 <= length <= 120
description?string
Lengthlength <= 1000
Default""
permissions?array<>
Itemsitems <= 30
Default[]

Response Body

Role created

application/json
  1. response
role*
Example Request
curl -X POST 'https://example.com/api/access/roles' \  -H 'Content-Type: application/json' \  -d '{  "key": "editor",  "name": "string"}'
Example Response
{  "role": {    "key": "editor",    "name": "string",    "description": "string",    "permissions": [      "inventory.read"    ],    "isSystem": true,    "memberCount": 0,    "createdBy": "string",    "updatedBy": "string",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }}