Open Inventory / Docs
EndpointsAccess controlApiAccessRulesId

Update a conditional inventory access rule

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.

PATCH
/api/access/rules/{id}

Requires an authenticated browser session with the roles.manage permission. Changing a rule revokes user-bound API tokens for its previous and current roles.

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.

Path Parameters

id*string

Inventory access rule identifier.

Formatuuid

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
Properties1 <= properties
name?string
Length1 <= length <= 160
description?string
Lengthlength <= 1000
roleKey?AccessRoleKey

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

Match^[a-z][a-z0-9_-]{0,63}$
Length1 <= length <= 64
permissions?array<>
Items1 <= items <= 7
conditions?array<>

Conditions combined with logical AND.

Items1 <= items <= 12
enabled?boolean
priority?integer
Range0 <= value <= 10000

Response Body

Inventory access rule updated

application/json
  1. response
rule*

Additive permission grant for matching inventory items. Rules never deny permissions already granted by a role; any matching enabled rule may grant access.

Example Request
curl -X PATCH 'https://example.com/api/access/rules/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "rule": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "description": "string",    "roleKey": "editor",    "permissions": [      "inventory.update"    ],    "conditions": [      {        "field": "status",        "operator": "equals",        "value": "string"      }    ],    "enabled": true,    "priority": 0,    "createdBy": "string",    "updatedBy": "string",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }}