{
  "openapi": "3.1.0",
  "info": {
    "title": "WebMoment API",
    "version": "2026-06-05",
    "summary": "Public, versioned API for the WebMoment moments platform.",
    "description": "The `/api/v1/*` namespace is the only contract WebMoment guarantees for partner integrations. Every route accepts an `Authorization: Bearer tok_*` header (a scoped `Token` minted from the workspace settings UI). All responses include `X-Webmoment-Version: 2026-06-05` and standard `X-RateLimit-*` headers. Breaking changes will be shipped under `/api/v2/*`; v1 follows the published deprecation policy. See `apps/web/app/api/v1/README.md` for the full partner contract.",
    "contact": {
      "name": "WebMoment API Support",
      "url": "https://webmoment.app/support"
    },
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.webmoment.app",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/moments": {
      "get": {
        "tags": [
          "Moments"
        ],
        "summary": "List moments",
        "description": "Returns a paginated array of moments for the workspace.",
        "operationId": "listMoments",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "example": 1,
              "description": "Page number (1-indexed).",
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number (1-indexed)."
          },
          {
            "in": "query",
            "name": "pageSize",
            "schema": {
              "default": 20,
              "example": 20,
              "description": "Items per page (max 50).",
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "description": "Items per page (max 50)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {},
                  "description": "Array of Moment objects."
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Moments"
        ],
        "summary": "Create a moment",
        "description": "Materializes a Page (if new) and enqueues a capture. Fires `page.created` (if new) and `moment.created` webhooks.",
        "operationId": "createMoment",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 32000
                  },
                  "name": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "title": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "comments": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "collectionId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "collectionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "theme": {
                    "type": "string",
                    "enum": [
                      "light",
                      "dark"
                    ]
                  },
                  "locale": {
                    "type": "string",
                    "minLength": 2
                  },
                  "timezone": {
                    "type": "string",
                    "minLength": 1
                  },
                  "prefersReducedMotion": {
                    "type": "boolean"
                  },
                  "scrollBehavior": {
                    "type": "string",
                    "enum": [
                      "none",
                      "wheel",
                      "smart",
                      "enhanced",
                      "fullSweep"
                    ]
                  },
                  "deviceScaleFactor": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3
                  },
                  "watermarkMode": {
                    "type": "string",
                    "enum": [
                      "included",
                      "removed",
                      "custom"
                    ]
                  },
                  "stabilizationTimeoutMs": {
                    "type": "integer",
                    "minimum": 30000,
                    "maximum": 120000
                  },
                  "screenshotResizeSettleMs": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000
                  },
                  "ignoreCertificateErrors": {
                    "type": "boolean"
                  },
                  "hideScrollbars": {
                    "type": "boolean"
                  },
                  "watermarkVariant": {
                    "type": "string",
                    "enum": [
                      "text",
                      "image"
                    ]
                  },
                  "watermarkPosition": {
                    "type": "string",
                    "enum": [
                      "top-left",
                      "top-right",
                      "center",
                      "bottom-left",
                      "bottom-right"
                    ]
                  },
                  "watermarkPresetId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "watermarkText": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "watermarkImageUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 32000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "viewport": {
                    "default": "desktop",
                    "type": "string",
                    "enum": [
                      "desktophd",
                      "desktop",
                      "tablet",
                      "mobile",
                      "custom"
                    ]
                  },
                  "viewportWidth": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "viewportHeight": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "scheduleEnabled": {
                    "type": "boolean"
                  },
                  "scheduleFrequency": {
                    "default": "once",
                    "type": "string",
                    "enum": [
                      "once",
                      "hourly",
                      "daily",
                      "weekly",
                      "monthly"
                    ]
                  },
                  "scheduleConfig": {
                    "anyOf": [
                      {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "isPaused": {
                    "type": "boolean"
                  },
                  "cleanerCapturesEnabled": {
                    "type": "boolean"
                  },
                  "cleanCapture": {
                    "type": "boolean"
                  },
                  "replayEnabled": {
                    "type": "boolean"
                  },
                  "replayOptions": {
                    "type": "object",
                    "properties": {
                      "captureVideos": {
                        "type": "boolean"
                      },
                      "runScripts": {
                        "type": "boolean"
                      },
                      "preserveShadowDom": {
                        "type": "boolean"
                      },
                      "includeHiddenElements": {
                        "type": "boolean"
                      },
                      "includeUnusedStyles": {
                        "type": "boolean"
                      },
                      "includeUnusedFonts": {
                        "type": "boolean"
                      },
                      "includeFrames": {
                        "type": "boolean"
                      },
                      "compressHtml": {
                        "type": "boolean"
                      },
                      "compressCss": {
                        "type": "boolean"
                      },
                      "includeAlternativeFonts": {
                        "type": "boolean"
                      },
                      "includeAlternativeMedia": {
                        "type": "boolean"
                      },
                      "includeAlternativeImages": {
                        "type": "boolean"
                      },
                      "groupDuplicateImages": {
                        "type": "boolean"
                      },
                      "allowMixedContent": {
                        "type": "boolean"
                      }
                    }
                  },
                  "screenshotOptions": {
                    "type": "object",
                    "properties": {
                      "screenshotMode": {
                        "default": "fullPage",
                        "type": "string",
                        "enum": [
                          "fullPage",
                          "viewport"
                        ]
                      },
                      "fileType": {
                        "default": "jpeg",
                        "type": "string",
                        "enum": [
                          "png",
                          "jpeg",
                          "webp"
                        ]
                      },
                      "quality": {
                        "default": 80,
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100
                      },
                      "captureMethod": {
                        "type": "string",
                        "enum": [
                          "auto",
                          "fullPage",
                          "viewport",
                          "tiles",
                          "fullHeight",
                          "sections"
                        ]
                      }
                    }
                  },
                  "screenshotTimeoutMs": {
                    "type": "integer",
                    "minimum": 30000,
                    "maximum": 120000
                  },
                  "stabilizeStrategy": {
                    "type": "string",
                    "enum": [
                      "inpage",
                      "granular"
                    ]
                  },
                  "maxHtmlBytes": {
                    "type": "integer",
                    "minimum": 1024,
                    "maximum": 1073741824
                  },
                  "userAgent": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "headers": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1
                            },
                            "enabled": {
                              "default": true,
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "name",
                            "value"
                          ]
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cookies": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1
                            },
                            "domain": {
                              "type": "string"
                            },
                            "path": {
                              "type": "string"
                            },
                            "enabled": {
                              "default": true,
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "name",
                            "value"
                          ]
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "archived": {
                    "type": "boolean"
                  },
                  "duplicateAction": {
                    "type": "string",
                    "enum": [
                      "capture_existing",
                      "create_new_page"
                    ]
                  },
                  "recapturePageId": {
                    "type": "string"
                  },
                  "recaptureMomentId": {
                    "type": "string"
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "description": "The created Moment."
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/moments/{id}": {
      "get": {
        "tags": [
          "Moments"
        ],
        "summary": "Retrieve a moment",
        "operationId": "getMoment",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "description": "The requested Moment."
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Moments"
        ],
        "summary": "Update a moment",
        "description": "Fires `page.updated` webhook when the underlying Tracking changes.",
        "operationId": "updateMoment",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "title": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "comments": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "collectionId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "collectionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "theme": {
                    "type": "string",
                    "enum": [
                      "light",
                      "dark"
                    ]
                  },
                  "locale": {
                    "type": "string",
                    "minLength": 2
                  },
                  "timezone": {
                    "type": "string",
                    "minLength": 1
                  },
                  "prefersReducedMotion": {
                    "type": "boolean"
                  },
                  "scrollBehavior": {
                    "type": "string",
                    "enum": [
                      "none",
                      "wheel",
                      "smart",
                      "enhanced",
                      "fullSweep"
                    ]
                  },
                  "deviceScaleFactor": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3
                  },
                  "watermarkMode": {
                    "type": "string",
                    "enum": [
                      "included",
                      "removed",
                      "custom"
                    ]
                  },
                  "stabilizationTimeoutMs": {
                    "type": "integer",
                    "minimum": 30000,
                    "maximum": 120000
                  },
                  "screenshotResizeSettleMs": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000
                  },
                  "ignoreCertificateErrors": {
                    "type": "boolean"
                  },
                  "hideScrollbars": {
                    "type": "boolean"
                  },
                  "watermarkVariant": {
                    "type": "string",
                    "enum": [
                      "text",
                      "image"
                    ]
                  },
                  "watermarkPosition": {
                    "type": "string",
                    "enum": [
                      "top-left",
                      "top-right",
                      "center",
                      "bottom-left",
                      "bottom-right"
                    ]
                  },
                  "watermarkPresetId": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "watermarkText": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "watermarkImageUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 32000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "viewport": {
                    "default": "desktop",
                    "type": "string",
                    "enum": [
                      "desktophd",
                      "desktop",
                      "tablet",
                      "mobile",
                      "custom"
                    ]
                  },
                  "viewportWidth": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "viewportHeight": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "scheduleEnabled": {
                    "type": "boolean"
                  },
                  "scheduleFrequency": {
                    "default": "once",
                    "type": "string",
                    "enum": [
                      "once",
                      "hourly",
                      "daily",
                      "weekly",
                      "monthly"
                    ]
                  },
                  "scheduleConfig": {
                    "anyOf": [
                      {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "isPaused": {
                    "type": "boolean"
                  },
                  "cleanerCapturesEnabled": {
                    "type": "boolean"
                  },
                  "cleanCapture": {
                    "type": "boolean"
                  },
                  "replayEnabled": {
                    "type": "boolean"
                  },
                  "replayOptions": {
                    "type": "object",
                    "properties": {
                      "captureVideos": {
                        "type": "boolean"
                      },
                      "runScripts": {
                        "type": "boolean"
                      },
                      "preserveShadowDom": {
                        "type": "boolean"
                      },
                      "includeHiddenElements": {
                        "type": "boolean"
                      },
                      "includeUnusedStyles": {
                        "type": "boolean"
                      },
                      "includeUnusedFonts": {
                        "type": "boolean"
                      },
                      "includeFrames": {
                        "type": "boolean"
                      },
                      "compressHtml": {
                        "type": "boolean"
                      },
                      "compressCss": {
                        "type": "boolean"
                      },
                      "includeAlternativeFonts": {
                        "type": "boolean"
                      },
                      "includeAlternativeMedia": {
                        "type": "boolean"
                      },
                      "includeAlternativeImages": {
                        "type": "boolean"
                      },
                      "groupDuplicateImages": {
                        "type": "boolean"
                      },
                      "allowMixedContent": {
                        "type": "boolean"
                      }
                    }
                  },
                  "screenshotOptions": {
                    "type": "object",
                    "properties": {
                      "screenshotMode": {
                        "default": "fullPage",
                        "type": "string",
                        "enum": [
                          "fullPage",
                          "viewport"
                        ]
                      },
                      "fileType": {
                        "default": "jpeg",
                        "type": "string",
                        "enum": [
                          "png",
                          "jpeg",
                          "webp"
                        ]
                      },
                      "quality": {
                        "default": 80,
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100
                      },
                      "captureMethod": {
                        "type": "string",
                        "enum": [
                          "auto",
                          "fullPage",
                          "viewport",
                          "tiles",
                          "fullHeight",
                          "sections"
                        ]
                      }
                    }
                  },
                  "screenshotTimeoutMs": {
                    "type": "integer",
                    "minimum": 30000,
                    "maximum": 120000
                  },
                  "stabilizeStrategy": {
                    "type": "string",
                    "enum": [
                      "inpage",
                      "granular"
                    ]
                  },
                  "maxHtmlBytes": {
                    "type": "integer",
                    "minimum": 1024,
                    "maximum": 1073741824
                  },
                  "userAgent": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "headers": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1
                            },
                            "enabled": {
                              "default": true,
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "name",
                            "value"
                          ]
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cookies": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1
                            },
                            "value": {
                              "type": "string",
                              "minLength": 1
                            },
                            "domain": {
                              "type": "string"
                            },
                            "path": {
                              "type": "string"
                            },
                            "enabled": {
                              "default": true,
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "name",
                            "value"
                          ]
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "archived": {
                    "type": "boolean"
                  },
                  "duplicateAction": {
                    "type": "string",
                    "enum": [
                      "capture_existing",
                      "create_new_page"
                    ]
                  },
                  "recapturePageId": {
                    "type": "string"
                  },
                  "recaptureMomentId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Moments"
        ],
        "summary": "Archive a moment (soft delete)",
        "description": "Archives the underlying Page (sets `archived: true`). Fires `page.deleted` and `moment.deleted` webhooks.",
        "operationId": "deleteMoment",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/moments/{id}/recapture": {
      "post": {
        "tags": [
          "Moments"
        ],
        "summary": "Recapture a moment",
        "description": "Enqueues a fresh capture for the underlying Page. Fires `moment.created`.",
        "operationId": "recaptureMoment",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/moments/bulk": {
      "patch": {
        "tags": [
          "Moments"
        ],
        "summary": "Bulk update moments",
        "operationId": "bulkUpdateMoments",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "title": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "description": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "comments": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "collectionId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "collectionIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "theme": {
                        "type": "string",
                        "enum": [
                          "light",
                          "dark"
                        ]
                      },
                      "locale": {
                        "type": "string",
                        "minLength": 2
                      },
                      "timezone": {
                        "type": "string",
                        "minLength": 1
                      },
                      "prefersReducedMotion": {
                        "type": "boolean"
                      },
                      "scrollBehavior": {
                        "type": "string",
                        "enum": [
                          "none",
                          "wheel",
                          "smart",
                          "enhanced",
                          "fullSweep"
                        ]
                      },
                      "deviceScaleFactor": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 3
                      },
                      "watermarkMode": {
                        "type": "string",
                        "enum": [
                          "included",
                          "removed",
                          "custom"
                        ]
                      },
                      "stabilizationTimeoutMs": {
                        "type": "integer",
                        "minimum": 30000,
                        "maximum": 120000
                      },
                      "screenshotResizeSettleMs": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000
                      },
                      "ignoreCertificateErrors": {
                        "type": "boolean"
                      },
                      "hideScrollbars": {
                        "type": "boolean"
                      },
                      "watermarkVariant": {
                        "type": "string",
                        "enum": [
                          "text",
                          "image"
                        ]
                      },
                      "watermarkPosition": {
                        "type": "string",
                        "enum": [
                          "top-left",
                          "top-right",
                          "center",
                          "bottom-left",
                          "bottom-right"
                        ]
                      },
                      "watermarkPresetId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "watermarkText": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 120
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "watermarkImageUrl": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 32000
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "viewport": {
                        "default": "desktop",
                        "type": "string",
                        "enum": [
                          "desktophd",
                          "desktop",
                          "tablet",
                          "mobile",
                          "custom"
                        ]
                      },
                      "viewportWidth": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "viewportHeight": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "scheduleEnabled": {
                        "type": "boolean"
                      },
                      "scheduleFrequency": {
                        "default": "once",
                        "type": "string",
                        "enum": [
                          "once",
                          "hourly",
                          "daily",
                          "weekly",
                          "monthly"
                        ]
                      },
                      "scheduleConfig": {
                        "anyOf": [
                          {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "isPaused": {
                        "type": "boolean"
                      },
                      "cleanerCapturesEnabled": {
                        "type": "boolean"
                      },
                      "cleanCapture": {
                        "type": "boolean"
                      },
                      "replayEnabled": {
                        "type": "boolean"
                      },
                      "replayOptions": {
                        "type": "object",
                        "properties": {
                          "captureVideos": {
                            "type": "boolean"
                          },
                          "runScripts": {
                            "type": "boolean"
                          },
                          "preserveShadowDom": {
                            "type": "boolean"
                          },
                          "includeHiddenElements": {
                            "type": "boolean"
                          },
                          "includeUnusedStyles": {
                            "type": "boolean"
                          },
                          "includeUnusedFonts": {
                            "type": "boolean"
                          },
                          "includeFrames": {
                            "type": "boolean"
                          },
                          "compressHtml": {
                            "type": "boolean"
                          },
                          "compressCss": {
                            "type": "boolean"
                          },
                          "includeAlternativeFonts": {
                            "type": "boolean"
                          },
                          "includeAlternativeMedia": {
                            "type": "boolean"
                          },
                          "includeAlternativeImages": {
                            "type": "boolean"
                          },
                          "groupDuplicateImages": {
                            "type": "boolean"
                          },
                          "allowMixedContent": {
                            "type": "boolean"
                          }
                        }
                      },
                      "screenshotOptions": {
                        "type": "object",
                        "properties": {
                          "screenshotMode": {
                            "default": "fullPage",
                            "type": "string",
                            "enum": [
                              "fullPage",
                              "viewport"
                            ]
                          },
                          "fileType": {
                            "default": "jpeg",
                            "type": "string",
                            "enum": [
                              "png",
                              "jpeg",
                              "webp"
                            ]
                          },
                          "quality": {
                            "default": 80,
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100
                          },
                          "captureMethod": {
                            "type": "string",
                            "enum": [
                              "auto",
                              "fullPage",
                              "viewport",
                              "tiles",
                              "fullHeight",
                              "sections"
                            ]
                          }
                        }
                      },
                      "screenshotTimeoutMs": {
                        "type": "integer",
                        "minimum": 30000,
                        "maximum": 120000
                      },
                      "stabilizeStrategy": {
                        "type": "string",
                        "enum": [
                          "inpage",
                          "granular"
                        ]
                      },
                      "maxHtmlBytes": {
                        "type": "integer",
                        "minimum": 1024,
                        "maximum": 1073741824
                      },
                      "userAgent": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "headers": {
                        "anyOf": [
                          {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "value": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "enabled": {
                                  "default": true,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "name",
                                "value"
                              ]
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "cookies": {
                        "anyOf": [
                          {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "value": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "domain": {
                                  "type": "string"
                                },
                                "path": {
                                  "type": "string"
                                },
                                "enabled": {
                                  "default": true,
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "name",
                                "value"
                              ]
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "archived": {
                        "type": "boolean"
                      },
                      "duplicateAction": {
                        "type": "string",
                        "enum": [
                          "capture_existing",
                          "create_new_page"
                        ]
                      },
                      "recapturePageId": {
                        "type": "string"
                      },
                      "recaptureMomentId": {
                        "type": "string"
                      }
                    }
                  }
                },
                "required": [
                  "ids",
                  "data"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "updated": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "updated"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Moments"
        ],
        "summary": "Bulk archive moments",
        "operationId": "bulkDeleteMoments",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "ids"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "archived": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "archived"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/moments/count": {
      "get": {
        "tags": [
          "Moments"
        ],
        "summary": "Count moments",
        "operationId": "countMoments",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "routePattern": {
                        "type": "string"
                      },
                      "count": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "routePattern",
                      "count"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/moments/metatags": {
      "get": {
        "tags": [
          "Moments"
        ],
        "summary": "Fetch URL metadata",
        "description": "Returns parsed `<meta>` tags (title, description, image, favicon) for the given URL.",
        "operationId": "getMetatags",
        "parameters": [
          {
            "in": "query",
            "name": "url",
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/collections": {
      "get": {
        "tags": [
          "Collections"
        ],
        "summary": "List collections",
        "operationId": "listCollections",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "example": 1,
              "description": "Page number (1-indexed).",
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number (1-indexed)."
          },
          {
            "in": "query",
            "name": "pageSize",
            "schema": {
              "default": 20,
              "example": 20,
              "description": "Items per page (max 50).",
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "description": "Items per page (max 50)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Collections"
        ],
        "summary": "Create a collection",
        "operationId": "createCollection",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/collections/{id}": {
      "get": {
        "tags": [
          "Collections"
        ],
        "summary": "Retrieve a collection",
        "operationId": "getCollection",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Collections"
        ],
        "summary": "Update a collection",
        "operationId": "updateCollection",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Collections"
        ],
        "summary": "Delete a collection",
        "operationId": "deleteCollection",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/collections/count": {
      "get": {
        "tags": [
          "Collections"
        ],
        "summary": "Count collections",
        "operationId": "countCollections",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tags": {
      "get": {
        "tags": [
          "Tags"
        ],
        "summary": "List tags",
        "operationId": "listTags",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "example": 1,
              "description": "Page number (1-indexed).",
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number (1-indexed)."
          },
          {
            "in": "query",
            "name": "pageSize",
            "schema": {
              "default": 20,
              "example": 20,
              "description": "Items per page (max 50).",
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "description": "Items per page (max 50)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Tags"
        ],
        "summary": "Create a tag",
        "operationId": "createTag",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tags/{id}": {
      "patch": {
        "tags": [
          "Tags"
        ],
        "summary": "Update a tag",
        "operationId": "updateTag",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Tags"
        ],
        "summary": "Delete a tag",
        "operationId": "deleteTag",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tags/count": {
      "get": {
        "tags": [
          "Tags"
        ],
        "summary": "Count tags",
        "operationId": "countTags",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tracking": {
      "get": {
        "tags": [
          "Tracking"
        ],
        "summary": "List Tracking schedules",
        "operationId": "listTracking",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "example": 1,
              "description": "Page number (1-indexed).",
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number (1-indexed)."
          },
          {
            "in": "query",
            "name": "pageSize",
            "schema": {
              "default": 20,
              "example": 20,
              "description": "Items per page (max 50).",
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "description": "Items per page (max 50)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tracking/{id}": {
      "get": {
        "tags": [
          "Tracking"
        ],
        "summary": "Retrieve a Tracking schedule",
        "operationId": "getTracking",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Tracking"
        ],
        "summary": "Update a Tracking schedule",
        "operationId": "updateTracking",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tracking/count": {
      "get": {
        "tags": [
          "Tracking"
        ],
        "summary": "Count Tracking schedules",
        "operationId": "countTracking",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhooks",
        "operationId": "listWebhooks",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "example": 1,
              "description": "Page number (1-indexed).",
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number (1-indexed)."
          },
          {
            "in": "query",
            "name": "pageSize",
            "schema": {
              "default": 20,
              "example": 20,
              "description": "Items per page (max 50).",
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "description": "Items per page (max 50)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string"
                      },
                      "secret": {
                        "type": "string"
                      },
                      "triggers": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "page.created",
                            "page.updated",
                            "page.deleted",
                            "moment.created",
                            "moment.deleted"
                          ]
                        }
                      },
                      "disabledAt": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "url",
                      "secret",
                      "triggers",
                      "disabledAt"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook subscription",
        "operationId": "createWebhook",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 32000
                  },
                  "secret": {
                    "type": "string"
                  },
                  "triggers": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "page.created",
                        "page.updated",
                        "page.deleted",
                        "moment.created",
                        "moment.deleted"
                      ]
                    }
                  }
                },
                "required": [
                  "name",
                  "url",
                  "triggers"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "secret": {
                      "type": "string"
                    },
                    "triggers": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "page.created",
                          "page.updated",
                          "page.deleted",
                          "moment.created",
                          "moment.deleted"
                        ]
                      }
                    },
                    "disabledAt": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "url",
                    "secret",
                    "triggers",
                    "disabledAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Retrieve a webhook",
        "operationId": "getWebhook",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "secret": {
                      "type": "string"
                    },
                    "triggers": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "page.created",
                          "page.updated",
                          "page.deleted",
                          "moment.created",
                          "moment.deleted"
                        ]
                      }
                    },
                    "disabledAt": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "url",
                    "secret",
                    "triggers",
                    "disabledAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Update a webhook",
        "operationId": "updateWebhook",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 32000
                  },
                  "secret": {
                    "type": "string"
                  },
                  "triggers": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "page.created",
                        "page.updated",
                        "page.deleted",
                        "moment.created",
                        "moment.deleted"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "secret": {
                      "type": "string"
                    },
                    "triggers": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "page.created",
                          "page.updated",
                          "page.deleted",
                          "moment.created",
                          "moment.deleted"
                        ]
                      }
                    },
                    "disabledAt": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "url",
                    "secret",
                    "triggers",
                    "disabledAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook",
        "operationId": "deleteWebhook",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/workspace": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "summary": "Retrieve workspace identity and quotas",
        "operationId": "getWorkspace",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/logs": {
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "List activity logs",
        "description": "Workspace audit trail — every API request, every webhook emission, and every internal moments-side action.",
        "operationId": "listLogs",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "example": 1,
              "description": "Page number (1-indexed).",
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "description": "Page number (1-indexed)."
          },
          {
            "in": "query",
            "name": "pageSize",
            "schema": {
              "default": 20,
              "example": 20,
              "description": "Items per page (max 50).",
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "description": "Items per page (max 50)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogsList"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/logs/{id}": {
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "Retrieve a single log row",
        "operationId": "getLog",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "$ref": "#/components/schemas/PathId"
            },
            "required": true,
            "description": "A resource id."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Log"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/logs/count": {
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "Count log rows (optionally grouped by routePattern)",
        "operationId": "countLogs",
        "parameters": [
          {
            "in": "query",
            "name": "groupBy",
            "schema": {
              "type": "string",
              "enum": [
                "routePattern"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogsCount"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — token lacks the required scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity — request body or query failed validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — see Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PathId": {
        "type": "string",
        "minLength": 1,
        "example": "mom_abc123",
        "description": "A resource id."
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "bad_request",
                  "unauthorized",
                  "forbidden",
                  "exceeded_limit",
                  "new_moments_limit_exceeded",
                  "total_moments_limit_exceeded",
                  "active_trackings_limit_exceeded",
                  "paused_trackings_limit_exceeded",
                  "not_found",
                  "conflict",
                  "invite_pending",
                  "invite_expired",
                  "unprocessable_entity",
                  "rate_limit_exceeded",
                  "internal_server_error"
                ],
                "description": "A short code indicating the error code returned.",
                "example": "not_found"
              },
              "message": {
                "type": "string",
                "description": "A human readable error message.",
                "example": "The requested resource was not found."
              },
              "doc_url": {
                "description": "A URL to more information about the error code reported.",
                "example": "https://webmoment.app/docs/api-reference",
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "title": "Error",
        "description": "Standard error envelope returned by every failed /api/v1/* request."
      },
      "LogsList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Log"
            }
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "pageSize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "totalPages": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "data",
          "page",
          "pageSize",
          "total",
          "totalPages"
        ],
        "additionalProperties": false,
        "title": "LogsList",
        "description": "Paginated list envelope used by GET /api/v1/logs."
      },
      "Log": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "timestamp": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "route_pattern": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status_code": {
            "type": "number"
          },
          "duration": {
            "type": "number"
          },
          "status": {
            "type": "string"
          },
          "level": {
            "type": "string",
            "enum": [
              "debug",
              "info",
              "warning",
              "error"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "api",
              "auth",
              "workspace",
              "worker",
              "cron",
              "system",
              "activity"
            ]
          },
          "action": {
            "type": "string"
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "resource_type": {
            "type": "string"
          },
          "resource_id": {
            "type": "string"
          },
          "workspace_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "actor_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "actor_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "actor_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "token_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "metadata": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "timestamp",
          "method",
          "path",
          "route_pattern",
          "status_code",
          "duration",
          "status",
          "level",
          "source",
          "action",
          "message",
          "resource_type",
          "resource_id",
          "workspace_id",
          "actor_type",
          "actor_name",
          "actor_email",
          "token_id",
          "user_id",
          "metadata"
        ],
        "additionalProperties": false,
        "title": "Log",
        "description": "A single activity-log row as exposed by GET /api/v1/logs."
      },
      "LogsCount": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "routePattern": {
              "type": "string"
            },
            "count": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "routePattern",
            "count"
          ],
          "additionalProperties": false
        },
        "title": "LogsCount",
        "description": "Array of { routePattern, count } returned by GET /api/v1/logs/count."
      }
    },
    "parameters": {
      "PathId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "def": {
            "type": "string",
            "checks": [
              {}
            ]
          },
          "type": "string",
          "format": null,
          "minLength": 1,
          "maxLength": null
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Token",
        "description": "A workspace-scoped API token of the form `tok_*`."
      }
    }
  }
}
