{
  "openapi": "3.1.0",
  "info": {
    "title": "Galerne API",
    "version": "1",
    "description": "Generated from the tool registry. Docs: https://www.galerne.eu/docs/api"
  },
  "servers": [
    {
      "url": "https://api.galerne.cloud"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Project token gal_…"
      }
    },
    "parameters": {
      "project": {
        "name": "project",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "project slug"
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "object",
                  "required": [
                    "code",
                    "message"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string"
                          },
                          "rule": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "details": {}
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/p/{project}/v1/tools/get_schema": {
      "post": {
        "operationId": "tool_get_schema",
        "summary": "Get schema",
        "description": "The content model: document types, fields (as JSON Schema), blocks and languages. Call this first.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "type": {
                    "description": "one type only",
                    "type": "string"
                  },
                  "config": {
                    "default": false,
                    "description": "also return the deployed galerne.config.ts as JSON (to propose a change)",
                    "type": "boolean"
                  },
                  "branch": {
                    "description": "the schema a branch uses: its own when one was deployed there with deploy_schema, else main's",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/schema": {
      "get": {
        "operationId": "get_schema",
        "summary": "Get schema",
        "description": "The content model: document types, fields (as JSON Schema), blocks and languages. Call this first.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "description": "one type only",
              "type": "string"
            },
            "description": "one type only"
          },
          {
            "name": "config",
            "in": "query",
            "required": false,
            "schema": {
              "default": false,
              "description": "also return the deployed galerne.config.ts as JSON (to propose a change)",
              "type": "boolean"
            },
            "description": "also return the deployed galerne.config.ts as JSON (to propose a change)"
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "description": "the schema a branch uses: its own when one was deployed there with deploy_schema, else main's",
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "description": "the schema a branch uses: its own when one was deployed there with deploy_schema, else main's"
          }
        ]
      },
      "put": {
        "operationId": "deploy_schema",
        "summary": "Deploy schema",
        "description": "Deploys a schema config. With a branch, the schema applies to that branch only (its docs can use the new types and fields) and is deployed on main when the branch is promoted. Breaking changes need force. Admin rights (galerne schema deploy uses it).",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "config": {
                    "type": "object",
                    "properties": {
                      "languages": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "types": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "blocks": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "structure": {
                        "type": "array",
                        "items": {}
                      },
                      "sources": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "types"
                    ]
                  },
                  "branch": {
                    "description": "deploy on this branch only, with the site code that needs it; omit for main",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "force": {
                    "default": false,
                    "type": "boolean"
                  },
                  "dryRun": {
                    "default": false,
                    "type": "boolean"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "config"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/get_guidelines": {
      "post": {
        "operationId": "tool_get_guidelines",
        "summary": "Get writing guidelines",
        "description": "The project's voice, audience, glossary, banned words and rules. Follow them in everything you write.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/guidelines": {
      "get": {
        "operationId": "get_guidelines",
        "summary": "Get writing guidelines",
        "description": "The project's voice, audience, glossary, banned words and rules. Follow them in everything you write.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ]
      }
    },
    "/p/{project}/v1/tools/query": {
      "post": {
        "operationId": "tool_query",
        "summary": "Query documents",
        "description": "Find documents with a JSON filter. where: { field: value } or { field: { eq, ne, gt, gte, lt, lte, in, nin, contains, includes, exists } }, combined with and / or / not. System fields: _id, _type, _lang, _updatedAt, _createdAt, _publishedAt. order: \"-publishedAt,title\". expand follows references: a depth, or { type: [fields] } to keep only some fields of the referenced docs. The answer lists cache tags (type:<type>, doc:<id>, all) that publish webhooks purge.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "perspective": {
                    "default": "published",
                    "description": "published (default): what sites see; drafts: latest edits, needs the read scope",
                    "type": "string",
                    "enum": [
                      "drafts",
                      "published"
                    ]
                  },
                  "type": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ]
                  },
                  "ids": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "where": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "search": {
                    "description": "full text",
                    "type": "string",
                    "maxLength": 200
                  },
                  "order": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string"
                            },
                            "dir": {
                              "type": "string",
                              "enum": [
                                "asc",
                                "desc"
                              ]
                            }
                          },
                          "required": [
                            "field"
                          ]
                        }
                      }
                    ]
                  },
                  "limit": {
                    "default": 50,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "offset": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "select": {
                    "description": "fields to return; dotted paths reach into expanded references",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expand": {
                    "description": "follow references: a depth (up to 3), or the fields to keep per referenced type, e.g. { \"project\": [\"title\", \"slug\"], \"*\": [\"title\"] }. _id, _type and _lang always come",
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 3
                      },
                      {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    ]
                  },
                  "lang": {
                    "type": "string"
                  },
                  "fallback": {
                    "type": "boolean"
                  },
                  "format": {
                    "default": "markdown",
                    "type": "string",
                    "enum": [
                      "markdown",
                      "json",
                      "html"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/query": {
      "post": {
        "operationId": "query",
        "summary": "Query documents",
        "description": "Find documents with a JSON filter. where: { field: value } or { field: { eq, ne, gt, gte, lt, lte, in, nin, contains, includes, exists } }, combined with and / or / not. System fields: _id, _type, _lang, _updatedAt, _createdAt, _publishedAt. order: \"-publishedAt,title\". expand follows references: a depth, or { type: [fields] } to keep only some fields of the referenced docs. The answer lists cache tags (type:<type>, doc:<id>, all) that publish webhooks purge.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "perspective": {
                    "default": "published",
                    "description": "published (default): what sites see; drafts: latest edits, needs the read scope",
                    "type": "string",
                    "enum": [
                      "drafts",
                      "published"
                    ]
                  },
                  "type": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ]
                  },
                  "ids": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "where": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "search": {
                    "description": "full text",
                    "type": "string",
                    "maxLength": 200
                  },
                  "order": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string"
                            },
                            "dir": {
                              "type": "string",
                              "enum": [
                                "asc",
                                "desc"
                              ]
                            }
                          },
                          "required": [
                            "field"
                          ]
                        }
                      }
                    ]
                  },
                  "limit": {
                    "default": 50,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "offset": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "select": {
                    "description": "fields to return; dotted paths reach into expanded references",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expand": {
                    "description": "follow references: a depth (up to 3), or the fields to keep per referenced type, e.g. { \"project\": [\"title\", \"slug\"], \"*\": [\"title\"] }. _id, _type and _lang always come",
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 3
                      },
                      {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    ]
                  },
                  "lang": {
                    "type": "string"
                  },
                  "fallback": {
                    "type": "boolean"
                  },
                  "format": {
                    "default": "markdown",
                    "type": "string",
                    "enum": [
                      "markdown",
                      "json",
                      "html"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/get_doc": {
      "post": {
        "operationId": "tool_get_doc",
        "summary": "Get a document",
        "description": "One document with its current values (rich text as Markdown), status, revision and studio link. Pass rev to patch_doc to avoid overwriting newer edits.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  },
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "format": {
                    "default": "markdown",
                    "description": "rich text as Markdown (default) or ProseMirror JSON",
                    "type": "string",
                    "enum": [
                      "markdown",
                      "json"
                    ]
                  },
                  "published": {
                    "default": false,
                    "description": "also return the published values",
                    "type": "boolean"
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/docs/{id}": {
      "get": {
        "operationId": "get_doc",
        "summary": "Get a document",
        "description": "One document with its current values (rich text as Markdown), status, revision and studio link. Pass rev to patch_doc to avoid overwriting newer edits.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "default": "main",
              "description": "content branch; \"main\" is live content",
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "description": "content branch; \"main\" is live content"
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "default": "markdown",
              "description": "rich text as Markdown (default) or ProseMirror JSON",
              "type": "string",
              "enum": [
                "markdown",
                "json"
              ]
            },
            "description": "rich text as Markdown (default) or ProseMirror JSON"
          },
          {
            "name": "published",
            "in": "query",
            "required": false,
            "schema": {
              "default": false,
              "description": "also return the published values",
              "type": "boolean"
            },
            "description": "also return the published values"
          }
        ]
      },
      "patch": {
        "operationId": "patch_doc",
        "summary": "Edit a document",
        "description": "Changes fields by path: set { \"title\": \"…\", \"seo.description\": \"…\", \"body\": \"Markdown…\", \"content[<key>].heading\": \"…\", \"role.fr\": \"…\" }, unset [\"path\"], insert items into lists. Pass rev (from get_doc) so edits made meanwhile are not overwritten.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  },
                  "set": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "unset": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "insert": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string"
                        },
                        "items": {
                          "type": "array",
                          "items": {}
                        },
                        "position": {
                          "type": "string",
                          "enum": [
                            "before",
                            "after",
                            "start",
                            "end"
                          ]
                        },
                        "at": {
                          "description": "_key or index for before/after",
                          "type": "string"
                        }
                      },
                      "required": [
                        "path",
                        "items"
                      ]
                    }
                  },
                  "rev": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "branch",
                  "id"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "delete_doc",
        "summary": "Delete a document",
        "description": "Deletes a document on a branch. Refused while other docs reference it (the error lists them).",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branch",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "description": "content branch to write on; agents work on their own branch and call request_review"
            },
            "description": "content branch to write on; agents work on their own branch and call request_review"
          }
        ]
      }
    },
    "/p/{project}/v1/tools/list_docs": {
      "post": {
        "operationId": "tool_list_docs",
        "summary": "List documents",
        "description": "Documents of a type (or all), most recently changed first, with status and last author.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "type": {
                    "type": "string"
                  },
                  "search": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "published",
                      "changed"
                    ]
                  },
                  "changedOnly": {
                    "default": false,
                    "description": "only docs changed on this branch",
                    "type": "boolean"
                  },
                  "limit": {
                    "default": 50,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 500
                  },
                  "offset": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/docs": {
      "get": {
        "operationId": "list_docs",
        "summary": "List documents",
        "description": "Documents of a type (or all), most recently changed first, with status and last author.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "default": "main",
              "description": "content branch; \"main\" is live content",
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "description": "content branch; \"main\" is live content"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "published",
                "changed"
              ]
            }
          },
          {
            "name": "changedOnly",
            "in": "query",
            "required": false,
            "schema": {
              "default": false,
              "description": "only docs changed on this branch",
              "type": "boolean"
            },
            "description": "only docs changed on this branch"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ]
      },
      "post": {
        "operationId": "create_doc",
        "summary": "Create a document",
        "description": "Creates a document on a branch. Values follow get_schema; rich text as Markdown. Incomplete drafts are saved with warnings; invalid values are rejected with the field path and rule.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "type": {
                    "type": "string"
                  },
                  "id": {
                    "description": "optional; generated when omitted (singletons use the type name)",
                    "type": "string",
                    "maxLength": 128
                  },
                  "values": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {},
                    "description": "field values; rich text fields accept Markdown strings"
                  },
                  "lang": {
                    "description": "doc-level i18n: the language of this doc",
                    "type": "string"
                  },
                  "translationOf": {
                    "description": "doc-level i18n: id of the source doc",
                    "type": "string"
                  }
                },
                "required": [
                  "branch",
                  "type",
                  "values"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/search": {
      "post": {
        "operationId": "tool_search",
        "summary": "Search",
        "description": "Full text search over titles and text fields. With semantic=true (Business plan), finds published docs by meaning. Returns ids, types and titles; use get_doc for content.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "type": {
                    "type": "string"
                  },
                  "semantic": {
                    "default": false,
                    "description": "search by meaning in published content on main",
                    "type": "boolean"
                  },
                  "limit": {
                    "default": 20,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/search": {
      "get": {
        "operationId": "search",
        "summary": "Search",
        "description": "Full text search over titles and text fields. With semantic=true (Business plan), finds published docs by meaning. Returns ids, types and titles; use get_doc for content.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "text",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "default": "main",
              "description": "content branch; \"main\" is live content",
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "description": "content branch; \"main\" is live content"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "semantic",
            "in": "query",
            "required": false,
            "schema": {
              "default": false,
              "description": "search by meaning in published content on main",
              "type": "boolean"
            },
            "description": "search by meaning in published content on main"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/get_history": {
      "post": {
        "operationId": "tool_get_history",
        "summary": "Document history",
        "description": "Who changed a document and when (people and agents). Pass two seq values to get the field-level diff between versions.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  },
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "limit": {
                    "default": 50,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200
                  },
                  "diff": {
                    "description": "version seq values; \"to\" defaults to the current draft",
                    "type": "object",
                    "properties": {
                      "from": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "to": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "from"
                    ]
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/docs/{id}/history": {
      "get": {
        "operationId": "get_history",
        "summary": "Document history",
        "description": "Who changed a document and when (people and agents). Pass two seq values to get the field-level diff between versions.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "default": "main",
              "description": "content branch; \"main\" is live content",
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "description": "content branch; \"main\" is live content"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "diff",
            "in": "query",
            "required": false,
            "schema": {
              "description": "version seq values; \"to\" defaults to the current draft",
              "type": "object",
              "properties": {
                "from": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "to": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "from"
              ]
            },
            "description": "version seq values; \"to\" defaults to the current draft"
          }
        ]
      }
    },
    "/p/{project}/v1/tools/list_branches": {
      "post": {
        "operationId": "tool_list_branches",
        "summary": "List branches",
        "description": "Content branches with their status (open, in_review, approved, merged) and number of changed docs.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "includeClosed": {
                    "default": false,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/branches": {
      "get": {
        "operationId": "list_branches",
        "summary": "List branches",
        "description": "Content branches with their status (open, in_review, approved, merged) and number of changed docs.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "includeClosed",
            "in": "query",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ]
      },
      "post": {
        "operationId": "create_branch",
        "summary": "Create a branch",
        "description": "A branch for a unit of work (\"translate to German\", \"alt text pass\"). Docs read through to main until changed on the branch.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "lowercase, e.g. \"agent/translate-de\""
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "release": {
                    "default": false,
                    "description": "a release publishes all its changes together",
                    "type": "boolean"
                  },
                  "publishAt": {
                    "description": "releases: publish at this time",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/get_references": {
      "post": {
        "operationId": "tool_get_references",
        "summary": "References",
        "description": "Documents that reference this one (\"used by\"), and the documents it references.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  },
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/docs/{id}/references": {
      "get": {
        "operationId": "get_references",
        "summary": "References",
        "description": "Documents that reference this one (\"used by\"), and the documents it references.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "default": "main",
              "description": "content branch; \"main\" is live content",
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "description": "content branch; \"main\" is live content"
          }
        ]
      }
    },
    "/p/{project}/v1/tools/check": {
      "post": {
        "operationId": "tool_check",
        "summary": "Check content",
        "description": "Validation and content checks (broken references and links, missing alt text, heading order, missing or outdated translations, duplicates) for one doc, a type, or a whole branch. Use the result as a to-do list.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "type": {
                    "type": "string"
                  },
                  "changedOnly": {
                    "default": false,
                    "type": "boolean"
                  },
                  "unusedMedia": {
                    "default": false,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/check": {
      "post": {
        "operationId": "check",
        "summary": "Check content",
        "description": "Validation and content checks (broken references and links, missing alt text, heading order, missing or outdated translations, duplicates) for one doc, a type, or a whole branch. Use the result as a to-do list.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "type": {
                    "type": "string"
                  },
                  "changedOnly": {
                    "default": false,
                    "type": "boolean"
                  },
                  "unusedMedia": {
                    "default": false,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/create_branch": {
      "post": {
        "operationId": "tool_create_branch",
        "summary": "Create a branch",
        "description": "A branch for a unit of work (\"translate to German\", \"alt text pass\"). Docs read through to main until changed on the branch.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "lowercase, e.g. \"agent/translate-de\""
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "release": {
                    "default": false,
                    "description": "a release publishes all its changes together",
                    "type": "boolean"
                  },
                  "publishAt": {
                    "description": "releases: publish at this time",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/create_doc": {
      "post": {
        "operationId": "tool_create_doc",
        "summary": "Create a document",
        "description": "Creates a document on a branch. Values follow get_schema; rich text as Markdown. Incomplete drafts are saved with warnings; invalid values are rejected with the field path and rule.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "type": {
                    "type": "string"
                  },
                  "id": {
                    "description": "optional; generated when omitted (singletons use the type name)",
                    "type": "string",
                    "maxLength": 128
                  },
                  "values": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {},
                    "description": "field values; rich text fields accept Markdown strings"
                  },
                  "lang": {
                    "description": "doc-level i18n: the language of this doc",
                    "type": "string"
                  },
                  "translationOf": {
                    "description": "doc-level i18n: id of the source doc",
                    "type": "string"
                  }
                },
                "required": [
                  "branch",
                  "type",
                  "values"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/patch_doc": {
      "post": {
        "operationId": "tool_patch_doc",
        "summary": "Edit a document",
        "description": "Changes fields by path: set { \"title\": \"…\", \"seo.description\": \"…\", \"body\": \"Markdown…\", \"content[<key>].heading\": \"…\", \"role.fr\": \"…\" }, unset [\"path\"], insert items into lists. Pass rev (from get_doc) so edits made meanwhile are not overwritten.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  },
                  "set": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "unset": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "insert": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string"
                        },
                        "items": {
                          "type": "array",
                          "items": {}
                        },
                        "position": {
                          "type": "string",
                          "enum": [
                            "before",
                            "after",
                            "start",
                            "end"
                          ]
                        },
                        "at": {
                          "description": "_key or index for before/after",
                          "type": "string"
                        }
                      },
                      "required": [
                        "path",
                        "items"
                      ]
                    }
                  },
                  "rev": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "branch",
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/publish_doc": {
      "post": {
        "operationId": "tool_publish_doc",
        "summary": "Publish a document",
        "description": "Makes the current draft the published version on this branch. On main, sites see it at once. Fails with field errors when the draft is incomplete.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  }
                },
                "required": [
                  "branch",
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/docs/{id}/publish": {
      "post": {
        "operationId": "publish_doc",
        "summary": "Publish a document",
        "description": "Makes the current draft the published version on this branch. On main, sites see it at once. Fails with field errors when the draft is incomplete.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  }
                },
                "required": [
                  "branch",
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/unpublish_doc": {
      "post": {
        "operationId": "tool_unpublish_doc",
        "summary": "Unpublish a document",
        "description": "Removes the published version; the draft stays.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  }
                },
                "required": [
                  "branch",
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/docs/{id}/unpublish": {
      "post": {
        "operationId": "unpublish_doc",
        "summary": "Unpublish a document",
        "description": "Removes the published version; the draft stays.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  }
                },
                "required": [
                  "branch",
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/delete_doc": {
      "post": {
        "operationId": "tool_delete_doc",
        "summary": "Delete a document",
        "description": "Deletes a document on a branch. Refused while other docs reference it (the error lists them).",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  }
                },
                "required": [
                  "branch",
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/restore_version": {
      "post": {
        "operationId": "tool_restore_version",
        "summary": "Restore a version",
        "description": "Restores a past version (seq from get_history), whole or only some field paths, as a new change.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  },
                  "seq": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "paths": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "branch",
                  "id",
                  "seq"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/docs/{id}/restore": {
      "post": {
        "operationId": "restore_version",
        "summary": "Restore a version",
        "description": "Restores a past version (seq from get_history), whole or only some field paths, as a new change.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  },
                  "seq": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "paths": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "branch",
                  "id",
                  "seq"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/upload_media": {
      "post": {
        "operationId": "tool_upload_media",
        "summary": "Upload media",
        "description": "Adds an image or file from a public https URL or base64 data. Returns the media id to use as { \"asset\": id } or ![alt](media:id). Same bytes return the existing id.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "base64": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "mimeType": {
                    "type": "string"
                  },
                  "alt": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "credits": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "tags": {
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 50
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/media/import": {
      "post": {
        "operationId": "upload_media",
        "summary": "Upload media",
        "description": "Adds an image or file from a public https URL or base64 data. Returns the media id to use as { \"asset\": id } or ![alt](media:id). Same bytes return the existing id.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "base64": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "mimeType": {
                    "type": "string"
                  },
                  "alt": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "credits": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "tags": {
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 50
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/list_media": {
      "post": {
        "operationId": "tool_list_media",
        "summary": "List media",
        "description": "Media library with search, tag and type filters; unused=true finds files no doc uses.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "search": {
                    "type": "string"
                  },
                  "tag": {
                    "type": "string"
                  },
                  "mime": {
                    "description": "e.g. \"image/\"",
                    "type": "string"
                  },
                  "unused": {
                    "default": false,
                    "type": "boolean"
                  },
                  "limit": {
                    "default": 50,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 500
                  },
                  "offset": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/media": {
      "get": {
        "operationId": "list_media",
        "summary": "List media",
        "description": "Media library with search, tag and type filters; unused=true finds files no doc uses.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mime",
            "in": "query",
            "required": false,
            "schema": {
              "description": "e.g. \"image/\"",
              "type": "string"
            },
            "description": "e.g. \"image/\""
          },
          {
            "name": "unused",
            "in": "query",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/get_media": {
      "post": {
        "operationId": "tool_get_media",
        "summary": "Get media",
        "description": "One media file: details, URL and the docs that use it.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/media/{id}/info": {
      "get": {
        "operationId": "get_media",
        "summary": "Get media",
        "description": "One media file: details, URL and the docs that use it.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/update_media": {
      "post": {
        "operationId": "tool_update_media",
        "summary": "Update media details",
        "description": "Sets alt text, title, caption, credits, license, tags or expiry of a media file. Use it for alt text passes.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "alt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "title": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "caption": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "credits": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "license": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "tags": {
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 50
                    }
                  },
                  "expiresAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/media/{id}": {
      "patch": {
        "operationId": "update_media",
        "summary": "Update media details",
        "description": "Sets alt text, title, caption, credits, license, tags or expiry of a media file. Use it for alt text passes.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "alt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "title": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "caption": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "credits": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "license": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "tags": {
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 50
                    }
                  },
                  "expiresAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "delete_media",
        "summary": "Delete media",
        "description": "Deletes a media file. Refused while docs use it (the error lists them).",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "put": {
        "operationId": "replace_media",
        "summary": "Replace a media file",
        "description": "Replaces the bytes of a media file in place: same id, so every doc using it shows the new file.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "base64": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "filename": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "mimeType": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/branch_changes": {
      "post": {
        "operationId": "tool_branch_changes",
        "summary": "Branch review",
        "description": "What a branch changes: docs created, edited or deleted, field-level diffs, conflicts with main, validation errors, the schema deployed on the branch (what promotion deploys on main), review events and content checks.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/branches/{branch}/changes": {
      "get": {
        "operationId": "branch_changes",
        "summary": "Branch review",
        "description": "What a branch changes: docs created, edited or deleted, field-level diffs, conflicts with main, validation errors, the schema deployed on the branch (what promotion deploys on main), review events and content checks.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/request_review": {
      "post": {
        "operationId": "tool_request_review",
        "summary": "Request review",
        "description": "Asks people to review a branch. Summarize what you changed and why in the note; reviewers see it with the diff.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 5000
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/branches/{branch}/review": {
      "post": {
        "operationId": "request_review",
        "summary": "Request review",
        "description": "Asks people to review a branch. Summarize what you changed and why in the note; reviewers see it with the diff.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 5000
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/approve": {
      "post": {
        "operationId": "tool_approve",
        "summary": "Approve or request changes",
        "description": "Approves a branch under review, or asks for changes with a note.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "approved",
                      "changes_requested"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 5000
                  }
                },
                "required": [
                  "branch",
                  "decision"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/branches/{branch}/decision": {
      "post": {
        "operationId": "approve",
        "summary": "Approve or request changes",
        "description": "Approves a branch under review, or asks for changes with a note.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "approved",
                      "changes_requested"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 5000
                  }
                },
                "required": [
                  "branch",
                  "decision"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/comment": {
      "post": {
        "operationId": "tool_comment",
        "summary": "Comment",
        "description": "Comments on a doc (optionally a field path) or a branch. Mention people with @email or @[Name]. With assignee, the comment is a task.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "id": {
                    "description": "doc id; omit to comment on the branch",
                    "type": "string"
                  },
                  "path": {
                    "type": "string"
                  },
                  "parentId": {
                    "description": "reply to this comment",
                    "type": "string"
                  },
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "assignee": {
                    "description": "member id; makes the comment a task",
                    "type": "string"
                  },
                  "dueAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  }
                },
                "required": [
                  "body"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/comments": {
      "post": {
        "operationId": "comment",
        "summary": "Comment",
        "description": "Comments on a doc (optionally a field path) or a branch. Mention people with @email or @[Name]. With assignee, the comment is a task.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "id": {
                    "description": "doc id; omit to comment on the branch",
                    "type": "string"
                  },
                  "path": {
                    "type": "string"
                  },
                  "parentId": {
                    "description": "reply to this comment",
                    "type": "string"
                  },
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "assignee": {
                    "description": "member id; makes the comment a task",
                    "type": "string"
                  },
                  "dueAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  }
                },
                "required": [
                  "body"
                ]
              }
            }
          }
        }
      },
      "get": {
        "operationId": "list_comments",
        "summary": "List comments",
        "description": "Comments and tasks on a doc or branch.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeResolved",
            "in": "query",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "name": "openTasks",
            "in": "query",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/list_comments": {
      "post": {
        "operationId": "tool_list_comments",
        "summary": "List comments",
        "description": "Comments and tasks on a doc or branch.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string"
                  },
                  "id": {
                    "type": "string"
                  },
                  "includeResolved": {
                    "default": false,
                    "type": "boolean"
                  },
                  "openTasks": {
                    "default": false,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/promote": {
      "post": {
        "operationId": "tool_promote",
        "summary": "Promote a branch",
        "description": "Merges a branch into main (text merges by character; fields both sides changed are conflicts). A schema deployed on the branch is deployed on main first. With publish, the merged docs go live. Agents need the promote right; most should call request_review instead. With a site, the code branch of the same name is merged into main too, and production rebuilds.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "publish": {
                    "default": false,
                    "type": "boolean"
                  },
                  "onConflict": {
                    "description": "which side wins on conflicting fields; without it, conflicts stop the promotion",
                    "type": "string",
                    "enum": [
                      "branch",
                      "main"
                    ]
                  },
                  "docs": {
                    "description": "promote only these docs",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/branches/{branch}/promote": {
      "post": {
        "operationId": "promote",
        "summary": "Promote a branch",
        "description": "Merges a branch into main (text merges by character; fields both sides changed are conflicts). A schema deployed on the branch is deployed on main first. With publish, the merged docs go live. Agents need the promote right; most should call request_review instead. With a site, the code branch of the same name is merged into main too, and production rebuilds.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "publish": {
                    "default": false,
                    "type": "boolean"
                  },
                  "onConflict": {
                    "description": "which side wins on conflicting fields; without it, conflicts stop the promotion",
                    "type": "string",
                    "enum": [
                      "branch",
                      "main"
                    ]
                  },
                  "docs": {
                    "description": "promote only these docs",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/update_from_main": {
      "post": {
        "operationId": "tool_update_from_main",
        "summary": "Update branch from main",
        "description": "Brings changes made on main since the branch started into the branch. Branch values win on conflicting fields; the result lists them.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/branches/{branch}/update": {
      "post": {
        "operationId": "update_from_main",
        "summary": "Update branch from main",
        "description": "Brings changes made on main since the branch started into the branch. Branch values win on conflicting fields; the result lists them.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/close_branch": {
      "post": {
        "operationId": "tool_close_branch",
        "summary": "Close a branch",
        "description": "Closes a branch without promoting it. Its changes stay in history.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/branches/{branch}": {
      "delete": {
        "operationId": "close_branch",
        "summary": "Close a branch",
        "description": "Closes a branch without promoting it. Its changes stay in history.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "operationId": "update_branch",
        "summary": "Update a branch",
        "description": "Changes a branch title or description, or makes it a release with a publish time (publishAt null removes the time).",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "publishAt": {
                    "description": "releases: publish at this time; null removes it",
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/schedule": {
      "post": {
        "operationId": "tool_schedule",
        "summary": "Schedule publishing",
        "description": "Publishes or unpublishes a doc at a time (ISO 8601 with offset).",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "publish",
                      "unpublish"
                    ]
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  }
                },
                "required": [
                  "branch",
                  "id",
                  "action",
                  "at"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/docs/{id}/schedule": {
      "post": {
        "operationId": "schedule",
        "summary": "Schedule publishing",
        "description": "Publishes or unpublishes a doc at a time (ISO 8601 with offset).",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "publish",
                      "unpublish"
                    ]
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  }
                },
                "required": [
                  "branch",
                  "id",
                  "action",
                  "at"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/list_schedules": {
      "post": {
        "operationId": "tool_list_schedules",
        "summary": "Scheduled publishing",
        "description": "Lists the pending scheduled publishes, unpublishes and releases, soonest first. Filter by branch or doc.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "document id"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/schedules": {
      "get": {
        "operationId": "list_schedules",
        "summary": "Scheduled publishing",
        "description": "Lists the pending scheduled publishes, unpublishes and releases, soonest first. Filter by branch or doc.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "description": "document id"
            },
            "description": "document id"
          }
        ]
      }
    },
    "/p/{project}/v1/tools/cancel_schedule": {
      "post": {
        "operationId": "tool_cancel_schedule",
        "summary": "Cancel a scheduled publish",
        "description": "Cancels a pending scheduled publish or unpublish. A release is canceled with update_branch and publishAt null.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "schedule": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "schedule id, from list_schedules or schedule"
                  }
                },
                "required": [
                  "schedule"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/schedules/{schedule}": {
      "delete": {
        "operationId": "cancel_schedule",
        "summary": "Cancel a scheduled publish",
        "description": "Cancels a pending scheduled publish or unpublish. A release is canceled with update_branch and publishAt null.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "schedule",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/propose_schema_change": {
      "post": {
        "operationId": "tool_propose_schema_change",
        "summary": "Propose a schema change",
        "description": "Checks a full schema config (galerne.config.ts as JSON) against the one deployed on main and returns the diff and problems. Nothing is deployed; deploy_schema with a branch makes it apply to that branch.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "config": {
                    "type": "object",
                    "properties": {
                      "languages": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "types": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "blocks": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "structure": {
                        "type": "array",
                        "items": {}
                      },
                      "sources": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "types"
                    ]
                  }
                },
                "required": [
                  "config"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/schema/diff": {
      "post": {
        "operationId": "propose_schema_change",
        "summary": "Propose a schema change",
        "description": "Checks a full schema config (galerne.config.ts as JSON) against the one deployed on main and returns the diff and problems. Nothing is deployed; deploy_schema with a branch makes it apply to that branch.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "config": {
                    "type": "object",
                    "properties": {
                      "languages": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "types": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "blocks": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "structure": {
                        "type": "array",
                        "items": {}
                      },
                      "sources": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "types"
                    ]
                  }
                },
                "required": [
                  "config"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/deploy_schema": {
      "post": {
        "operationId": "tool_deploy_schema",
        "summary": "Deploy schema",
        "description": "Deploys a schema config. With a branch, the schema applies to that branch only (its docs can use the new types and fields) and is deployed on main when the branch is promoted. Breaking changes need force. Admin rights (galerne schema deploy uses it).",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "config": {
                    "type": "object",
                    "properties": {
                      "languages": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "types": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "blocks": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "structure": {
                        "type": "array",
                        "items": {}
                      },
                      "sources": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "types"
                    ]
                  },
                  "branch": {
                    "description": "deploy on this branch only, with the site code that needs it; omit for main",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "force": {
                    "default": false,
                    "type": "boolean"
                  },
                  "dryRun": {
                    "default": false,
                    "type": "boolean"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "config"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/get_audit_log": {
      "post": {
        "operationId": "tool_get_audit_log",
        "summary": "Audit log",
        "description": "Who (person, agent or token) did what on this project, newest first. Business plan.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "limit": {
                    "default": 100,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "before": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "actor": {
                    "type": "string"
                  },
                  "action": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/audit": {
      "get": {
        "operationId": "get_audit_log",
        "summary": "Audit log",
        "description": "Who (person, agent or token) did what on this project, newest first. Business plan.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "actor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/accessibility_report": {
      "post": {
        "operationId": "tool_accessibility_report",
        "summary": "Accessibility report",
        "description": "Accessibility issues in content (European Accessibility Act): images without alt text, skipped heading levels, vague link text. Counts per type and the list to fix.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "description": "content branch; \"main\" is live content",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "type": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/accessibility": {
      "get": {
        "operationId": "accessibility_report",
        "summary": "Accessibility report",
        "description": "Accessibility issues in content (European Accessibility Act): images without alt text, skipped heading levels, vague link text. Counts per type and the list to fix.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "default": "main",
              "description": "content branch; \"main\" is live content",
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "description": "content branch; \"main\" is live content"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/update_branch": {
      "post": {
        "operationId": "tool_update_branch",
        "summary": "Update a branch",
        "description": "Changes a branch title or description, or makes it a release with a publish time (publishAt null removes the time).",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "content branch to write on; agents work on their own branch and call request_review"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "publishAt": {
                    "description": "releases: publish at this time; null removes it",
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/rollback_promotion": {
      "post": {
        "operationId": "tool_rollback_promotion",
        "summary": "Roll back a promotion",
        "description": "Puts the docs a promotion (or release) changed on main back to their state before it, as new changes.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "promotionId": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "promotionId"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/promotions/{promotionId}/rollback": {
      "post": {
        "operationId": "rollback_promotion",
        "summary": "Roll back a promotion",
        "description": "Puts the docs a promotion (or release) changed on main back to their state before it, as new changes.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "promotionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "promotionId": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "promotionId"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/update_comment": {
      "post": {
        "operationId": "tool_update_comment",
        "summary": "Update a comment",
        "description": "Edits your comment, resolves or reopens a thread, marks a task done, or changes its assignee or due date.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "resolved": {
                    "type": "boolean"
                  },
                  "done": {
                    "type": "boolean"
                  },
                  "assignee": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "dueAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/comments/{id}": {
      "patch": {
        "operationId": "update_comment",
        "summary": "Update a comment",
        "description": "Edits your comment, resolves or reopens a thread, marks a task done, or changes its assignee or due date.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000
                  },
                  "resolved": {
                    "type": "boolean"
                  },
                  "done": {
                    "type": "boolean"
                  },
                  "assignee": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "dueAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "delete_comment",
        "summary": "Delete a comment",
        "description": "Deletes a comment and its replies. Authors delete their own; admins any.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/delete_comment": {
      "post": {
        "operationId": "tool_delete_comment",
        "summary": "Delete a comment",
        "description": "Deletes a comment and its replies. Authors delete their own; admins any.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/delete_media": {
      "post": {
        "operationId": "tool_delete_media",
        "summary": "Delete media",
        "description": "Deletes a media file. Refused while docs use it (the error lists them).",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/replace_media": {
      "post": {
        "operationId": "tool_replace_media",
        "summary": "Replace a media file",
        "description": "Replaces the bytes of a media file in place: same id, so every doc using it shows the new file.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "base64": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "filename": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "mimeType": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/get_cache_settings": {
      "post": {
        "operationId": "tool_get_cache_settings",
        "summary": "Cache settings",
        "description": "Per type: how long sites cache answers that depend on it (life: seconds, minutes, hours, days, weeks, max), and which other types a publish of it also purges (purges).",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/cache": {
      "get": {
        "operationId": "get_cache_settings",
        "summary": "Cache settings",
        "description": "Per type: how long sites cache answers that depend on it (life: seconds, minutes, hours, days, weeks, max), and which other types a publish of it also purges (purges).",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ]
      },
      "put": {
        "operationId": "set_cache_settings",
        "summary": "Set cache settings",
        "description": "Sets the cache settings of some types (expert mode). life: how long sites keep answers; purges: other types whose cached answers a publish of this type also refreshes (e.g. post purges home). null clears a type.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "types": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "life": {
                              "type": "string",
                              "enum": [
                                "seconds",
                                "minutes",
                                "hours",
                                "days",
                                "weeks",
                                "max"
                              ]
                            },
                            "purges": {
                              "maxItems": 50,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "maxLength": 64
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "types"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/set_cache_settings": {
      "post": {
        "operationId": "tool_set_cache_settings",
        "summary": "Set cache settings",
        "description": "Sets the cache settings of some types (expert mode). life: how long sites keep answers; purges: other types whose cached answers a publish of this type also refreshes (e.g. post purges home). null clears a type.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "types": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "life": {
                              "type": "string",
                              "enum": [
                                "seconds",
                                "minutes",
                                "hours",
                                "days",
                                "weeks",
                                "max"
                              ]
                            },
                            "purges": {
                              "maxItems": 50,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "maxLength": 64
                              }
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "types"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/import_from": {
      "post": {
        "operationId": "tool_import_from",
        "summary": "Import from another CMS",
        "description": "Copies content from Sanity, Contentful, Storyblok, WordPress, Payload or Markdown files into a branch (default import/<cms>-<date>): schema inferred, docs with references, rich text, translations, drafts and assets, ids kept. Re-runnable: a second run changes nothing. Credentials go in options for this call only and are never stored. Use dryRun first to read the report and the inferred galerne.config.ts.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "cms": {
                    "type": "string",
                    "enum": [
                      "sanity",
                      "contentful",
                      "storyblok",
                      "wordpress",
                      "payload",
                      "markdown",
                      "galerne",
                      "strapi",
                      "hygraph",
                      "prismic",
                      "directus"
                    ]
                  },
                  "options": {
                    "default": {},
                    "description": "source options, never stored: sanity { projectId, dataset, token? } or { data: NDJSON }; contentful { url | data: export JSON }; storyblok { token, managementToken?, space? }; wordpress { url | data: WXR XML }; payload { url, collections, token? }; markdown { files: [{ path, content }] }",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "branch": {
                    "description": "target branch; created when missing",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "dryRun": {
                    "default": false,
                    "type": "boolean"
                  },
                  "allMedia": {
                    "default": false,
                    "description": "also import assets no doc uses",
                    "type": "boolean"
                  }
                },
                "required": [
                  "cms"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/import/from": {
      "post": {
        "operationId": "import_from",
        "summary": "Import from another CMS",
        "description": "Copies content from Sanity, Contentful, Storyblok, WordPress, Payload or Markdown files into a branch (default import/<cms>-<date>): schema inferred, docs with references, rich text, translations, drafts and assets, ids kept. Re-runnable: a second run changes nothing. Credentials go in options for this call only and are never stored. Use dryRun first to read the report and the inferred galerne.config.ts.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "cms": {
                    "type": "string",
                    "enum": [
                      "sanity",
                      "contentful",
                      "storyblok",
                      "wordpress",
                      "payload",
                      "markdown",
                      "galerne",
                      "strapi",
                      "hygraph",
                      "prismic",
                      "directus"
                    ]
                  },
                  "options": {
                    "default": {},
                    "description": "source options, never stored: sanity { projectId, dataset, token? } or { data: NDJSON }; contentful { url | data: export JSON }; storyblok { token, managementToken?, space? }; wordpress { url | data: WXR XML }; payload { url, collections, token? }; markdown { files: [{ path, content }] }",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "branch": {
                    "description": "target branch; created when missing",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "dryRun": {
                    "default": false,
                    "type": "boolean"
                  },
                  "allMedia": {
                    "default": false,
                    "description": "also import assets no doc uses",
                    "type": "boolean"
                  }
                },
                "required": [
                  "cms"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/export_to": {
      "post": {
        "operationId": "tool_export_to",
        "summary": "Export to another CMS",
        "description": "Writes a branch in another CMS format (schema, content, assets): sanity, contentful, storyblok, wordpress, payload, markdown, or galerne (the plain export). Returns the text files inline and the media as URLs; set includeMedia to get them as base64 (up to 20 MB).",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "cms": {
                    "type": "string",
                    "enum": [
                      "sanity",
                      "contentful",
                      "storyblok",
                      "wordpress",
                      "payload",
                      "markdown",
                      "galerne",
                      "strapi",
                      "hygraph",
                      "prismic",
                      "directus"
                    ]
                  },
                  "branch": {
                    "default": "main",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "options": {
                    "default": {},
                    "description": "target options, e.g. sanity { dataset }",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "includeMedia": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "cms"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/export/to": {
      "post": {
        "operationId": "export_to",
        "summary": "Export to another CMS",
        "description": "Writes a branch in another CMS format (schema, content, assets): sanity, contentful, storyblok, wordpress, payload, markdown, or galerne (the plain export). Returns the text files inline and the media as URLs; set includeMedia to get them as base64 (up to 20 MB).",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "cms": {
                    "type": "string",
                    "enum": [
                      "sanity",
                      "contentful",
                      "storyblok",
                      "wordpress",
                      "payload",
                      "markdown",
                      "galerne",
                      "strapi",
                      "hygraph",
                      "prismic",
                      "directus"
                    ]
                  },
                  "branch": {
                    "default": "main",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "options": {
                    "default": {},
                    "description": "target options, e.g. sanity { dataset }",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "includeMedia": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "cms"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/get_analytics": {
      "post": {
        "operationId": "tool_get_analytics",
        "summary": "Page views",
        "description": "Page views of a published doc over the last 30 days (site analytics), per day, with the trend of the last 7 days against the 7 before. Needs the site URL and routes in project settings. Business plan.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/docs/{id}/analytics": {
      "get": {
        "operationId": "get_analytics",
        "summary": "Page views",
        "description": "Page views of a published doc over the last 30 days (site analytics), per day, with the trend of the last 7 days against the 7 before. Needs the site URL and routes in project settings. Business plan.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/create_site": {
      "post": {
        "operationId": "tool_create_site",
        "summary": "Create the site",
        "description": "Creates the project's site: a git repo from a template on Galerne's Forgejo, a site on Tramontane (EU hosting) built from it, its environment (API URL, project, read and preview tokens, preview and webhook secrets) and the revalidation webhook. Templates: \"starter\" brings its own sample model (page, post, person, settings, strings and 16 blocks) for a new project; \"bare\" is for a project that already has content types (imported, or modelled before): the kit wiring, previews, the design browser and tokens, galerne.config.ts written from the deployed schema, and one page that renders any routed doc with its blocks shown as plain fields until you build their components. Pick \"bare\" when get_schema lists types of your own. Without template, bare is used when the deployed schema has types the starter does not define, else starter. Runs again safely: steps already done are kept. Then agents change the code on branches with write_files (AGENTS.md in the repo says how).",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "template": {
                    "description": "starter for a new project, bare for a project with its own content model; default: bare when the deployed schema has types the starter does not define",
                    "type": "string",
                    "enum": [
                      "starter",
                      "bare"
                    ]
                  },
                  "name": {
                    "description": "site name on Tramontane; defaults to the project name",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/site": {
      "post": {
        "operationId": "create_site",
        "summary": "Create the site",
        "description": "Creates the project's site: a git repo from a template on Galerne's Forgejo, a site on Tramontane (EU hosting) built from it, its environment (API URL, project, read and preview tokens, preview and webhook secrets) and the revalidation webhook. Templates: \"starter\" brings its own sample model (page, post, person, settings, strings and 16 blocks) for a new project; \"bare\" is for a project that already has content types (imported, or modelled before): the kit wiring, previews, the design browser and tokens, galerne.config.ts written from the deployed schema, and one page that renders any routed doc with its blocks shown as plain fields until you build their components. Pick \"bare\" when get_schema lists types of your own. Without template, bare is used when the deployed schema has types the starter does not define, else starter. Runs again safely: steps already done are kept. Then agents change the code on branches with write_files (AGENTS.md in the repo says how).",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "template": {
                    "description": "starter for a new project, bare for a project with its own content model; default: bare when the deployed schema has types the starter does not define",
                    "type": "string",
                    "enum": [
                      "starter",
                      "bare"
                    ]
                  },
                  "name": {
                    "description": "site name on Tramontane; defaults to the project name",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "delete_site",
        "summary": "Delete the site",
        "description": "Deletes the project's managed site: the hosted site on Tramontane, the git repo and its mirrors settings, git access, the site's tokens and its revalidation webhook. Content stays. People only; `confirm` must be the project slug. Mirrors elsewhere (GitHub, GitLab) keep their copy.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "confirm",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/delete_site": {
      "post": {
        "operationId": "tool_delete_site",
        "summary": "Delete the site",
        "description": "Deletes the project's managed site: the hosted site on Tramontane, the git repo and its mirrors settings, git access, the site's tokens and its revalidation webhook. Content stays. People only; `confirm` must be the project slug. Mirrors elsewhere (GitHub, GitLab) keep their copy.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "confirm": {
                    "type": "string"
                  }
                },
                "required": [
                  "confirm"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/refresh_site": {
      "post": {
        "operationId": "tool_refresh_site",
        "summary": "Refresh the site",
        "description": "Reads the hosted site again, stores its URL, wires the revalidation webhook once the URL is known (then rebuilds production), and gives the site the current API URL and preview secrets again (after a rotation; branch builds get their own secret and draft token if they have none yet). With rebuild, production builds again so new values apply.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "rebuild": {
                    "default": false,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/site/refresh": {
      "post": {
        "operationId": "refresh_site",
        "summary": "Refresh the site",
        "description": "Reads the hosted site again, stores its URL, wires the revalidation webhook once the URL is known (then rebuilds production), and gives the site the current API URL and preview secrets again (after a rotation; branch builds get their own secret and draft token if they have none yet). With rebuild, production builds again so new values apply.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "rebuild": {
                    "default": false,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/list_files": {
      "post": {
        "operationId": "tool_list_files",
        "summary": "List code files",
        "description": "Files of the site repo on a branch, optionally under a folder. Sizes in bytes.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "path": {
                    "description": "folder, e.g. \"app/blocks\"",
                    "type": "string",
                    "maxLength": 300
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/code/files": {
      "get": {
        "operationId": "list_files",
        "summary": "List code files",
        "description": "Files of the site repo on a branch, optionally under a folder. Sizes in bytes.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "default": "main",
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
            },
            "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
          },
          {
            "name": "path",
            "in": "query",
            "required": false,
            "schema": {
              "description": "folder, e.g. \"app/blocks\"",
              "type": "string",
              "maxLength": 300
            },
            "description": "folder, e.g. \"app/blocks\""
          }
        ]
      }
    },
    "/p/{project}/v1/tools/read_file": {
      "post": {
        "operationId": "tool_read_file",
        "summary": "Read a code file",
        "description": "One file of the site repo on a branch: text as UTF-8, other files as base64 (1 MB at most).",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "path": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  }
                },
                "required": [
                  "path"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/code/file": {
      "get": {
        "operationId": "read_file",
        "summary": "Read a code file",
        "description": "One file of the site repo on a branch: text as UTF-8, other files as base64 (1 MB at most).",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "default": "main",
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
            },
            "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
          },
          {
            "name": "path",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/write_files": {
      "post": {
        "operationId": "tool_write_files",
        "summary": "Write code files",
        "description": "Creates, updates or deletes files of the site repo in one commit on a branch (created from main when new, with the content branch of the same name). Up to 200 files, 1 MB each, 8 MB in all. Secrets files (.env, keys) are refused: the site gets its secrets from its environment. Agents write on their own branch; the push builds a preview (preview_url, build_status).",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "commit message"
                  },
                  "files": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "content": {
                          "description": "the whole new content; omit with delete",
                          "type": "string"
                        },
                        "encoding": {
                          "default": "utf8",
                          "type": "string",
                          "enum": [
                            "utf8",
                            "base64"
                          ]
                        },
                        "delete": {
                          "default": false,
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "path"
                      ]
                    }
                  }
                },
                "required": [
                  "branch",
                  "message",
                  "files"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/code/commits": {
      "post": {
        "operationId": "write_files",
        "summary": "Write code files",
        "description": "Creates, updates or deletes files of the site repo in one commit on a branch (created from main when new, with the content branch of the same name). Up to 200 files, 1 MB each, 8 MB in all. Secrets files (.env, keys) are refused: the site gets its secrets from its environment. Agents write on their own branch; the push builds a preview (preview_url, build_status).",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500,
                    "description": "commit message"
                  },
                  "files": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "content": {
                          "description": "the whole new content; omit with delete",
                          "type": "string"
                        },
                        "encoding": {
                          "default": "utf8",
                          "type": "string",
                          "enum": [
                            "utf8",
                            "base64"
                          ]
                        },
                        "delete": {
                          "default": false,
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "path"
                      ]
                    }
                  }
                },
                "required": [
                  "branch",
                  "message",
                  "files"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/code_branches": {
      "post": {
        "operationId": "tool_code_branches",
        "summary": "Code branches",
        "description": "Branches of the site repo with their last commit, the content branch of the same name, and the preview URL when built.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/code/branches": {
      "get": {
        "operationId": "code_branches",
        "summary": "Code branches",
        "description": "Branches of the site repo with their last commit, the content branch of the same name, and the preview URL when built.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ]
      }
    },
    "/p/{project}/v1/tools/code_changes": {
      "post": {
        "operationId": "tool_code_changes",
        "summary": "Code changes of a branch",
        "description": "Commits and files a branch changes compared to main: what a review of the branch covers on the code side.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/code/changes": {
      "get": {
        "operationId": "code_changes",
        "summary": "Code changes of a branch",
        "description": "Commits and files a branch changes compared to main: what a review of the branch covers on the code side.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
            },
            "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
          }
        ]
      }
    },
    "/p/{project}/v1/tools/build_status": {
      "post": {
        "operationId": "tool_build_status",
        "summary": "Build status",
        "description": "Latest builds of the site on Tramontane, for one branch or all. Status: queued, building, deploying, ready, error, canceled.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "limit": {
                    "default": 10,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/site/builds": {
      "get": {
        "operationId": "build_status",
        "summary": "Build status",
        "description": "Latest builds of the site on Tramontane, for one branch or all. Status: queued, building, deploying, ready, error, canceled.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
            },
            "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 10,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/build_logs": {
      "post": {
        "operationId": "tool_build_logs",
        "summary": "Build logs",
        "description": "Log lines of one build, by page: pass `next` back as `after` until it is null.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "deploymentId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "after": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "limit": {
                    "default": 500,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2000
                  }
                },
                "required": [
                  "deploymentId"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/site/builds/{deploymentId}/logs": {
      "get": {
        "operationId": "build_logs",
        "summary": "Build logs",
        "description": "Log lines of one build, by page: pass `next` back as `after` until it is null.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "deploymentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 500,
              "type": "integer",
              "minimum": 1,
              "maximum": 2000
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/preview_url": {
      "post": {
        "operationId": "tool_preview_url",
        "summary": "Preview URL",
        "description": "Where to see a branch: its own build when its code changed (code and content of the branch), else the production site in draft mode on that content branch. `open` turns on draft mode and goes to `path`.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "path": {
                    "default": "/",
                    "type": "string",
                    "maxLength": 500,
                    "format": "starts_with",
                    "pattern": "^\\/.*"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/site/preview": {
      "get": {
        "operationId": "preview_url",
        "summary": "Preview URL",
        "description": "Where to see a branch: its own build when its code changed (code and content of the branch), else the production site in draft mode on that content branch. `open` turns on draft mode and goes to `path`.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "default": "main",
              "type": "string",
              "minLength": 1,
              "maxLength": 100,
              "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
            },
            "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
          },
          {
            "name": "path",
            "in": "query",
            "required": false,
            "schema": {
              "default": "/",
              "type": "string",
              "maxLength": 500,
              "format": "starts_with",
              "pattern": "^\\/.*"
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/request_code_review": {
      "post": {
        "operationId": "tool_request_code_review",
        "summary": "Request review of code and content",
        "description": "Asks people to review a branch: its code changes (compared to main) and its content changes, together under one name. Summarize what you changed and why in the note. People then promote the branch: content and code reach main together.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 5000
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/code/review": {
      "post": {
        "operationId": "request_code_review",
        "summary": "Request review of code and content",
        "description": "Asks people to review a branch: its code changes (compared to main) and its content changes, together under one name. Summarize what you changed and why in the note. People then promote the branch: content and code reach main together.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 5000
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/promote_code": {
      "post": {
        "operationId": "tool_promote_code",
        "summary": "Promote code",
        "description": "Merges a code branch into main (a merge commit); Tramontane then rebuilds production. promote does it too, after the content of the branch of the same name. With dryRun, only says whether the merge would go through. Needs the promote right.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "dryRun": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/code/promote": {
      "post": {
        "operationId": "promote_code",
        "summary": "Promote code",
        "description": "Merges a code branch into main (a merge commit); Tramontane then rebuilds production. promote does it too, after the content of the branch of the same name. With dryRun, only says whether the merge would go through. Needs the promote right.",
        "tags": [
          "flow"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "dryRun": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "branch"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/set_mirror": {
      "post": {
        "operationId": "tool_set_mirror",
        "summary": "Mirror the code",
        "description": "Copies the site repo to your own GitHub or GitLab repository on every change (a push mirror). Give an empty repository URL and a token that may push to it. The token is kept by Forgejo only. With remove, stops the mirror to that URL.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "github",
                      "gitlab"
                    ]
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 500,
                    "format": "uri",
                    "description": "https://github.com/acme/site.git"
                  },
                  "token": {
                    "description": "access token with push rights; not needed with remove",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "remove": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "provider",
                  "url"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/code/mirrors": {
      "post": {
        "operationId": "set_mirror",
        "summary": "Mirror the code",
        "description": "Copies the site repo to your own GitHub or GitLab repository on every change (a push mirror). Give an empty repository URL and a token that may push to it. The token is kept by Forgejo only. With remove, stops the mirror to that URL.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "github",
                      "gitlab"
                    ]
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 500,
                    "format": "uri",
                    "description": "https://github.com/acme/site.git"
                  },
                  "token": {
                    "description": "access token with push rights; not needed with remove",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "remove": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "provider",
                  "url"
                ]
              }
            }
          }
        }
      },
      "get": {
        "operationId": "list_mirrors",
        "summary": "Mirrors",
        "description": "Where the site repo is mirrored, with the last push and its error if any.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ]
      }
    },
    "/p/{project}/v1/tools/list_mirrors": {
      "post": {
        "operationId": "tool_list_mirrors",
        "summary": "Mirrors",
        "description": "Where the site repo is mirrored, with the last push and its error if any.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/git_access": {
      "post": {
        "operationId": "tool_git_access",
        "summary": "Git access",
        "description": "Credentials to clone the site repo and push branches with plain git (for agents with a shell). main only changes through promotion. Each call replaces your previous token; with revoke, removes it. Tokens are revoked 30 days after they are made.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "revoke": {
                    "default": false,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/code/git-access": {
      "post": {
        "operationId": "git_access",
        "summary": "Git access",
        "description": "Credentials to clone the site repo and push branches with plain git (for agents with a shell). main only changes through promotion. Each call replaces your previous token; with revoke, removes it. Tokens are revoked 30 days after they are made.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "revoke": {
                    "default": false,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/update_theme": {
      "post": {
        "operationId": "tool_update_theme",
        "summary": "Update the theme",
        "description": "Changes design tokens in theme/tokens.json on a branch, in one commit. Give only what changes, nested like the file (e.g. { \"colors\": { \"accent\": \"#0b5f59\" } }); null removes a token. The result is checked against theme/tokens.schema.json when the repo has it, and values that could break the CSS are refused. Web fonts go in the fonts group ({ \"fonts\": { \"serif\": { \"family\", \"fallback\", \"files\": [{ \"path\": \"/fonts/name.woff2\", \"weight\": 400 }] } } }) and are used as var(--fonts-<key>); commit the files under public/fonts with write_files first, the paths must exist on the branch. The branch preview rebuilds, then the change goes through review.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "tokens": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "branch",
                  "tokens"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/code/theme": {
      "post": {
        "operationId": "update_theme",
        "summary": "Update the theme",
        "description": "Changes design tokens in theme/tokens.json on a branch, in one commit. Give only what changes, nested like the file (e.g. { \"colors\": { \"accent\": \"#0b5f59\" } }); null removes a token. The result is checked against theme/tokens.schema.json when the repo has it, and values that could break the CSS are refused. Web fonts go in the fonts group ({ \"fonts\": { \"serif\": { \"family\", \"fallback\", \"files\": [{ \"path\": \"/fonts/name.woff2\", \"weight\": 400 }] } } }) and are used as var(--fonts-<key>); commit the files under public/fonts with write_files first, the paths must exist on the branch. The branch preview rebuilds, then the change goes through review.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "git branch, the same name as the content branch; agents work on their own branch and call request_code_review"
                  },
                  "tokens": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "branch",
                  "tokens"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/list_components": {
      "post": {
        "operationId": "tool_list_components",
        "summary": "List site components",
        "description": "Lists the site's components from its design manifest: atoms, components and blocks, with their props, controls, variants and, for blocks, the CMS fields. Give `id` for one component with the args of every variant. Read from the site repo on `branch` when Galerne manages the code, else from the site at <preview URL>/_design/manifest.json. See a component at <preview URL>/_design/<id>, one variant alone at /_design/frame/<id>?variant=<name> (draft mode: open preview_url with path /_design).",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "description": "code branch to read the manifest from (managed sites)",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "group": {
                    "description": "only this group: atoms, components or blocks",
                    "type": "string",
                    "maxLength": 40
                  },
                  "id": {
                    "description": "one component, e.g. blocks/hero, with the args of its variants",
                    "type": "string",
                    "maxLength": 120
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/site/components": {
      "get": {
        "operationId": "list_components",
        "summary": "List site components",
        "description": "Lists the site's components from its design manifest: atoms, components and blocks, with their props, controls, variants and, for blocks, the CMS fields. Give `id` for one component with the args of every variant. Read from the site repo on `branch` when Galerne manages the code, else from the site at <preview URL>/_design/manifest.json. See a component at <preview URL>/_design/<id>, one variant alone at /_design/frame/<id>?variant=<name> (draft mode: open preview_url with path /_design).",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "default": "main",
              "description": "code branch to read the manifest from (managed sites)",
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "description": "code branch to read the manifest from (managed sites)"
          },
          {
            "name": "group",
            "in": "query",
            "required": false,
            "schema": {
              "description": "only this group: atoms, components or blocks",
              "type": "string",
              "maxLength": 40
            },
            "description": "only this group: atoms, components or blocks"
          },
          {
            "name": "id",
            "in": "query",
            "required": false,
            "schema": {
              "description": "one component, e.g. blocks/hero, with the args of its variants",
              "type": "string",
              "maxLength": 120
            },
            "description": "one component, e.g. blocks/hero, with the args of its variants"
          }
        ]
      }
    },
    "/p/{project}/v1/tools/update_site_settings": {
      "post": {
        "operationId": "tool_update_site_settings",
        "summary": "Update site settings",
        "description": "Where content is published: the public site URL, the path pattern per type (routes, e.g. { \"post\": \"/{lang}/blog/{slug}\" }, null removes one), the preview URL the studio frames (a site running @galerne/next; null removes it), and llms (serve /p/<project>/llms.txt for agents).",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "url": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "routes": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 300
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "previewUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "llms": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/site/settings": {
      "patch": {
        "operationId": "update_site_settings",
        "summary": "Update site settings",
        "description": "Where content is published: the public site URL, the path pattern per type (routes, e.g. { \"post\": \"/{lang}/blog/{slug}\" }, null removes one), the preview URL the studio frames (a site running @galerne/next; null removes it), and llms (serve /p/<project>/llms.txt for agents).",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "url": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "routes": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 300
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "previewUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "llms": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/site_env": {
      "post": {
        "operationId": "tool_site_env",
        "summary": "Site env for local development",
        "description": "Returns a .env.local for running the site on your machine: API URL, project, studio URL, the preview secret and a new read token made for it (shown once; revoke it in settings, API tokens). Set the preview URL to the local site (update_site_settings) to see it in the studio.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "default": "local development",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/site/env": {
      "post": {
        "operationId": "site_env",
        "summary": "Site env for local development",
        "description": "Returns a .env.local for running the site on your machine: API URL, project, studio URL, the preview secret and a new read token made for it (shown once; revoke it in settings, API tokens). Set the preview URL to the local site (update_site_settings) to see it in the studio.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "default": "local development",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/site_analytics": {
      "post": {
        "operationId": "tool_site_analytics",
        "summary": "Site analytics",
        "description": "Visitors and page views of the managed site in production over a range (24h, 7d, 30d, 90d), with the range before it, and the top pages, routes, referrers, countries, devices, browsers and custom events.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "range": {
                    "default": "30d",
                    "type": "string",
                    "enum": [
                      "24h",
                      "7d",
                      "30d",
                      "90d"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/site/analytics": {
      "get": {
        "operationId": "site_analytics",
        "summary": "Site analytics",
        "description": "Visitors and page views of the managed site in production over a range (24h, 7d, 30d, 90d), with the range before it, and the top pages, routes, referrers, countries, devices, browsers and custom events.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "schema": {
              "default": "30d",
              "type": "string",
              "enum": [
                "24h",
                "7d",
                "30d",
                "90d"
              ]
            }
          }
        ]
      },
      "put": {
        "operationId": "set_site_analytics",
        "summary": "Turn site analytics on or off",
        "description": "Turns web analytics of the managed site on or off. On, Tramontane counts visitors without cookies from the next visit; off, it keeps nothing new.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/set_site_analytics": {
      "post": {
        "operationId": "tool_set_site_analytics",
        "summary": "Turn site analytics on or off",
        "description": "Turns web analytics of the managed site on or off. On, Tramontane counts visitors without cookies from the next visit; off, it keeps nothing new.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "enabled"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/list_sources": {
      "post": {
        "operationId": "tool_list_sources",
        "summary": "List data sources",
        "description": "External APIs that fill docs: their type, schedule, target and last run.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/sources": {
      "get": {
        "operationId": "list_sources",
        "summary": "List data sources",
        "description": "External APIs that fill docs: their type, schedule, target and last run.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ]
      },
      "post": {
        "operationId": "create_source",
        "summary": "Create a data source",
        "description": "Adds an external API that fills docs of one type. Map fields with JSON paths and transforms; run test_source first. Docs get deterministic ids, the source owns the mapped fields, and edits by people become overrides the sync leaves alone. With webhook, the answer holds the hook secret once.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48,
                    "description": "source name: lowercase letters, digits and \"-\""
                  },
                  "definition": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 1000
                      },
                      "type": {
                        "type": "string",
                        "description": "the doc type the items fill"
                      },
                      "fetch": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "maxLength": 2000,
                            "description": "https URL; templates {{lang}}, {{page}}, {{cursor}}, {{secret.NAME}}"
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "GET",
                              "POST"
                            ]
                          },
                          "headers": {
                            "description": "literal values of auth headers are moved to the encrypted secrets",
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string",
                              "maxLength": 4000
                            }
                          },
                          "body": {
                            "type": "string",
                            "maxLength": 100000
                          },
                          "items": {
                            "description": "JSON path of the items list in the response; empty when the response is the list",
                            "type": "string",
                            "maxLength": 500
                          },
                          "pagination": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "none"
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "page"
                                  },
                                  "param": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "start": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "sizeParam": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "size": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "cursor"
                                  },
                                  "param": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "path": {
                                    "type": "string",
                                    "maxLength": 500,
                                    "description": "JSON path of the next cursor in the response"
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type",
                                  "path"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "link"
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              }
                            ]
                          }
                        },
                        "required": [
                          "url"
                        ]
                      },
                      "key": {
                        "description": "JSON path of the item id (default \"id\")",
                        "type": "string",
                        "maxLength": 500
                      },
                      "id": {
                        "description": "doc id template (default \"<source>-{{key}}\", plus \"-{{lang}}\" for doc-level i18n)",
                        "type": "string",
                        "maxLength": 200
                      },
                      "fields": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "JSON path into the item: \"name\", \"owner.login\", \"tags[*].name\""
                            },
                            {
                              "type": "object",
                              "properties": {
                                "path": {
                                  "description": "JSON path into the item",
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "template": {
                                  "description": "text with {{path}} placeholders, like \"{{first}} {{last}}\"",
                                  "type": "string",
                                  "maxLength": 1000
                                },
                                "value": {
                                  "description": "a constant"
                                },
                                "transform": {
                                  "description": "default: from the field type (richText: markdown, image: image, reference: reference…)",
                                  "type": "string",
                                  "enum": [
                                    "string",
                                    "number",
                                    "integer",
                                    "boolean",
                                    "date",
                                    "datetime",
                                    "slug",
                                    "markdown",
                                    "html",
                                    "image",
                                    "reference",
                                    "language",
                                    "json"
                                  ]
                                },
                                "default": {
                                  "description": "used when the item has no value"
                                },
                                "id": {
                                  "description": "reference: target doc id template with {{value}}, like \"person-{{value}}\"",
                                  "type": "string",
                                  "maxLength": 200
                                },
                                "alt": {
                                  "description": "image: JSON path of the alt text",
                                  "type": "string",
                                  "maxLength": 500
                                }
                              }
                            }
                          ]
                        },
                        "description": "target field path → mapping; the source owns these paths"
                      },
                      "languages": {
                        "description": "doc-level i18n: one request per language, or the item language at a path",
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "const": "request"
                              },
                              "values": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "mode"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "const": "field"
                              },
                              "path": {
                                "type": "string",
                                "maxLength": 500
                              }
                            },
                            "required": [
                              "mode",
                              "path"
                            ]
                          }
                        ]
                      },
                      "schedule": {
                        "type": "object",
                        "properties": {
                          "every": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "description": "minutes, 15 at least"
                          }
                        },
                        "required": [
                          "every"
                        ]
                      },
                      "target": {
                        "description": "main publishes each run; review writes a branch and requests a review",
                        "type": "string",
                        "enum": [
                          "main",
                          "review"
                        ]
                      },
                      "webhook": {
                        "description": "accept POST /v1/sources/<name>/hook to start a run",
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "type",
                      "fetch",
                      "fields"
                    ]
                  },
                  "secrets": {
                    "description": "named secrets used as {{secret.NAME}}; stored encrypted, never returned",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 4000
                    }
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "definition"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/source_runs": {
      "post": {
        "operationId": "tool_source_runs",
        "summary": "Data source runs",
        "description": "The run log: counts (created, updated, unchanged, removed, failed), errors per item, duration. Newest first.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48,
                    "description": "source name: lowercase letters, digits and \"-\""
                  },
                  "limit": {
                    "default": 20,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/sources/runs": {
      "get": {
        "operationId": "source_runs",
        "summary": "Data source runs",
        "description": "The run log: counts (created, updated, unchanged, removed, failed), errors per item, duration. Newest first.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 48,
              "description": "source name: lowercase letters, digits and \"-\""
            },
            "description": "source name: lowercase letters, digits and \"-\""
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/get_source": {
      "post": {
        "operationId": "tool_get_source",
        "summary": "Get a data source",
        "description": "One source with its mapping, secret names (values are never returned) and recent runs.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48,
                    "description": "source name: lowercase letters, digits and \"-\""
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/sources/{name}": {
      "get": {
        "operationId": "get_source",
        "summary": "Get a data source",
        "description": "One source with its mapping, secret names (values are never returned) and recent runs.",
        "tags": [
          "read"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "operationId": "update_source",
        "summary": "Update a data source",
        "description": "Changes a source: its definition (studio sources only; config sources change in galerne.config.ts), secrets (null removes one), enabled, or a new hook secret.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48,
                    "description": "source name: lowercase letters, digits and \"-\""
                  },
                  "definition": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 1000
                      },
                      "type": {
                        "type": "string",
                        "description": "the doc type the items fill"
                      },
                      "fetch": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "maxLength": 2000,
                            "description": "https URL; templates {{lang}}, {{page}}, {{cursor}}, {{secret.NAME}}"
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "GET",
                              "POST"
                            ]
                          },
                          "headers": {
                            "description": "literal values of auth headers are moved to the encrypted secrets",
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string",
                              "maxLength": 4000
                            }
                          },
                          "body": {
                            "type": "string",
                            "maxLength": 100000
                          },
                          "items": {
                            "description": "JSON path of the items list in the response; empty when the response is the list",
                            "type": "string",
                            "maxLength": 500
                          },
                          "pagination": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "none"
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "page"
                                  },
                                  "param": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "start": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "sizeParam": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "size": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "cursor"
                                  },
                                  "param": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "path": {
                                    "type": "string",
                                    "maxLength": 500,
                                    "description": "JSON path of the next cursor in the response"
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type",
                                  "path"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "link"
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              }
                            ]
                          }
                        },
                        "required": [
                          "url"
                        ]
                      },
                      "key": {
                        "description": "JSON path of the item id (default \"id\")",
                        "type": "string",
                        "maxLength": 500
                      },
                      "id": {
                        "description": "doc id template (default \"<source>-{{key}}\", plus \"-{{lang}}\" for doc-level i18n)",
                        "type": "string",
                        "maxLength": 200
                      },
                      "fields": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "JSON path into the item: \"name\", \"owner.login\", \"tags[*].name\""
                            },
                            {
                              "type": "object",
                              "properties": {
                                "path": {
                                  "description": "JSON path into the item",
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "template": {
                                  "description": "text with {{path}} placeholders, like \"{{first}} {{last}}\"",
                                  "type": "string",
                                  "maxLength": 1000
                                },
                                "value": {
                                  "description": "a constant"
                                },
                                "transform": {
                                  "description": "default: from the field type (richText: markdown, image: image, reference: reference…)",
                                  "type": "string",
                                  "enum": [
                                    "string",
                                    "number",
                                    "integer",
                                    "boolean",
                                    "date",
                                    "datetime",
                                    "slug",
                                    "markdown",
                                    "html",
                                    "image",
                                    "reference",
                                    "language",
                                    "json"
                                  ]
                                },
                                "default": {
                                  "description": "used when the item has no value"
                                },
                                "id": {
                                  "description": "reference: target doc id template with {{value}}, like \"person-{{value}}\"",
                                  "type": "string",
                                  "maxLength": 200
                                },
                                "alt": {
                                  "description": "image: JSON path of the alt text",
                                  "type": "string",
                                  "maxLength": 500
                                }
                              }
                            }
                          ]
                        },
                        "description": "target field path → mapping; the source owns these paths"
                      },
                      "languages": {
                        "description": "doc-level i18n: one request per language, or the item language at a path",
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "const": "request"
                              },
                              "values": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "mode"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "const": "field"
                              },
                              "path": {
                                "type": "string",
                                "maxLength": 500
                              }
                            },
                            "required": [
                              "mode",
                              "path"
                            ]
                          }
                        ]
                      },
                      "schedule": {
                        "type": "object",
                        "properties": {
                          "every": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "description": "minutes, 15 at least"
                          }
                        },
                        "required": [
                          "every"
                        ]
                      },
                      "target": {
                        "description": "main publishes each run; review writes a branch and requests a review",
                        "type": "string",
                        "enum": [
                          "main",
                          "review"
                        ]
                      },
                      "webhook": {
                        "description": "accept POST /v1/sources/<name>/hook to start a run",
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "type",
                      "fetch",
                      "fields"
                    ]
                  },
                  "secrets": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 4000
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "rotateHookSecret": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "delete_source",
        "summary": "Delete a data source",
        "description": "Removes a studio source and its run log. The docs it filled stay as they are.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/p/{project}/v1/tools/create_source": {
      "post": {
        "operationId": "tool_create_source",
        "summary": "Create a data source",
        "description": "Adds an external API that fills docs of one type. Map fields with JSON paths and transforms; run test_source first. Docs get deterministic ids, the source owns the mapped fields, and edits by people become overrides the sync leaves alone. With webhook, the answer holds the hook secret once.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48,
                    "description": "source name: lowercase letters, digits and \"-\""
                  },
                  "definition": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 1000
                      },
                      "type": {
                        "type": "string",
                        "description": "the doc type the items fill"
                      },
                      "fetch": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "maxLength": 2000,
                            "description": "https URL; templates {{lang}}, {{page}}, {{cursor}}, {{secret.NAME}}"
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "GET",
                              "POST"
                            ]
                          },
                          "headers": {
                            "description": "literal values of auth headers are moved to the encrypted secrets",
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string",
                              "maxLength": 4000
                            }
                          },
                          "body": {
                            "type": "string",
                            "maxLength": 100000
                          },
                          "items": {
                            "description": "JSON path of the items list in the response; empty when the response is the list",
                            "type": "string",
                            "maxLength": 500
                          },
                          "pagination": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "none"
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "page"
                                  },
                                  "param": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "start": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "sizeParam": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "size": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "cursor"
                                  },
                                  "param": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "path": {
                                    "type": "string",
                                    "maxLength": 500,
                                    "description": "JSON path of the next cursor in the response"
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type",
                                  "path"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "link"
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              }
                            ]
                          }
                        },
                        "required": [
                          "url"
                        ]
                      },
                      "key": {
                        "description": "JSON path of the item id (default \"id\")",
                        "type": "string",
                        "maxLength": 500
                      },
                      "id": {
                        "description": "doc id template (default \"<source>-{{key}}\", plus \"-{{lang}}\" for doc-level i18n)",
                        "type": "string",
                        "maxLength": 200
                      },
                      "fields": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "JSON path into the item: \"name\", \"owner.login\", \"tags[*].name\""
                            },
                            {
                              "type": "object",
                              "properties": {
                                "path": {
                                  "description": "JSON path into the item",
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "template": {
                                  "description": "text with {{path}} placeholders, like \"{{first}} {{last}}\"",
                                  "type": "string",
                                  "maxLength": 1000
                                },
                                "value": {
                                  "description": "a constant"
                                },
                                "transform": {
                                  "description": "default: from the field type (richText: markdown, image: image, reference: reference…)",
                                  "type": "string",
                                  "enum": [
                                    "string",
                                    "number",
                                    "integer",
                                    "boolean",
                                    "date",
                                    "datetime",
                                    "slug",
                                    "markdown",
                                    "html",
                                    "image",
                                    "reference",
                                    "language",
                                    "json"
                                  ]
                                },
                                "default": {
                                  "description": "used when the item has no value"
                                },
                                "id": {
                                  "description": "reference: target doc id template with {{value}}, like \"person-{{value}}\"",
                                  "type": "string",
                                  "maxLength": 200
                                },
                                "alt": {
                                  "description": "image: JSON path of the alt text",
                                  "type": "string",
                                  "maxLength": 500
                                }
                              }
                            }
                          ]
                        },
                        "description": "target field path → mapping; the source owns these paths"
                      },
                      "languages": {
                        "description": "doc-level i18n: one request per language, or the item language at a path",
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "const": "request"
                              },
                              "values": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "mode"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "const": "field"
                              },
                              "path": {
                                "type": "string",
                                "maxLength": 500
                              }
                            },
                            "required": [
                              "mode",
                              "path"
                            ]
                          }
                        ]
                      },
                      "schedule": {
                        "type": "object",
                        "properties": {
                          "every": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "description": "minutes, 15 at least"
                          }
                        },
                        "required": [
                          "every"
                        ]
                      },
                      "target": {
                        "description": "main publishes each run; review writes a branch and requests a review",
                        "type": "string",
                        "enum": [
                          "main",
                          "review"
                        ]
                      },
                      "webhook": {
                        "description": "accept POST /v1/sources/<name>/hook to start a run",
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "type",
                      "fetch",
                      "fields"
                    ]
                  },
                  "secrets": {
                    "description": "named secrets used as {{secret.NAME}}; stored encrypted, never returned",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 4000
                    }
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "definition"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/update_source": {
      "post": {
        "operationId": "tool_update_source",
        "summary": "Update a data source",
        "description": "Changes a source: its definition (studio sources only; config sources change in galerne.config.ts), secrets (null removes one), enabled, or a new hook secret.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48,
                    "description": "source name: lowercase letters, digits and \"-\""
                  },
                  "definition": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 1000
                      },
                      "type": {
                        "type": "string",
                        "description": "the doc type the items fill"
                      },
                      "fetch": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "maxLength": 2000,
                            "description": "https URL; templates {{lang}}, {{page}}, {{cursor}}, {{secret.NAME}}"
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "GET",
                              "POST"
                            ]
                          },
                          "headers": {
                            "description": "literal values of auth headers are moved to the encrypted secrets",
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string",
                              "maxLength": 4000
                            }
                          },
                          "body": {
                            "type": "string",
                            "maxLength": 100000
                          },
                          "items": {
                            "description": "JSON path of the items list in the response; empty when the response is the list",
                            "type": "string",
                            "maxLength": 500
                          },
                          "pagination": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "none"
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "page"
                                  },
                                  "param": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "start": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "sizeParam": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "size": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "cursor"
                                  },
                                  "param": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "path": {
                                    "type": "string",
                                    "maxLength": 500,
                                    "description": "JSON path of the next cursor in the response"
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type",
                                  "path"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "link"
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              }
                            ]
                          }
                        },
                        "required": [
                          "url"
                        ]
                      },
                      "key": {
                        "description": "JSON path of the item id (default \"id\")",
                        "type": "string",
                        "maxLength": 500
                      },
                      "id": {
                        "description": "doc id template (default \"<source>-{{key}}\", plus \"-{{lang}}\" for doc-level i18n)",
                        "type": "string",
                        "maxLength": 200
                      },
                      "fields": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "JSON path into the item: \"name\", \"owner.login\", \"tags[*].name\""
                            },
                            {
                              "type": "object",
                              "properties": {
                                "path": {
                                  "description": "JSON path into the item",
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "template": {
                                  "description": "text with {{path}} placeholders, like \"{{first}} {{last}}\"",
                                  "type": "string",
                                  "maxLength": 1000
                                },
                                "value": {
                                  "description": "a constant"
                                },
                                "transform": {
                                  "description": "default: from the field type (richText: markdown, image: image, reference: reference…)",
                                  "type": "string",
                                  "enum": [
                                    "string",
                                    "number",
                                    "integer",
                                    "boolean",
                                    "date",
                                    "datetime",
                                    "slug",
                                    "markdown",
                                    "html",
                                    "image",
                                    "reference",
                                    "language",
                                    "json"
                                  ]
                                },
                                "default": {
                                  "description": "used when the item has no value"
                                },
                                "id": {
                                  "description": "reference: target doc id template with {{value}}, like \"person-{{value}}\"",
                                  "type": "string",
                                  "maxLength": 200
                                },
                                "alt": {
                                  "description": "image: JSON path of the alt text",
                                  "type": "string",
                                  "maxLength": 500
                                }
                              }
                            }
                          ]
                        },
                        "description": "target field path → mapping; the source owns these paths"
                      },
                      "languages": {
                        "description": "doc-level i18n: one request per language, or the item language at a path",
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "const": "request"
                              },
                              "values": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "mode"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "const": "field"
                              },
                              "path": {
                                "type": "string",
                                "maxLength": 500
                              }
                            },
                            "required": [
                              "mode",
                              "path"
                            ]
                          }
                        ]
                      },
                      "schedule": {
                        "type": "object",
                        "properties": {
                          "every": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "description": "minutes, 15 at least"
                          }
                        },
                        "required": [
                          "every"
                        ]
                      },
                      "target": {
                        "description": "main publishes each run; review writes a branch and requests a review",
                        "type": "string",
                        "enum": [
                          "main",
                          "review"
                        ]
                      },
                      "webhook": {
                        "description": "accept POST /v1/sources/<name>/hook to start a run",
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "type",
                      "fetch",
                      "fields"
                    ]
                  },
                  "secrets": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 4000
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "rotateHookSecret": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/delete_source": {
      "post": {
        "operationId": "tool_delete_source",
        "summary": "Delete a data source",
        "description": "Removes a studio source and its run log. The docs it filled stay as they are.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48,
                    "description": "source name: lowercase letters, digits and \"-\""
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/sync_source": {
      "post": {
        "operationId": "tool_sync_source",
        "summary": "Run a data source",
        "description": "Fetches the API and writes the changes now: new and changed items, removed items unpublished. Unchanged items are skipped. An empty or malformed answer stops the run and keeps the data. wait=false queues the run for the worker.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48,
                    "description": "source name: lowercase letters, digits and \"-\""
                  },
                  "wait": {
                    "default": true,
                    "type": "boolean"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/sources/{name}/sync": {
      "post": {
        "operationId": "sync_source",
        "summary": "Run a data source",
        "description": "Fetches the API and writes the changes now: new and changed items, removed items unpublished. Unchanged items are skipped. An empty or malformed answer stops the run and keeps the data. wait=false queues the run for the worker.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48,
                    "description": "source name: lowercase letters, digits and \"-\""
                  },
                  "wait": {
                    "default": true,
                    "type": "boolean"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/test_source": {
      "post": {
        "operationId": "tool_test_source",
        "summary": "Test a data source",
        "description": "Dry run: fetches the API and maps the first items with a saved source or a draft definition. Shows the docs it would write and the problems. Writes nothing. A draft on the saved source's host uses its saved secrets.",
        "tags": [
          "admin"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "description": "a saved source, or the name of the draft",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 48
                  },
                  "definition": {
                    "description": "a draft definition; secrets of the saved source with this name are used when the host is the same",
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "description": {
                        "type": "string",
                        "maxLength": 1000
                      },
                      "type": {
                        "type": "string",
                        "description": "the doc type the items fill"
                      },
                      "fetch": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "maxLength": 2000,
                            "description": "https URL; templates {{lang}}, {{page}}, {{cursor}}, {{secret.NAME}}"
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "GET",
                              "POST"
                            ]
                          },
                          "headers": {
                            "description": "literal values of auth headers are moved to the encrypted secrets",
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string",
                              "maxLength": 4000
                            }
                          },
                          "body": {
                            "type": "string",
                            "maxLength": 100000
                          },
                          "items": {
                            "description": "JSON path of the items list in the response; empty when the response is the list",
                            "type": "string",
                            "maxLength": 500
                          },
                          "pagination": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "none"
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "page"
                                  },
                                  "param": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "start": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "sizeParam": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "size": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "cursor"
                                  },
                                  "param": {
                                    "type": "string",
                                    "maxLength": 50
                                  },
                                  "path": {
                                    "type": "string",
                                    "maxLength": 500,
                                    "description": "JSON path of the next cursor in the response"
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type",
                                  "path"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "link"
                                  },
                                  "maxPages": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 500
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              }
                            ]
                          }
                        },
                        "required": [
                          "url"
                        ]
                      },
                      "key": {
                        "description": "JSON path of the item id (default \"id\")",
                        "type": "string",
                        "maxLength": 500
                      },
                      "id": {
                        "description": "doc id template (default \"<source>-{{key}}\", plus \"-{{lang}}\" for doc-level i18n)",
                        "type": "string",
                        "maxLength": 200
                      },
                      "fields": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "JSON path into the item: \"name\", \"owner.login\", \"tags[*].name\""
                            },
                            {
                              "type": "object",
                              "properties": {
                                "path": {
                                  "description": "JSON path into the item",
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "template": {
                                  "description": "text with {{path}} placeholders, like \"{{first}} {{last}}\"",
                                  "type": "string",
                                  "maxLength": 1000
                                },
                                "value": {
                                  "description": "a constant"
                                },
                                "transform": {
                                  "description": "default: from the field type (richText: markdown, image: image, reference: reference…)",
                                  "type": "string",
                                  "enum": [
                                    "string",
                                    "number",
                                    "integer",
                                    "boolean",
                                    "date",
                                    "datetime",
                                    "slug",
                                    "markdown",
                                    "html",
                                    "image",
                                    "reference",
                                    "language",
                                    "json"
                                  ]
                                },
                                "default": {
                                  "description": "used when the item has no value"
                                },
                                "id": {
                                  "description": "reference: target doc id template with {{value}}, like \"person-{{value}}\"",
                                  "type": "string",
                                  "maxLength": 200
                                },
                                "alt": {
                                  "description": "image: JSON path of the alt text",
                                  "type": "string",
                                  "maxLength": 500
                                }
                              }
                            }
                          ]
                        },
                        "description": "target field path → mapping; the source owns these paths"
                      },
                      "languages": {
                        "description": "doc-level i18n: one request per language, or the item language at a path",
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "const": "request"
                              },
                              "values": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "mode"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "const": "field"
                              },
                              "path": {
                                "type": "string",
                                "maxLength": 500
                              }
                            },
                            "required": [
                              "mode",
                              "path"
                            ]
                          }
                        ]
                      },
                      "schedule": {
                        "type": "object",
                        "properties": {
                          "every": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "description": "minutes, 15 at least"
                          }
                        },
                        "required": [
                          "every"
                        ]
                      },
                      "target": {
                        "description": "main publishes each run; review writes a branch and requests a review",
                        "type": "string",
                        "enum": [
                          "main",
                          "review"
                        ]
                      },
                      "webhook": {
                        "description": "accept POST /v1/sources/<name>/hook to start a run",
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "type",
                      "fetch",
                      "fields"
                    ]
                  },
                  "secrets": {
                    "description": "named secrets used as {{secret.NAME}}; stored encrypted, never returned",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 4000
                    }
                  },
                  "limit": {
                    "default": 5,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/set_override": {
      "post": {
        "operationId": "tool_set_override",
        "summary": "Override synced fields",
        "description": "Keeps the current values of fields a data source owns: syncs stop writing them. Editing such a field does the same on its own.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "description": "content branch",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "paths": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 500
                    }
                  }
                },
                "required": [
                  "id",
                  "paths"
                ]
              }
            }
          }
        }
      }
    },
    "/p/{project}/v1/tools/reset_override": {
      "post": {
        "operationId": "tool_reset_override",
        "summary": "Reset to source",
        "description": "The source owns these fields again (all overridden ones without paths). The last fetched values come back now; publish to put them online.",
        "tags": [
          "write"
        ],
        "responses": {
          "200": {
            "description": "Tool output (JSON)"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/project"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "branch": {
                    "default": "main",
                    "description": "content branch",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "paths": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 500
                    }
                  }
                },
                "required": [
                  "id"
                ]
              }
            }
          }
        }
      }
    }
  }
}
