---
title: "Upsert a policy"
method: PUT
path: "/policies/{id}"
tags: ["policies"]
---

# Upsert a policy

`PUT /policies/{id}`

Upsert a policy for a given id

## Path parameters

- `id` string, required

## Request body

- NewPolicy
  - `entities` EntityId[], required — A list of entities for this policy
  - `role` string, required — Role for this policy
  - `condition` Condition
    - `attribute` string — Attribute of the request
    - `operator` 'StringEquals' | 'StartsWith' — operator of the condition
    - `values` Value[] — List of truth condition values

## Response `200`

Successfully updated an existing policy for a given id

## Other responses

- `201` — Successfully created a new policy for a given id
- `400` — Invalid request
- `403` — Unauthorised request
- `404` — Requested id can not be found
- `500` — Failed to process the request due to an internal error

---

[API](https://skmtc.net/office-of-national-statistics/apis/permissions-api.md) · [All operations](https://skmtc.net/office-of-national-statistics/apis/permissions-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/office-of-national-statistics/permissions-api/revisions/c0050251683f/schema)
