{
  "components": {
    "headers": {
      "API-Version": {
        "description": "Version of the API that served the response.",
        "schema": {
          "example": "0.2.0",
          "type": "string"
        }
      },
      "Deprecation": {
        "description": "RFC 9745 deprecation timestamp when an endpoint is scheduled for replacement.",
        "schema": {
          "type": "string"
        }
      },
      "RateLimit-Limit": {
        "description": "Maximum number of requests permitted in the current rate-limit window.",
        "schema": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "RateLimit-Policy": {
        "description": "IETF RateLimit policy declaration (for example `600;w=60`).",
        "schema": {
          "type": "string"
        }
      },
      "RateLimit-Remaining": {
        "description": "Number of requests remaining in the current rate-limit window.",
        "schema": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the rate-limit quota resets.",
        "schema": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying after a 429 Too Many Requests response.",
        "schema": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "Sunset": {
        "description": "RFC 8594 HTTP-date after which a deprecated endpoint will be removed (at least 90 days notice).",
        "schema": {
          "type": "string"
        }
      }
    },
    "parameters": {
      "ApiVersion": {
        "description": "Requested API version label (defaults to the current stable version).",
        "in": "header",
        "name": "API-Version",
        "required": false,
        "schema": {
          "default": "0.2.0",
          "type": "string"
        }
      }
    },
    "schemas": {
      "ProblemDetails": {
        "properties": {
          "code": {
            "description": "Machine-readable error code.",
            "type": "string"
          },
          "detail": {
            "description": "Explanation of this specific error.",
            "type": "string"
          },
          "hint": {
            "description": "Actionable recovery guidance for callers.",
            "type": "string"
          },
          "status": {
            "description": "HTTP status code.",
            "type": "integer"
          },
          "title": {
            "description": "Short summary of the error.",
            "type": "string"
          },
          "type": {
            "description": "Stable URI identifying the error class.",
            "type": "string"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "oauth2": {
        "description": "Least-privilege OAuth 2.1 scopes for authenticated operations; public read operations also accept anonymous requests.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://huddle.ferrite.run/oauth/authorize",
            "scopes": {
              "apps:discover": "Discover available operations, schemas, and public metadata.",
              "apps:read": "Read-only access to declared GET and read-only operations.",
              "apps:write": "Invoke mutating operations and asynchronous jobs."
            },
            "tokenUrl": "https://huddle.ferrite.run/oauth/token"
          }
        },
        "type": "oauth2"
      }
    }
  },
  "info": {
    "description": "Huddle is a shared document workspace that people and agents edit together: documents with one open draft each, numbered revisions, search and an activity feed. Use it to find and read a document, save a draft, publish it as the next revision, or archive a document. Every save and publish names the version it was based on, so a change based on text that somebody has since replaced is refused and nobody's work is overwritten unseen. There are no accounts: every caller reads and changes the same documents.\n\nVersioning and deprecation policy: endpoints are versioned via URL path and the optional `API-Version` header (current version: 0.2.0). Deprecated endpoints emit RFC 9745 `Deprecation` and RFC 8594 `Sunset` response headers at least 90 days before removal. Rate limits are communicated via IETF `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, `RateLimit-Policy`, and `Retry-After` headers.",
    "title": "huddle",
    "version": "0.2.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/activity": {
      "get": {
        "operationId": "list_activity",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The activity feed: recent revisions, newest first.",
                  "properties": {
                    "items": {
                      "description": "The newest revisions across every document, at most 50.",
                      "items": {
                        "description": "One revision matched by a search.",
                        "properties": {
                          "at_ms": {
                            "description": "When it was published.",
                            "type": "string"
                          },
                          "author": {
                            "description": "Who published it.",
                            "type": "string"
                          },
                          "doc_id": {
                            "description": "The document it belongs to.",
                            "type": "string"
                          },
                          "doc_title": {
                            "description": "That document's title.",
                            "type": "string"
                          },
                          "length": {
                            "description": "How many characters the body held.",
                            "type": "integer"
                          },
                          "seq": {
                            "description": "The revision's sequence, one-based.",
                            "type": "integer"
                          }
                        },
                        "required": [
                          "doc_id",
                          "doc_title",
                          "seq",
                          "author",
                          "at_ms",
                          "length"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "truncated": {
                      "description": "Whether older revisions exist beyond this window, or the document read hit its ceiling.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "items",
                    "truncated"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "List the newest published revisions across the whole workspace, at most 50. Use it to see what changed recently without opening each document. Returns the document, revision number, author, time and length of each, newest first.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/docs": {
      "get": {
        "operationId": "list_docs",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The document list.",
                  "properties": {
                    "docs": {
                      "description": "Every document, most recently edited first.",
                      "items": {
                        "description": "One document in the list.",
                        "properties": {
                          "has_draft": {
                            "description": "Whether an unsaved draft is open against it.",
                            "type": "boolean"
                          },
                          "id": {
                            "description": "The document id.",
                            "type": "string"
                          },
                          "idle_minutes": {
                            "description": "How long ago that was, in whole minutes.",
                            "type": "integer"
                          },
                          "revisions": {
                            "description": "How many revisions it carries.",
                            "type": "integer"
                          },
                          "title": {
                            "description": "Its title.",
                            "type": "string"
                          },
                          "updated_at_ms": {
                            "description": "When it was last edited.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "revisions",
                          "has_draft",
                          "updated_at_ms",
                          "idle_minutes"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "total": {
                      "description": "The total count.",
                      "type": "string"
                    },
                    "truncated": {
                      "description": "Whether the list read hit its ceiling.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "docs",
                    "total",
                    "truncated"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "List every document that is not archived, most recently changed first. Use it to find a document id or to see what is being worked on. Returns each document's title, revision number, whether it has an open draft and how many minutes ago it changed, plus the total.",
        "x-idempotent": true,
        "x-read-only": true
      },
      "post": {
        "operationId": "create_doc",
        "parameters": [
          {
            "description": "Retry-safe: a request repeating this key returns the first result instead of running again.",
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "title": {
                    "description": "the document's title, 1 to 200 characters",
                    "examples": [
                      "Meeting notes"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "title"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a document mutation answers with.",
                  "properties": {
                    "id": {
                      "description": "The document id.",
                      "type": "string"
                    },
                    "revisions": {
                      "description": "Its revision count.",
                      "type": "integer"
                    },
                    "title": {
                      "description": "Its title.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "revisions"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Create an empty document. Use it to start something new, then write into it with save_draft and publish_draft. Returns the new document's id, its title and its revision number, which is 0 until something is published.",
        "x-idempotent": true,
        "x-read-only": false
      }
    },
    "/api/docs/{id}": {
      "get": {
        "operationId": "get_doc",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the document id, from list_docs or search_docs",
              "examples": [
                "d-1"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "A document, as the editor renders it.",
                  "properties": {
                    "archived": {
                      "description": "Archived documents retain their content and can be restored.",
                      "type": "boolean"
                    },
                    "body": {
                      "description": "The published body.",
                      "type": "string"
                    },
                    "draft": {
                      "description": "The unsaved draft body, when one is open. A draft is the whole point of this port: it is state that outlives the request that created it, belongs to no revision yet, and must survive a reload without being published.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "draft_at_ms": {
                      "description": "When the draft was last touched, absent when there is none.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "draft_differs": {
                      "description": "Whether the draft differs from the published body. Computed on the SERVER: a client that decided this for itself would disagree with the server the moment someone else published.",
                      "type": "boolean"
                    },
                    "draft_idle_minutes": {
                      "description": "How long the draft has been idle, in whole minutes.",
                      "type": "integer"
                    },
                    "draft_version": {
                      "description": "Monotonic fence for every save, discard and publication.",
                      "type": "integer"
                    },
                    "id": {
                      "description": "The document id.",
                      "type": "string"
                    },
                    "revisions": {
                      "description": "The revision history, newest first.",
                      "items": {
                        "description": "One published revision.",
                        "properties": {
                          "at_ms": {
                            "description": "When it was published.",
                            "type": "string"
                          },
                          "author": {
                            "description": "Who published it.",
                            "type": "string"
                          },
                          "length": {
                            "description": "How many characters the body held.",
                            "type": "integer"
                          },
                          "seq": {
                            "description": "Its sequence, one-based.",
                            "type": "integer"
                          }
                        },
                        "required": [
                          "seq",
                          "author",
                          "at_ms",
                          "length"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "title": {
                      "description": "Its title.",
                      "type": "string"
                    },
                    "updated_at_ms": {
                      "description": "When the document was created, last published, archived or restored: the clock the document list carries for it, so a client holding this view can tell when the list has seen a newer document.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "archived",
                    "id",
                    "title",
                    "body",
                    "revisions",
                    "draft_version",
                    "draft_idle_minutes",
                    "draft_differs",
                    "updated_at_ms"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Read one document with its draft and its history. Use it before you save or publish, because both need the draft_version and the revision number it gives. Returns the published text, the open draft when there is one, and the revisions newest first.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/docs/{id}/archive": {
      "post": {
        "operationId": "archive_doc",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the document id, from list_docs or search_docs",
              "examples": [
                "d-1"
              ],
              "type": "string"
            }
          },
          {
            "description": "Retry-safe: a request repeating this key returns the first result instead of running again.",
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "archived": {
                    "description": "true archives the document, false restores it",
                    "examples": [
                      true
                    ],
                    "type": "boolean"
                  },
                  "id": {
                    "description": "the document id, from list_docs or search_docs",
                    "examples": [
                      "d-1"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "archived"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a document mutation answers with.",
                  "properties": {
                    "id": {
                      "description": "The document id.",
                      "type": "string"
                    },
                    "revisions": {
                      "description": "Its revision count.",
                      "type": "integer"
                    },
                    "title": {
                      "description": "Its title.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "revisions"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Archive a document, or restore an archived one. Use it to take a finished document out of the list, search and activity: its text, draft and revisions stay readable at the same address, and archived set to false brings it back. Returns the document's id, title and revision number.",
        "x-idempotent": true,
        "x-read-only": false
      }
    },
    "/api/docs/{id}/draft": {
      "post": {
        "operationId": "save_draft",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the document id, from list_docs or search_docs",
              "examples": [
                "d-1"
              ],
              "type": "string"
            }
          },
          {
            "description": "Retry-safe: a request repeating this key returns the first result instead of running again.",
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "body": {
                    "description": "the whole text of the draft, at most 20000 characters",
                    "examples": [
                      "Version 2 adds search and an activity page."
                    ],
                    "type": "string"
                  },
                  "expect_draft_version": {
                    "description": "the draft_version from get_doc or from your last save",
                    "examples": [
                      0
                    ],
                    "minimum": 0,
                    "type": "integer"
                  },
                  "id": {
                    "description": "the document id, from list_docs or search_docs",
                    "examples": [
                      "d-1"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "body",
                  "expect_draft_version"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a draft mutation answers with.",
                  "properties": {
                    "draft_differs": {
                      "description": "Whether it differs from the published body.",
                      "type": "boolean"
                    },
                    "draft_version": {
                      "description": "The version acknowledged by this mutation.",
                      "type": "integer"
                    },
                    "has_draft": {
                      "description": "Whether a draft is now open.",
                      "type": "boolean"
                    },
                    "id": {
                      "description": "The document id.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "draft_version",
                    "id",
                    "has_draft",
                    "draft_differs"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Save the document's shared draft without publishing it. Use it to keep work in progress; it replaces the draft everyone sees. Returns the new draft_version to send with the next save, or a conflict when the draft has changed since the version you name.",
        "x-idempotent": true,
        "x-read-only": false
      }
    },
    "/api/docs/{id}/draft/discard": {
      "post": {
        "operationId": "discard_draft",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the document id, from list_docs or search_docs",
              "examples": [
                "d-1"
              ],
              "type": "string"
            }
          },
          {
            "description": "Retry-safe: a request repeating this key returns the first result instead of running again.",
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "expect_draft_version": {
                    "description": "the draft_version from get_doc or from your last save",
                    "examples": [
                      1
                    ],
                    "minimum": 0,
                    "type": "integer"
                  },
                  "id": {
                    "description": "the document id, from list_docs or search_docs",
                    "examples": [
                      "d-1"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "expect_draft_version"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a draft mutation answers with.",
                  "properties": {
                    "draft_differs": {
                      "description": "Whether it differs from the published body.",
                      "type": "boolean"
                    },
                    "draft_version": {
                      "description": "The version acknowledged by this mutation.",
                      "type": "integer"
                    },
                    "has_draft": {
                      "description": "Whether a draft is now open.",
                      "type": "boolean"
                    },
                    "id": {
                      "description": "The document id.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "draft_version",
                    "id",
                    "has_draft",
                    "draft_differs"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Throw away the document's open draft. Use it to drop unpublished changes; the published text and every revision stay as they are. Returns the new draft_version, or a conflict when the draft has changed since the version you name.",
        "x-idempotent": true,
        "x-read-only": false
      }
    },
    "/api/docs/{id}/publish": {
      "post": {
        "operationId": "publish_draft",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the document id, from list_docs or search_docs",
              "examples": [
                "d-1"
              ],
              "type": "string"
            }
          },
          {
            "description": "Retry-safe: a request repeating this key returns the first result instead of running again.",
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "body": {
                    "description": "the exact text you mean to publish; it must equal the saved draft",
                    "examples": [
                      "Version 2 adds search and an activity page."
                    ],
                    "type": "string"
                  },
                  "expect_draft_version": {
                    "description": "the draft_version your last save returned",
                    "examples": [
                      1
                    ],
                    "minimum": 0,
                    "type": "integer"
                  },
                  "expect_revision": {
                    "description": "the number of the revision you edited against, from get_doc; 0 when nothing is published",
                    "examples": [
                      1
                    ],
                    "minimum": 0,
                    "type": "integer"
                  },
                  "id": {
                    "description": "the document id, from list_docs or search_docs",
                    "examples": [
                      "d-1"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "expect_revision",
                  "expect_draft_version",
                  "body"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "What a document mutation answers with.",
                  "properties": {
                    "id": {
                      "description": "The document id.",
                      "type": "string"
                    },
                    "revisions": {
                      "description": "Its revision count.",
                      "type": "integer"
                    },
                    "title": {
                      "description": "Its title.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "revisions"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Publish the open draft as the document's next revision. Use it after save_draft, when the text is ready for everyone. Returns the document's id, title and new revision number, or a refusal with the reason when somebody else published first, the draft differs from the body you send, or there is nothing new to publish.",
        "x-idempotent": true,
        "x-read-only": false
      }
    },
    "/api/search": {
      "get": {
        "operationId": "search_docs",
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "next_cursor from the previous page; leave out for the first page",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "description": "part of a title, an author's name, or a revision number such as #2",
              "examples": [
                "release"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "docs": {
                      "items": {
                        "description": "One document matched by a search.",
                        "properties": {
                          "has_draft": {
                            "description": "Whether an unsaved draft is open against it.",
                            "type": "boolean"
                          },
                          "id": {
                            "description": "The document id.",
                            "type": "string"
                          },
                          "title": {
                            "description": "Its title.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "has_draft"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "has_more": {
                      "description": "Whether another page follows.",
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "description": "Pass as cursor to read the next page; null on the last one.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "query": {
                      "description": "The words as matched: trimmed, in lower case, at most 100 characters.",
                      "type": "string"
                    },
                    "revisions": {
                      "items": {
                        "description": "One revision matched by a search.",
                        "properties": {
                          "at_ms": {
                            "description": "When it was published.",
                            "type": "string"
                          },
                          "author": {
                            "description": "Who published it.",
                            "type": "string"
                          },
                          "doc_id": {
                            "description": "The document it belongs to.",
                            "type": "string"
                          },
                          "doc_title": {
                            "description": "That document's title.",
                            "type": "string"
                          },
                          "length": {
                            "description": "How many characters the body held.",
                            "type": "integer"
                          },
                          "seq": {
                            "description": "The revision's sequence, one-based.",
                            "type": "integer"
                          }
                        },
                        "required": [
                          "doc_id",
                          "doc_title",
                          "seq",
                          "author",
                          "at_ms",
                          "length"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "total_docs": {
                      "description": "How many documents the workspace holds.",
                      "type": "string"
                    },
                    "truncated": {
                      "description": "Whether the workspace was too large to search in full.",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "query",
                    "docs",
                    "revisions",
                    "total_docs",
                    "truncated",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Search document titles, and revisions by author or number, ignoring case. Use it when you know part of a title, or want every revision one author published. Returns matching documents and then matching revisions, up to 20 of each per page, plus next_cursor.",
        "x-idempotent": true,
        "x-read-only": true
      }
    }
  },
  "security": [
    {},
    {
      "oauth2": [
        "apps:discover",
        "apps:read",
        "apps:write"
      ]
    }
  ],
  "servers": [
    {
      "url": "https://huddle.ferrite.run"
    }
  ],
  "x-agent-card": "https://huddle.ferrite.run/.well-known/agent-card.json",
  "x-ard-catalog": "https://huddle.ferrite.run/.well-known/ard.json",
  "x-llms-txt": "https://huddle.ferrite.run/llms.txt",
  "x-mcp-endpoint": "https://huddle.ferrite.run/mcp",
  "x-webmcp": "https://huddle.ferrite.run/.well-known/webmcp.js"
}