---
title: "Create or update access rule"
method: POST
path: "/{collection}/access/rules"
tags: ["access control"]
---

# Create or update access rule

`POST /{collection}/access/rules`

If the given rule id matches an existing rule then the rule will be updated. If the rule id is omitted a new id will be generated and returned.

## Path parameters

- `collection` string, required

## Request body

- AccessRule
  - `id` integer — Unique identifier for this rule. Generated if omitted.
  - `policyId` integer, required — Access policy to apply to captures this rule matches
  - `publicMessage` string — Access denied message to be shown to users
  - `privateComment` string — Private notes for curators managing this rule
  - `surts` string[], required — Matches captures with URLs that fit any of the given patterns
  - `captured` object — Matches captures collected during this date range
    - `start` string, date-time
    - `end` string, date-time
  - `accessed` object — Matches captures accessed during this date range
    - `start` string, date-time
    - `end` string, date-time
  - `period` object — Matches captures accessed during this period after their capture date
    - `years` integer
    - `months` integer
    - `days` integer

## Response `200`

OK

## Other responses

- `201` — OK and an id was generated

---

[API](https://skmtc.net/gov/apis/outbackcdx-api.md) · [All operations](https://skmtc.net/gov/apis/outbackcdx-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gov/outbackcdx-api/versions/84cf9da336fb/schema)
