---
title: "Set or clear a PR-automation rule"
method: PUT
path: "/api/workspaces/{workspaceId}/pr-automations"
tags: ["PR Automations"]
---

# Set or clear a PR-automation rule

`PUT /api/workspaces/{workspaceId}/pr-automations`

## Request

- Base URL: `https://hiveship.app/api`
- URL: `https://hiveship.app/api/api/workspaces/{workspaceId}/pr-automations`
- Auth: API key in cookie `hiveship_access`

## Path parameters

- `workspaceId` string, required

## Request body

- object
  - `event` 'PR_OPENED' | 'PR_MERGED', required
  - `targetStatusId` string, nullable, required: WorkflowStatus id to transition to, or `null` to clear the rule for this event.

## Response `200`

Rule upserted (or cleared if `targetStatusId === null`). The PUT is intentionally side-effect-only; clients refetch via `GET /pr-automations` if they need the new rule list.

- object
  - `success` boolean, required
  - `data` unknown, required

## Other responses

- `400`: Validation error

---

[API](https://skmtc.dev/hiveship/apis/hiveship-api.md) · [All operations](https://skmtc.dev/hiveship/apis/hiveship-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hiveship/apis/hiveship-api/revisions/73d3e26544e4?raw)
