---
title: "Publish a document"
method: PUT
path: "/api/projects/{projectId}/documents/{documentId}/publish"
tags: ["Document"]
---

# Publish a document

`PUT /api/projects/{projectId}/documents/{documentId}/publish`

Publish or unpublish a document version, optionally creating a change request for approval.

## Path parameters

- `documentId` string, uuid, required
- `projectId` string, uuid, required

## Request body

- object
  - `type` 'publish' | 'unpublish' — Action type: publish or unpublish
  - `versionId` string, uuid — Version ID to publish (required for publish)
  - `comment` string, nullable — Comment for the change request

## Response `200`

Document with updated publication status

- object — Document with updated publication status
  - `id` string, uuid, required — Document unique identifier
  - `key` string, required — Materialized lowercase path based on the name
  - `path` string, required — Materialized path based on the name
  - `name` string, required — Document name
  - `type` 'f' | 'd' | 'e', required — Document type (file, directory, or external file)
  - `meta` object — Document metadata
  - `contentType` string — Content MIME type
  - `size` number — Document size in bytes
  - `parentId` string, uuid, nullable — Parent document ID
  - `projectId` string, uuid, required — Project ID
  - `publishedId` string, uuid, nullable — Currently published version ID
  - `publishedAt` string, nullable — Publication timestamp
  - `publishedBy` object — User who published the document
    - `id` string, uuid, required — User unique identifier
    - `email` string, email — User email address
    - `firstName` string, nullable — User first name
    - `lastName` string, nullable — User last name
  - `published` object — Published version details
    - `id` string, uuid, required — Version unique identifier
    - `name` string, nullable — Version name
    - `parentId` string, uuid, nullable — Parent version ID for sub-versions
    - `status` string — Version status (draft or completed)
    - `content` unknown
    - `documentId` string, uuid — Associated document ID
    - `createdBy` object — User who created the version
      - `id` string, uuid, required — User unique identifier
      - `email` string, email — User email address
      - `firstName` string, nullable — User first name
      - `lastName` string, nullable — User last name
    - `createdAt` string — Version creation timestamp
    - `versions` unknown[] — Sub-versions (recursive structure)
      - unknown
    - `releases` object[] — Associated releases
      - `id` string, uuid, required — Release ID
      - `version` string — Release version string
  - `versions` object[] — Document versions
    - `id` string, uuid, required — Version unique identifier
    - `name` string, nullable — Version name
    - `parentId` string, uuid, nullable — Parent version ID for sub-versions
    - `status` string — Version status (draft or completed)
    - `content` unknown
    - `documentId` string, uuid — Associated document ID
    - `createdBy` object — User who created the version
      - `id` string, uuid, required — User unique identifier
      - `email` string, email — User email address
      - `firstName` string, nullable — User first name
      - `lastName` string, nullable — User last name
    - `createdAt` string — Version creation timestamp
    - `versions` unknown[] — Sub-versions (recursive structure)
      - unknown
    - `releases` object[] — Associated releases
      - `id` string, uuid, required — Release ID
      - `version` string — Release version string
  - `changeRequests` object[] — Pending change requests
    - `id` string, uuid, required — Change request unique identifier
    - `type` string, required — Type of change request
    - `status` string, required — Change request status
    - `createdAt` string — Creation timestamp
  - `view` object, nullable — Document view configuration
    - `description` string, nullable — View description
    - `permissions` object, nullable — View permissions mapping
  - `updatedAt` string — Last update timestamp
  - `deletedAt` string, nullable — Deletion timestamp if soft deleted

---

[API](https://skmtc.dev/gorules/apis/gorules-agent-api.md) · [All operations](https://skmtc.dev/gorules/apis/gorules-agent-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/gorules/gorules-agent-api/revisions/52c0773fcd80/schema)
