> ## Documentation Index
> Fetch the complete documentation index at: https://sleekplan.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a document

> A partial update — a field you omit keeps its stored value, and `content: null` clears it.

A version is recorded only when something actually changed, so a client that re-sends identical content does not grow the history. `current_version` and `updated` move only on a real change.



## OpenAPI

````yaml /docs/api/openapi-v2.yaml put /documents/{document_id}
openapi: 3.1.0
info:
  title: Sleekplan API v2
  version: '2.0'
  description: >-
    The `/v2` namespace sits alongside the existing [`/v1`
    API](/docs/api/overview) — it is not a replacement. The same API key
    authenticates both.


    `/v2` accepts **Bearer tokens only**, and carries no workspace ID in the URL
    because the key identifies the workspace. Changes are additive: fields and
    endpoints are added, never removed or renamed.


    See [API v2](/docs/api/v2) for authentication, the error keys, and the rate
    limit.
servers:
  - url: https://api.sleekplan.com/v2
    description: API Version 2
security:
  - BearerAuth: []
tags:
  - name: Group
    description: B2B groups — companies, accounts or teams — and their members.
  - name: Document
    description: >-
      The thinking behind your feedback — a plan, a spec, research, or the
      record of a decision.
paths:
  /documents/{document_id}:
    parameters:
      - name: document_id
        in: path
        required: true
        schema:
          type: integer
        description: Resolve one via `GET /documents?search=`.
    put:
      tags:
        - Document
      summary: Update a document
      description: >-
        A partial update — a field you omit keeps its stored value, and
        `content: null` clears it.


        A version is recorded only when something actually changed, so a client
        that re-sends identical content does not grow the history.
        `current_version` and `updated` move only on a real change.
      operationId: v2-update-document
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                  minLength: 3
                  maxLength: 500
                content:
                  type: string
                  nullable: true
                document_type:
                  type: string
                tags:
                  type: array
                  maxItems: 50
                  items:
                    type: string
                status:
                  type: string
                  enum:
                    - draft
                    - published
                    - archived
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentEnvelope'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    DocumentEnvelope:
      type: object
      properties:
        status:
          type: string
        data:
          $ref: '#/components/schemas/Document'
    Document:
      type: object
      description: >-
        The published shape of a document. Fields are added over time and never
        removed — ignore any you do not recognise.
      properties:
        document_id:
          type: integer
          example: 42
        title:
          type: string
          example: Q4 pricing rework
        slug:
          type: string
          description: Derived from the title on every write. Not settable.
          example: q4-pricing-rework
        document_type:
          type: string
          example: spec
        tags:
          type: array
          items:
            type: string
        status:
          type: string
          enum:
            - draft
            - published
            - archived
        current_version:
          type: integer
          description: >-
            The latest version number. 1 immediately after creation, and it
            moves only when a write actually changes something.
          example: 3
        content:
          type: string
          nullable: true
          description: >-
            Markdown. Returned by create, retrieve and update — never by the
            list endpoint.
        created:
          type: string
          example: '2026-09-18 15:06:55'
        updated:
          type: string
          example: '2026-09-18 15:07:36'
    Error:
      type: object
      properties:
        status:
          type: string
          example: error
        data:
          type: object
          properties:
            key:
              type: string
            message:
              type: string
  responses:
    ValidationError:
      description: A field is missing or malformed
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
              data:
                type: object
                properties:
                  key:
                    type: string
                    example: validation_error
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                        message:
                          type: string
    Unauthorized:
      description: Missing, malformed, or non-API-key credential
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The key's user lacks the permission for this action
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: No such resource in this workspace
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Over 300 requests in 60 seconds
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: '`Authorization: Bearer YOUR_API_KEY`. /v2 accepts no other method.'

````