---
title: "Create or update guidance for a workspace or project (upsert)"
method: PUT
path: "/api/workspaces/{workspaceId}/guidance"
tags: ["Agent Guidance"]
---

# Create or update guidance for a workspace or project (upsert)

`PUT /api/workspaces/{workspaceId}/guidance`

## Request

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

`projectId` is required when `scope` is `"project"` and must be omitted when `scope` is `"workspace"` — a mismatch is a 400.

## Path parameters

- `workspaceId` string, required

## Request body

- object
  - `content` string, required
  - `scope` 'workspace' | 'project'
  - `projectId` string, cuid

## Response `200`

Guidance created or updated

- object
  - `success` boolean, required
  - `data` object, required
    - `id` string, cuid, required
    - `workspaceId` string, cuid, required
    - `projectId` string, cuid, nullable, required
    - `scope` 'workspace' | 'project', required
    - `content` string, required
    - `createdAt` string, required
    - `updatedAt` string, required

## Other responses

- `400`: Validation error
- `403`: Not workspace OWNER/ADMIN, or plan lacks the feature
- `404`: projectId does not belong to this workspace

---

[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)
