# API reference: Access rules

[Guide index](../../v1.md) · [API reference](../api-reference.md) · [Developer API](../api.md)

## `GET /v1/companies/{companyId}/access-rules`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |

Answers 200 with list of AccessRuleResponse.

## `POST /v1/companies/{companyId}/access-rules`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |

Body (application/json): `AccessRuleRequest`

Answers 201 with `AccessRuleResponse`.

## `DELETE /v1/companies/{companyId}/access-rules/{ruleId}`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `ruleId` | path | string (uuid) | yes |  |
| `notes` | query | `MIRROR` \| `SEPARATE` \| `LEAVE` |  |  |

Answers 204.

## `GET /v1/companies/{companyId}/access-rules/{ruleId}`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `ruleId` | path | string (uuid) | yes |  |

Answers 200 with `AccessRuleResponse`.

## `PUT /v1/companies/{companyId}/access-rules/{ruleId}`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `companyId` | path | string (uuid) | yes |  |
| `ruleId` | path | string (uuid) | yes |  |

Body (application/json): `AccessRuleRequest`

Answers 200 with `AccessRuleResponse`.

## Types

**AccessRuleResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `id` | string (uuid) | yes |  |
| `scope` | `GLOBAL` \| `NODE` | yes |  |
| `nodeId` | string (uuid) |  |  |
| `methodId` | string (uuid) |  |  |
| `propagate` | boolean | yes |  |
| `identityId` | string (uuid) |  |  |
| `permissions` | list of `READ` \| `WRITE` \| `DELETE` | yes |  |
| `validFrom` | string (date-time) |  |  |
| `validUntil` | string (date-time) |  |  |
| `description` | string |  |  |
| `conditions` | list of ConditionResponse | yes |  |
| `verifierId` | string (uuid) |  |  |
| `verificationHours` | integer (int32) |  |  |
| `mirrorOf` | string (uuid) |  |  |
| `createdAt` | string (date-time) | yes |  |
| `updatedAt` | string (date-time) | yes |  |

**AccessRuleRequest**

| Field | Type | Required | Notes |
|---|---|---|---|
| `scope` | `GLOBAL` \| `NODE` | yes |  |
| `nodeId` | string (uuid) |  |  |
| `methodId` | string (uuid) |  |  |
| `propagate` | boolean | yes |  |
| `identityId` | string (uuid) |  |  |
| `permissions` | list of `READ` \| `WRITE` \| `DELETE` | yes |  |
| `validFrom` | string (date-time) |  |  |
| `validUntil` | string (date-time) |  |  |
| `description` | string |  | at most 1000 characters |
| `conditions` | list of ConditionRequest | yes | at most 20 items |
| `verifierId` | string (uuid) |  |  |
| `verificationHours` | integer (int32) |  | from 1; up to 87600 |
| `notes` | NotesChange |  |  |

**ConditionResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `attribute` | string | yes |  |
| `operator` | `EQ` \| `NE` \| `LT` \| `LTE` \| `GT` \| `GTE` \| `CONTAINS` | yes |  |
| `value` | any | yes |  |

**ConditionRequest**

| Field | Type | Required | Notes |
|---|---|---|---|
| `attribute` | string | yes | at least 1 characters |
| `operator` | `EQ` \| `NE` \| `LT` \| `LTE` \| `GT` \| `GTE` \| `CONTAINS` | yes |  |
| `value` | any |  |  |
