For the complete documentation index, see llms.txt. This page is also available as Markdown.

Role Mapping Rule

Operations about identity-provider role-mapping rules

Retrieve role-mapping rules

get
/role-mapping-rules

Returns the configured role-mapping rules. order is the rule's evaluation position within its own type, so instance and project rules each have their own sequence starting at 0 — filter by type to retrieve a single evaluation order.

Authorizations
X-N8N-API-KEYstringRequired
Query parameters
limitnumber · max: 250Optional

The maximum number of items to return.

Default: 100Example: 100
cursorstringOptional

Paginate by setting the cursor parameter to the nextCursor attribute returned by the previous request's response. Default value fetches the first "page" of the collection. See pagination for more detail.

typestring · enumOptionalPossible values:
Responses
200

Operation successful.

application/json
nextCursorstring · nullableRequired
get/role-mapping-rules
GET /api/v1/role-mapping-rules HTTP/1.1
X-N8N-API-KEY: YOUR_API_KEY
Accept: */*
{
  "data": [
    {
      "id": "text",
      "expression": "text",
      "role": "text",
      "type": "instance",
      "order": 1,
      "projectIds": [
        "text"
      ],
      "createdAt": "2026-01-01T00:00:00.000Z",
      "updatedAt": "2026-01-01T00:00:00.000Z"
    }
  ],
  "nextCursor": "text"
}

Create a role-mapping rule

post
/role-mapping-rules

Creates a rule that maps an identity-provider claim expression to a role. Set type to instance for a rule granting a global role, or project for a rule granting a project role on the projects named in projectIds. Omitting order appends the rule to the end of the evaluation order for its type.

Authorizations
X-N8N-API-KEYstringRequired
Body
expressionstring · min: 1Required
rolestring · min: 1 · max: 128Required
typestring · enumRequiredPossible values:
orderintegerOptional
projectIdsstring[]Optional
Responses
201

Operation successful.

application/json
idstringRequired
expressionstringRequired
rolestringRequired
typestring · enumRequiredPossible values:
orderintegerRequired
projectIdsstring[]Required
createdAtstring · date-timeRequired
updatedAtstring · date-timeRequired
post/role-mapping-rules
POST /api/v1/role-mapping-rules HTTP/1.1
X-N8N-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 85

{
  "expression": "text",
  "role": "text",
  "type": "instance",
  "order": 1,
  "projectIds": [
    "text"
  ]
}
{
  "id": "text",
  "expression": "text",
  "role": "text",
  "type": "instance",
  "order": 1,
  "projectIds": [
    "text"
  ],
  "createdAt": "2026-01-01T00:00:00.000Z",
  "updatedAt": "2026-01-01T00:00:00.000Z"
}

Move a role-mapping rule

post
/role-mapping-rules/{roleMappingRuleId}/move

Changes a rule's position in the evaluation order for its type. targetIndex is the desired 0-based position within the rule's own type sequence; a value beyond the last position moves the rule to the end.

Authorizations
X-N8N-API-KEYstringRequired
Path parameters
roleMappingRuleIdstringRequired

The ID of the role mapping rule.

Body
targetIndexintegerRequired
Responses
200

Operation successful.

application/json
idstringRequired
expressionstringRequired
rolestringRequired
typestring · enumRequiredPossible values:
orderintegerRequired
projectIdsstring[]Required
createdAtstring · date-timeRequired
updatedAtstring · date-timeRequired
post/role-mapping-rules/{roleMappingRuleId}/move
POST /api/v1/role-mapping-rules/{roleMappingRuleId}/move HTTP/1.1
X-N8N-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 17

{
  "targetIndex": 1
}
{
  "id": "text",
  "expression": "text",
  "role": "text",
  "type": "instance",
  "order": 1,
  "projectIds": [
    "text"
  ],
  "createdAt": "2026-01-01T00:00:00.000Z",
  "updatedAt": "2026-01-01T00:00:00.000Z"
}

Delete a role-mapping rule

delete
/role-mapping-rules/{roleMappingRuleId}

Deletes a role-mapping rule. The remaining rules of the same type close the gap, so their order values stay a contiguous sequence starting at 0.

Authorizations
X-N8N-API-KEYstringRequired
Path parameters
roleMappingRuleIdstringRequired

The ID of the role mapping rule.

Responses
200

Operation successful.

application/json
idstringRequired
expressionstringRequired
rolestringRequired
typestring · enumRequiredPossible values:
orderintegerRequired
projectIdsstring[]Required
createdAtstring · date-timeRequired
updatedAtstring · date-timeRequired
delete/role-mapping-rules/{roleMappingRuleId}
DELETE /api/v1/role-mapping-rules/{roleMappingRuleId} HTTP/1.1
X-N8N-API-KEY: YOUR_API_KEY
Accept: */*
{
  "id": "text",
  "expression": "text",
  "role": "text",
  "type": "instance",
  "order": 1,
  "projectIds": [
    "text"
  ],
  "createdAt": "2026-01-01T00:00:00.000Z",
  "updatedAt": "2026-01-01T00:00:00.000Z"
}

Update a role-mapping rule

patch
/role-mapping-rules/{roleMappingRuleId}

Updates a rule's claim expression, role, and/or project assignments. A rule's type cannot be changed once created, so type isn't accepted here, and reordering is handled by the move endpoint.

Authorizations
X-N8N-API-KEYstringRequired
Path parameters
roleMappingRuleIdstringRequired

The ID of the role mapping rule.

Body
expressionstring · min: 1Optional
rolestring · min: 1 · max: 128Optional
projectIdsstring[]Optional
Responses
200

Operation successful.

application/json
idstringRequired
expressionstringRequired
rolestringRequired
typestring · enumRequiredPossible values:
orderintegerRequired
projectIdsstring[]Required
createdAtstring · date-timeRequired
updatedAtstring · date-timeRequired
patch/role-mapping-rules/{roleMappingRuleId}
PATCH /api/v1/role-mapping-rules/{roleMappingRuleId} HTTP/1.1
X-N8N-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 57

{
  "expression": "text",
  "role": "text",
  "projectIds": [
    "text"
  ]
}
{
  "id": "text",
  "expression": "text",
  "role": "text",
  "type": "instance",
  "order": 1,
  "projectIds": [
    "text"
  ],
  "createdAt": "2026-01-01T00:00:00.000Z",
  "updatedAt": "2026-01-01T00:00:00.000Z"
}

Last updated

Was this helpful?