{
  "openapi": "3.1.1",
  "info": {
    "title": "CloudRaker API",
    "description": "Build integrations and applications with CloudRaker.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.dev.raker.one",
      "description": "Development"
    },
    {
      "url": "https://api.staging.raker.one",
      "description": "Staging"
    },
    {
      "url": "https://api.cloudraker.com",
      "description": "Production"
    }
  ],
  "components": {
    "schemas": {
      "SigningJsonValue": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SigningJsonValue"
            }
          },
          {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/SigningJsonValue"
            }
          }
        ]
      },
      "Jwks": {
        "type": "object",
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kty": {
                  "type": "string",
                  "example": "EC"
                },
                "crv": {
                  "type": "string",
                  "example": "P-256"
                },
                "x": {
                  "type": "string"
                },
                "y": {
                  "type": "string"
                },
                "kid": {
                  "type": "string"
                },
                "alg": {
                  "type": "string",
                  "example": "ES256"
                },
                "use": {
                  "example": "sig",
                  "type": "string"
                }
              },
              "required": ["kty", "crv", "x", "y", "kid", "alg"],
              "description": "A public key. Private material is never served."
            }
          }
        },
        "required": ["keys"]
      },
      "RakeSignApiError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          },
          "requestId": {
            "type": "string"
          },
          "docUrl": {
            "type": "string"
          }
        },
        "required": ["code", "message", "retryable", "requestId"]
      },
      "__schema0": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/__schema0"
            }
          },
          {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/__schema0"
            }
          }
        ]
      },
      "RakeSignDocument": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "teamId": {
            "type": ["string", "null"]
          },
          "ownerId": {
            "type": "string"
          },
          "privacy": {
            "type": "string",
            "enum": ["team", "participants"]
          },
          "status": {
            "type": "string",
            "enum": ["draft", "waiting", "completed", "cancelled", "declined", "expired", "failed"]
          },
          "source": {
            "type": "string",
            "enum": ["app", "api", "paperwork"]
          },
          "integrationId": {
            "type": "string"
          },
          "integrationName": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "signingMode": {
            "type": "string",
            "enum": ["manual", "delegated"]
          },
          "delegation": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "templateId": {
                    "type": "string"
                  },
                  "templateVersion": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["templateId", "templateVersion"]
              },
              {
                "type": "null"
              }
            ]
          },
          "templateOrigin": {
            "type": "object",
            "properties": {
              "templateId": {
                "type": "string"
              },
              "templateVersion": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "templateName": {
                "type": "string"
              }
            },
            "required": ["templateId", "templateVersion", "templateName"]
          },
          "placement": {
            "type": "string",
            "enum": ["page", "tags", "fields"]
          },
          "stages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "mode": {
                  "type": "string",
                  "enum": ["all", "any"]
                },
                "role": {
                  "type": "string",
                  "enum": ["signer", "approver"]
                },
                "delayHours": {
                  "type": "number"
                },
                "condition": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "$ref": "#/components/schemas/__schema0"
                  }
                },
                "skipped": {
                  "type": "boolean"
                },
                "recipients": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "pending",
                          "awaiting_consent",
                          "signed",
                          "approved",
                          "declined",
                          "skipped"
                        ]
                      },
                      "locked": {
                        "description": "True when the template of this document sets this recipient. Only the template can change or remove a locked recipient.",
                        "type": "boolean"
                      },
                      "phoneLocked": {
                        "description": "True when the template also sets the phone number of a locked recipient. When false, the sender can add or change the phone number.",
                        "type": "boolean"
                      },
                      "delegationId": {
                        "type": "string"
                      },
                      "signedAt": {
                        "type": "string"
                      },
                      "typedName": {
                        "type": "string"
                      },
                      "viewedAt": {
                        "type": "string"
                      },
                      "approvedAt": {
                        "type": "string"
                      },
                      "declinedAt": {
                        "type": "string"
                      },
                      "declineReason": {
                        "type": "string"
                      },
                      "nextReminderAt": {
                        "type": "string"
                      },
                      "lastInvitedAt": {
                        "type": "string"
                      },
                      "deliveryError": {
                        "type": "string"
                      },
                      "version": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": ["id", "name", "email", "status"]
                  }
                }
              },
              "required": ["id", "mode", "recipients"]
            }
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "signature",
                    "initials",
                    "date",
                    "text",
                    "checkbox",
                    "dropdown",
                    "dateInput",
                    "name",
                    "email"
                  ]
                },
                "slot": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 50
                },
                "page": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 1000
                },
                "x": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                },
                "y": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                },
                "width": {
                  "type": "number",
                  "exclusiveMinimum": 0,
                  "maximum": 1
                },
                "height": {
                  "type": "number",
                  "exclusiveMinimum": 0,
                  "maximum": 1
                },
                "label": {
                  "type": "string",
                  "maxLength": 200
                },
                "required": {
                  "type": "boolean"
                },
                "options": {
                  "minItems": 1,
                  "maxItems": 50,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "maxLength": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 5000
                },
                "defaultValue": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 5000
                    },
                    {
                      "type": "boolean"
                    }
                  ]
                },
                "attachmentId": {
                  "type": "string",
                  "maxLength": 100
                },
                "localPage": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "fontSize": {
                  "description": "The text size in points, from 6 to 72. Applies to fields that print text. When absent, the text is 12 points or less, to fit the field height. A value that does not fit the field shrinks to fit.",
                  "type": "number",
                  "minimum": 6,
                  "maximum": 72
                }
              },
              "required": ["id", "kind", "slot", "page", "x", "y", "width", "height"],
              "additionalProperties": false
            }
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "fileId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "mimeType": {
                  "type": "string"
                },
                "pageCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "startPage": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "sha256": {
                  "type": "string"
                },
                "renditionSha256": {
                  "type": "string"
                }
              },
              "required": ["id", "fileId", "name", "mimeType", "pageCount", "startPage"]
            }
          },
          "pageCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "pages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "width": {
                  "type": "number"
                },
                "height": {
                  "type": "number"
                }
              },
              "required": ["width", "height"]
            }
          },
          "preparationReviewed": {
            "type": "boolean"
          },
          "contentNeedsRender": {
            "type": "boolean"
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                }
              },
              "required": ["name", "email"]
            }
          },
          "language": {
            "type": "string",
            "enum": ["en", "fr"]
          },
          "expiresInDays": {
            "type": "number"
          },
          "expiresAt": {
            "type": "string"
          },
          "reminders": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "firstAfterDays": {
                "type": "number"
              },
              "repeatEveryDays": {
                "type": "number"
              },
              "expiresBeforeDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 30
              }
            },
            "required": ["enabled", "firstAfterDays", "repeatEveryDays"],
            "additionalProperties": false
          },
          "allowReassignment": {
            "type": "boolean"
          },
          "notifications": {
            "description": "Who gets the progress emails of this document.",
            "type": "object",
            "properties": {
              "sender": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "email": {
                        "type": "string"
                      },
                      "language": {
                        "type": "string",
                        "enum": ["en", "fr"]
                      }
                    },
                    "required": ["email"]
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "branding": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "accentColor": {
                    "type": "string"
                  },
                  "logoDataUrl": {
                    "type": "string"
                  }
                },
                "required": ["name", "accentColor"]
              },
              {
                "type": "null"
              }
            ]
          },
          "variables": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/__schema0"
            }
          },
          "brandingId": {
            "type": ["string", "null"]
          },
          "purpose": {
            "type": "string",
            "const": "template"
          },
          "generation": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/__schema0"
            }
          },
          "extraction": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/__schema0"
            }
          },
          "postSign": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/__schema0"
            }
          },
          "fileName": {
            "type": "string"
          },
          "fileId": {
            "type": "string"
          },
          "generatedText": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "sending": {
            "description": "A send is underway or was interrupted. Edits answer 409 until it ends; POST /send again to finish it.",
            "type": "boolean"
          },
          "errorCode": {
            "description": "Set on a failed document when the plan limit of open signing requests stopped the send.",
            "type": "string",
            "enum": ["concurrent_envelope_limit"]
          },
          "limit": {
            "description": "With `errorCode`: the open signing request limit of the plan.",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "sentAt": {
            "type": "string"
          },
          "completedAt": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "activity": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "at": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              },
              "required": ["id", "at", "text"]
            }
          }
        },
        "required": [
          "id",
          "title",
          "teamId",
          "ownerId",
          "privacy",
          "status",
          "message",
          "placement",
          "stages",
          "fields",
          "createdAt",
          "updatedAt",
          "version",
          "activity"
        ]
      },
      "RakeSignReport": {
        "type": "object",
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RakeSignDocument"
            }
          },
          "generatedAt": {
            "type": "string"
          },
          "totals": {
            "type": "object",
            "properties": {
              "documents": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "completed": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "waiting": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "signed": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "outstanding": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": ["documents", "completed", "waiting", "signed", "outstanding"]
          }
        },
        "required": ["documents", "generatedAt", "totals"]
      },
      "RakeSignTemplate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ownerId": {
            "type": "string"
          },
          "teamId": {
            "type": ["string", "null"]
          },
          "privacy": {
            "type": "string",
            "enum": ["team", "participants"]
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "archivedAt": {
            "type": ["string", "null"]
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "slot": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "label": {
                  "type": "string"
                },
                "person": {
                  "description": "The person who always signs this role. Each document from the template gets this person, and the sender cannot change them. Absent when the sender chooses the person for each document.",
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "phone": {
                      "type": "string"
                    }
                  },
                  "required": ["name", "email"]
                }
              },
              "required": ["id", "slot", "label"]
            }
          },
          "snapshot": {
            "$ref": "#/components/schemas/RakeSignDocument"
          }
        },
        "required": [
          "id",
          "ownerId",
          "teamId",
          "privacy",
          "version",
          "createdAt",
          "updatedAt",
          "archivedAt",
          "name",
          "description",
          "roles",
          "snapshot"
        ]
      },
      "RakeSignContact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ownerId": {
            "type": "string"
          },
          "teamId": {
            "type": ["string", "null"]
          },
          "privacy": {
            "type": "string",
            "enum": ["team", "participants"]
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "archivedAt": {
            "type": ["string", "null"]
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "ownerId",
          "teamId",
          "privacy",
          "version",
          "createdAt",
          "updatedAt",
          "archivedAt",
          "name",
          "email"
        ]
      },
      "RakeSignGroup": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ownerId": {
            "type": "string"
          },
          "teamId": {
            "type": ["string", "null"]
          },
          "privacy": {
            "type": "string",
            "enum": ["team", "participants"]
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "archivedAt": {
            "type": ["string", "null"]
          },
          "name": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": ["all", "any"]
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                }
              },
              "required": ["name", "email"]
            }
          }
        },
        "required": [
          "id",
          "ownerId",
          "teamId",
          "privacy",
          "version",
          "createdAt",
          "updatedAt",
          "archivedAt",
          "name",
          "mode",
          "recipients"
        ]
      },
      "RakeSignComment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "audience": {
            "type": "string",
            "enum": ["internal", "participants"]
          },
          "text": {
            "type": "string"
          },
          "author": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            },
            "required": ["name"]
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": ["id", "audience", "text", "author", "createdAt"]
      },
      "RakeSignBranding": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ownerId": {
            "type": "string"
          },
          "teamId": {
            "type": ["string", "null"]
          },
          "privacy": {
            "type": "string",
            "enum": ["team", "participants"]
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "archivedAt": {
            "type": ["string", "null"]
          },
          "name": {
            "type": "string"
          },
          "accentColor": {
            "type": "string"
          },
          "logoDataUrl": {
            "type": ["string", "null"]
          }
        },
        "required": [
          "id",
          "ownerId",
          "teamId",
          "privacy",
          "version",
          "createdAt",
          "updatedAt",
          "archivedAt",
          "name",
          "accentColor"
        ]
      },
      "__schema1": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/__schema1"
            }
          },
          {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/__schema1"
            }
          }
        ]
      },
      "RakeSignArchive": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "destinationSpaceId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["pending", "failed", "completed"]
          },
          "fileName": {
            "type": "string"
          },
          "fileId": {
            "type": "string"
          },
          "sha256": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "completedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "documentId",
          "destinationSpaceId",
          "status",
          "fileName",
          "createdAt",
          "updatedAt"
        ]
      },
      "__schema2": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/__schema2"
            }
          },
          {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/__schema2"
            }
          }
        ]
      },
      "RakeSignJob": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": ["report", "bulk", "archive", "form"]
          },
          "name": {
            "type": "string"
          },
          "ownerId": {
            "type": "string"
          },
          "integrationId": {
            "type": "string"
          },
          "teamId": {
            "type": "string"
          },
          "payload": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/__schema0"
            }
          },
          "status": {
            "type": "string",
            "enum": ["scheduled", "running", "paused", "completed", "failed", "deleted"]
          },
          "registration": {
            "type": "string",
            "enum": ["pending", "registered", "failed"]
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "nextRunAt": {
            "type": "number"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "lastRunAt": {
            "type": "string"
          },
          "result": {
            "$ref": "#/components/schemas/__schema1"
          },
          "error": {
            "type": "string"
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": ["completed", "failed"]
                },
                "result": {
                  "$ref": "#/components/schemas/__schema2"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": ["at", "status"]
            }
          }
        },
        "required": [
          "id",
          "kind",
          "name",
          "ownerId",
          "payload",
          "status",
          "registration",
          "version",
          "nextRunAt",
          "createdAt",
          "updatedAt",
          "history"
        ]
      },
      "RakeSignForm": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "default": "",
            "type": "string",
            "maxLength": 2000
          },
          "templateId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[\\w-]+$"
          },
          "requesterRoleId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[\\w-]+$"
          },
          "fixedRecipients": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "roleId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[\\w-]+$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "email": {
                  "type": "string",
                  "maxLength": 254,
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                }
              },
              "required": ["roleId", "name", "email"],
              "additionalProperties": false
            }
          },
          "inputs": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z][\\w.-]*$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "type": {
                  "type": "string",
                  "enum": ["text", "number", "boolean", "date", "table"]
                },
                "required": {
                  "type": "boolean"
                },
                "columns": {
                  "maxItems": 20,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^[a-zA-Z][\\w.-]*$"
                  }
                }
              },
              "required": ["key", "label", "type", "required"],
              "additionalProperties": false
            }
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "id": {
            "type": "string"
          },
          "ownerId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["draft", "published", "revoked"]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "publicPath": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "templateId",
          "requesterRoleId",
          "fixedRecipients",
          "inputs",
          "version",
          "id",
          "ownerId",
          "status",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "SigningDelegation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "templateId": {
            "type": "string"
          },
          "templateVersion": {
            "type": ["number", "null"]
          },
          "templateDigest": {
            "type": ["string", "null"]
          },
          "templateName": {
            "type": "string"
          },
          "teamId": {
            "type": ["string", "null"]
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["pending", "active", "declined", "revoked"]
          },
          "createdAt": {
            "type": "string"
          },
          "grantedAt": {
            "type": ["string", "null"]
          },
          "revokedAt": {
            "type": ["string", "null"]
          },
          "declinedAt": {
            "type": ["string", "null"]
          },
          "consentSentAt": {
            "type": ["string", "null"]
          },
          "signedCount": {
            "type": "number"
          },
          "contestedCount": {
            "type": "number"
          },
          "renewedFromId": {
            "type": ["string", "null"]
          },
          "allowedActions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["resend", "revoke", "renew"]
            }
          }
        },
        "required": [
          "id",
          "templateId",
          "templateVersion",
          "templateDigest",
          "templateName",
          "teamId",
          "name",
          "email",
          "status",
          "createdAt",
          "grantedAt",
          "revokedAt",
          "declinedAt",
          "consentSentAt",
          "signedCount",
          "contestedCount",
          "renewedFromId",
          "allowedActions"
        ]
      },
      "SigningDelegationDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "templateId": {
            "type": "string"
          },
          "templateVersion": {
            "type": ["number", "null"]
          },
          "templateDigest": {
            "type": ["string", "null"]
          },
          "templateName": {
            "type": "string"
          },
          "teamId": {
            "type": ["string", "null"]
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["pending", "active", "declined", "revoked"]
          },
          "createdAt": {
            "type": "string"
          },
          "grantedAt": {
            "type": ["string", "null"]
          },
          "revokedAt": {
            "type": ["string", "null"]
          },
          "declinedAt": {
            "type": ["string", "null"]
          },
          "consentSentAt": {
            "type": ["string", "null"]
          },
          "signedCount": {
            "type": "number"
          },
          "contestedCount": {
            "type": "number"
          },
          "renewedFromId": {
            "type": ["string", "null"]
          },
          "allowedActions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["resend", "revoke", "renew"]
            }
          },
          "evidence": {
            "type": "object",
            "properties": {
              "grantedAt": {
                "type": ["string", "null"]
              },
              "ip": {
                "type": ["string", "null"]
              },
              "userAgent": {
                "type": ["string", "null"]
              },
              "templateDigest": {
                "type": ["string", "null"]
              },
              "requestedBy": {
                "type": ["string", "null"]
              },
              "renewalReason": {
                "type": ["string", "null"]
              }
            },
            "required": [
              "grantedAt",
              "ip",
              "userAgent",
              "templateDigest",
              "requestedBy",
              "renewalReason"
            ]
          },
          "signatures": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "envelopeId": {
                  "type": "string"
                },
                "documentName": {
                  "type": "string"
                },
                "signedAt": {
                  "type": ["string", "null"]
                },
                "contestedAt": {
                  "type": ["string", "null"]
                },
                "status": {
                  "type": "string"
                }
              },
              "required": ["envelopeId", "documentName", "signedAt", "contestedAt", "status"]
            }
          },
          "renewal": {
            "type": "object",
            "properties": {
              "previousId": {
                "type": ["string", "null"]
              },
              "nextId": {
                "type": ["string", "null"]
              }
            },
            "required": ["previousId", "nextId"]
          }
        },
        "required": [
          "id",
          "templateId",
          "templateVersion",
          "templateDigest",
          "templateName",
          "teamId",
          "name",
          "email",
          "status",
          "createdAt",
          "grantedAt",
          "revokedAt",
          "declinedAt",
          "consentSentAt",
          "signedCount",
          "contestedCount",
          "renewedFromId",
          "allowedActions",
          "evidence",
          "signatures",
          "renewal"
        ]
      },
      "RequestSigningDelegation": {
        "type": "object",
        "properties": {
          "templateId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "templateVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "email": {
            "type": "string",
            "maxLength": 254,
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "language": {
            "default": "en",
            "type": "string",
            "enum": ["en", "fr"]
          }
        },
        "required": ["templateId", "templateVersion", "name", "email"],
        "additionalProperties": false
      },
      "AutomationFire": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "automationRunId": {
                "type": "string",
                "description": "The fire record. Opaque and stable: a retry of the same signed request reports the same id."
              },
              "threadId": {
                "description": "The thread the run posts in, when the fire opened one at once. `null` while the fire is queued.",
                "type": ["string", "null"]
              },
              "runId": {
                "description": "The run the fire started. For an automation that has moved to the trigger surface this is its work session (`ws_…`). It is `null` while the fire is still queued, which is what a `started` answer reports for such an automation.",
                "type": ["string", "null"]
              },
              "status": {
                "type": "string",
                "enum": ["started", "success", "busy", "needs_input", "blocked", "error"]
              }
            },
            "required": ["automationRunId", "threadId", "runId", "status"],
            "additionalProperties": false
          }
        },
        "required": ["data"],
        "additionalProperties": false
      },
      "V1CitationBbox": {
        "type": "object",
        "properties": {
          "x": {
            "type": "number"
          },
          "y": {
            "type": "number"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          }
        },
        "required": ["x", "y", "width", "height"]
      },
      "V1Citation": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string"
          },
          "page": {
            "type": "number"
          },
          "bbox": {
            "$ref": "#/components/schemas/V1CitationBbox"
          },
          "timecodeStart": {
            "description": "Where the value was said, for audio sources: seconds from the start of the recording. Seek here to hear it. It marks the transcript segment the quoted `text` falls in, so expect segment granularity — read the transcript's `words[]` around it when you need a tighter offset. The counterpart of `page` for documents; absent for document sources.",
            "type": "number"
          },
          "timecodeEnd": {
            "description": "Where the quote stops, in seconds — the end of the transcript segment it falls in. With `timecodeStart` it gives the span to highlight, as `bbox` does for a document page. Absent when the transcript reports no end for that segment (the last one often has none), so treat a missing end as \"unknown\", not as a zero-length quote.",
            "type": "number"
          },
          "timecode": {
            "deprecated": true,
            "description": "Deprecated — read `timecodeStart` instead, which always carries the same value. This is the original name for the start of the cited span, kept so integrations written before the span was published keep working. It is removed in a later release.",
            "type": ["number", "string"]
          },
          "text": {
            "type": "string"
          },
          "confidence": {
            "description": "How strongly the cited text supports the value, 0–5. Only the evidence judge writes it (`judge: true`), and it is absent wherever the judge did not score: an unjudged run, a judged run whose judge failed, or cited entries over the judge cap of 100 per pass. Missing means not graded, never badly graded.",
            "type": "number"
          },
          "uncited": {
            "description": "Nothing in the source supports this value, and it was returned anyway. The field IS filled (that is what separates this from `notFound`), but no passage backs it, so the entry carries no `text` and no location. Treat the value as unverified: it is kept so you can see what was extracted and judge it, not because the document bears it out.",
            "type": "boolean"
          },
          "notFound": {
            "description": "The value is not present in the source, and the field is `null`. The entry names the `fileId` it was checked against but carries no `page`, `bbox`, `timecodeStart`/`timecodeEnd` or `text`.",
            "type": "boolean"
          }
        },
        "required": ["fileId"]
      },
      "V1ExtractRun": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "extract_run"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "expiresAt": {
            "type": ["string", "null"]
          },
          "statusUrl": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": ["id", "name", "status"]
            }
          },
          "file": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            },
            "required": ["id", "name", "status"]
          },
          "error": {
            "description": "Why the run failed. Present whenever `status` is `failed`, and only then.\n\n`code` is the stable, snake_case reason (`input_unavailable`, `parse_failed`, …); `message` is the human-readable detail. Per-file and per-step failures are also reported in `files[].error` and, for a pipeline, `steps[].error`.",
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "config": {
            "description": "The output shape this run actually applied.\n\nOn an inference run — one sent with neither `schema` nor `action` — this is where you read the schema that was inferred, ready to review and save as an action for the next run.",
            "type": "object",
            "properties": {
              "schema": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "revision": {
                "description": "The revision of the saved config the run used. Each save that changes a config adds one. Absent on a run without a saved config, or one created before revisions existed.",
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "overridden": {
                "description": "True when inline config on the call changed the saved config for this run. Present with `revision`.",
                "type": "boolean"
              }
            },
            "required": ["schema"]
          },
          "output": {
            "description": "The extracted data. Present once `status` is `processed`.\n\n`documents[]` always has one entry per input file. For a single-document run, `value`, `citations` and any parsed source fields are lifted to the top as aliases of `documents[0]` so the common case reads without indexing.\n\nParsed source fields are present only when requested with `?output=inline`. The signed URLs remain as a fallback; `markdown` and `json` are omitted when the combined inline source exceeds 1 MiB.",
            "type": "object",
            "properties": {
              "value": {},
              "citations": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/V1Citation"
                  }
                },
                "description": "Where each extracted value came from, keyed by the field it backs.\n\nKeys are the top-level field keys of `value` (`load_number`); for a `rows_per_document` run they are prefixed with the row index, `[0].description`. Each entry names the `fileId` and, when known, the `page` and `bbox` (or `timecodeStart` and `timecodeEnd` for audio), plus the matched `text`. Add `judge: true` to also get a `confidence` score on each entry. An entry with `notFound: true` instead records that the value is not present in the documents at all, and the field is `null`; one with `uncited: true` records that the field IS filled but nothing in the source backs the value.\n\nPresent whenever the run was grounded. Send `citations: true` on the request to ask for it."
              },
              "citationsOmitted": {
                "description": "The citations were dropped because the result exceeded the size budget.",
                "type": "boolean"
              },
              "markdownUrl": {
                "type": "string"
              },
              "jsonUrl": {
                "type": "string"
              },
              "markdown": {
                "type": "string"
              },
              "json": {},
              "documents": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "fileId": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "value": {},
                    "citations": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/V1Citation"
                        }
                      },
                      "description": "Where each extracted value came from, keyed by the field it backs.\n\nKeys are the top-level field keys of `value` (`load_number`); for a `rows_per_document` run they are prefixed with the row index, `[0].description`. Each entry names the `fileId` and, when known, the `page` and `bbox` (or `timecodeStart` and `timecodeEnd` for audio), plus the matched `text`. Add `judge: true` to also get a `confidence` score on each entry. An entry with `notFound: true` instead records that the value is not present in the documents at all, and the field is `null`; one with `uncited: true` records that the field IS filled but nothing in the source backs the value.\n\nPresent whenever the run was grounded. Send `citations: true` on the request to ask for it."
                    },
                    "markdownUrl": {
                      "type": "string"
                    },
                    "jsonUrl": {
                      "type": "string"
                    },
                    "markdown": {
                      "type": "string"
                    },
                    "json": {}
                  },
                  "required": ["fileId", "name", "status"]
                }
              }
            },
            "required": ["documents"]
          }
        },
        "required": ["object", "id", "status", "expiresAt", "statusUrl", "files"]
      },
      "V1RunAccepted": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "statusUrl": {
            "type": "string"
          },
          "envelopeUrl": {
            "type": "string"
          }
        },
        "required": ["object", "id", "status", "statusUrl"]
      },
      "V1ExtractBody": {
        "type": "object",
        "properties": {
          "schema": {
            "description": "The shape to extract, as a JSON Schema object. Send `action` instead to use a saved shape, or neither to have one inferred.\n\nThe root must be `{\"type\": \"object\"}`. The dialect is deliberately narrow — no `$ref`, `$defs`, `oneOf`, `anyOf`, `allOf`, `const` or `pattern` — with a maximum nesting depth of 5 and a 64 KB size limit. Make primitives nullable (`{\"type\": [\"string\", \"null\"]}`) so a missing value reads as `null` rather than a hallucination.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "action": {
            "example": "act_01JQ8ZKMRT4V6WXYZ0ABCDEFGH",
            "description": "A saved action to run, by id or slug. An alternative to `schema`.\n\nThe action carries the output shape and any saved settings. Config you send inline on the same call is merged over it, so `action` plus `instructions` refines a saved action for one run without redefining it.",
            "type": "string",
            "minLength": 1
          },
          "hints": {
            "description": "Prose guidance for **schema inference** — only valid when you send neither `schema` nor `action`.\n\nSay what the documents are and what matters in them (\"freight bills of lading; I care about the load number, the shipper and the total\") and the shape is inferred from the document itself. Sending `hints` alongside `schema` or `action` is a `400`: the shape is already decided.",
            "type": "string",
            "maxLength": 2000
          },
          "instructions": {
            "description": "Free-form guidance for the extraction, applied on top of the schema — house rules, formatting preferences, how to handle ambiguity.",
            "type": "string"
          },
          "citations": {
            "description": "Whether to ground each extracted value in the source document. Off by default — grounding is an explicit add-on, so send `citations: true` to ask for it.\n\nWhen on, `output.citations` maps every extracted field to where it came from — `fileId` plus page and bounding box for documents, or `timecodeStart`/`timecodeEnd` for audio. A field the documents simply do not contain comes back as an entry with `notFound: true` and no location.",
            "type": "boolean"
          },
          "unit": {
            "description": "What one extraction result covers.\n\n- `per_document`: one result object per file (the default).\n- `across_documents`: one result object for the whole set. The files are read together as one source, in the order you list them, so a recording split into parts reads as one recording. Audio mixed with documents cannot be read as one source: each file is then extracted on its own and the results are merged.\n- `rows_per_document`: a list of results per file, for documents that hold repeated records.",
            "type": "string",
            "enum": ["per_document", "across_documents", "rows_per_document"]
          },
          "judge": {
            "description": "Run a second review pass that scores each extracted value against the evidence it cites, adding a `confidence` (0–5) and leaving the values themselves alone. **It is the only pass that scores**: grounding cites without grading, so an unjudged run returns citations with no `confidence`. Slower and more thorough; worth it on documents where an error is expensive.\n\n**The judge audits citations, so it needs `citations: true`.** It scores cited evidence and never re-extracts, so with grounding off there is nothing for it to audit. Sending `judge: true` with `citations: false` is a `400`. When you name an `action`, the saved config's `citations` setting counts — a judge on a saved action that does not ground does nothing.",
            "type": "boolean"
          },
          "file": {
            "description": "A single input file. Send this or `files`, never both.",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "processing": {
                    "type": "string",
                    "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "ephemeral": {
                    "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                    "type": "boolean"
                  }
                },
                "required": ["id"]
              }
            ]
          },
          "files": {
            "description": "Several input files, up to 100. Send this or `file`, never both.\n\nEach file gets its own entry in `output.documents[]` unless `unit` says otherwise.",
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "processing": {
                      "type": "string",
                      "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                    }
                  },
                  "required": ["url"]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "ephemeral": {
                      "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                      "type": "boolean"
                    }
                  },
                  "required": ["id"]
                }
              ],
              "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) for this run and purged with it.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed.\n- `{ \"id\": \"…\", \"ephemeral\": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses."
            }
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          },
          "ttl": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800,
            "default": 86400,
            "description": "How long, in seconds, to keep this run and its files before purging them automatically.\n\nThe maximum is 604800 (7 days). The deadline comes back as `expiresAt` on every read of the run. Call `POST /v1/runs/{id}/keep` before then to clear the TTL and move the results into a space permanently.\n\nE-signature runs are exempt — an envelope waits for its signers however long that takes."
          }
        }
      },
      "V1ExtractBatchItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "statusUrl": {
            "type": "string"
          },
          "file": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "processing": {
                    "type": "string",
                    "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "ephemeral": {
                    "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                    "type": "boolean"
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) for this run and purged with it.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed.\n- `{ \"id\": \"…\", \"ephemeral\": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses."
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          }
        },
        "required": ["file"]
      },
      "V1ExtractBatchAccepted": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "extract_batch"
          },
          "count": {
            "type": "number"
          },
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1ExtractBatchItem"
            }
          }
        },
        "required": ["object", "count", "runs"]
      },
      "V1ExtractBatchBody": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "minLength": 1,
            "example": "act_01JQ8ZKMRT4V6WXYZ0ABCDEFGH",
            "description": "The saved action every run in the batch uses, by id or slug. Required.\n\nInline `schema` and `hints` are deliberately not accepted here: a batch runs one reviewed, versionable shape over many files."
          },
          "files": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "processing": {
                      "type": "string",
                      "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                    }
                  },
                  "required": ["url"]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "ephemeral": {
                      "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                      "type": "boolean"
                    }
                  },
                  "required": ["id"]
                }
              ],
              "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) for this run and purged with it.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed.\n- `{ \"id\": \"…\", \"ephemeral\": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses."
            },
            "description": "The input files, up to 100. Each one becomes its own run."
          },
          "citations": {
            "description": "Whether to ground each extracted value in the source document. Off by default — grounding is an explicit add-on, so send `citations: true` to ask for it.\n\nWhen on, `output.citations` maps every extracted field to where it came from — `fileId` plus page and bounding box for documents, or `timecodeStart`/`timecodeEnd` for audio. A field the documents simply do not contain comes back as an entry with `notFound: true` and no location.",
            "type": "boolean"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          },
          "ttl": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800,
            "default": 86400,
            "description": "How long, in seconds, to keep this run and its files before purging them automatically.\n\nThe maximum is 604800 (7 days). The deadline comes back as `expiresAt` on every read of the run. Call `POST /v1/runs/{id}/keep` before then to clear the TTL and move the results into a space permanently.\n\nE-signature runs are exempt — an envelope waits for its signers however long that takes."
          }
        },
        "required": ["action", "files"],
        "additionalProperties": false
      },
      "V1ParseRun": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "parse_run"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "expiresAt": {
            "type": ["string", "null"]
          },
          "statusUrl": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": ["id", "name", "status"]
            }
          },
          "file": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            },
            "required": ["id", "name", "status"]
          },
          "error": {
            "description": "Why the run failed. Present whenever `status` is `failed`, and only then.\n\n`code` is the stable, snake_case reason (`input_unavailable`, `parse_failed`, …); `message` is the human-readable detail. Per-file and per-step failures are also reported in `files[].error` and, for a pipeline, `steps[].error`.",
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "output": {
            "description": "The parsed document. Present once `status` is `processed`.\n\nBoth links are signed and valid for about an hour: `markdownUrl` for the readable form, `jsonUrl` for the structured one. With `?output=inline`, `markdown` and parsed `json` are included too when their combined payload is at most 1 MiB; larger content falls back to the URLs only.",
            "type": "object",
            "properties": {
              "markdownUrl": {
                "type": "string"
              },
              "jsonUrl": {
                "type": "string"
              },
              "markdown": {
                "type": "string"
              },
              "json": {}
            }
          }
        },
        "required": ["object", "id", "status", "expiresAt", "statusUrl", "files"]
      },
      "V1ParseBody": {
        "type": "object",
        "properties": {
          "file": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "processing": {
                    "type": "string",
                    "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "ephemeral": {
                    "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                    "type": "boolean"
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) for this run and purged with it.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed.\n- `{ \"id\": \"…\", \"ephemeral\": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses."
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          },
          "ttl": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800,
            "default": 86400,
            "description": "How long, in seconds, to keep this run and its files before purging them automatically.\n\nThe maximum is 604800 (7 days). The deadline comes back as `expiresAt` on every read of the run. Call `POST /v1/runs/{id}/keep` before then to clear the TTL and move the results into a space permanently.\n\nE-signature runs are exempt — an envelope waits for its signers however long that takes."
          }
        },
        "required": ["file"]
      },
      "V1RedactRun": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "redact_run"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "expiresAt": {
            "type": ["string", "null"]
          },
          "statusUrl": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": ["id", "name", "status"]
            }
          },
          "file": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            },
            "required": ["id", "name", "status"]
          },
          "error": {
            "description": "Why the run failed. Present whenever `status` is `failed`, and only then.\n\n`code` is the stable, snake_case reason (`input_unavailable`, `parse_failed`, …); `message` is the human-readable detail. Per-file and per-step failures are also reported in `files[].error` and, for a pipeline, `steps[].error`.",
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "output": {
            "description": "The redacted files. Present once `status` is `processed`.\n\n`files[]` holds the new documents — `file` is an alias of the first for single-file runs — each with a signed download link. A `/v1/redact` call takes one input, so it returns at most one file; a `redact` pipeline step over many files returns one per input that had a match.\n\n`entities` tallies what was removed per category. Its keys are open, not a closed set: a finding the `categories` list does not cover reports under its own label. `skipped` counts documents that contained nothing to redact and so produced no new file.",
            "type": "object",
            "properties": {
              "file": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                },
                "required": ["id", "name"]
              },
              "files": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": ["id", "name"]
                }
              },
              "entities": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "number"
                }
              },
              "skipped": {
                "type": "number"
              }
            },
            "required": ["files"]
          }
        },
        "required": ["object", "id", "status", "expiresAt", "statusUrl", "files"]
      },
      "V1RedactBody": {
        "type": "object",
        "properties": {
          "categories": {
            "description": "What counts as sensitive, as free text, not an enum. Each hit reports back under the label you asked for, copied exactly.\n\n**This list replaces the [defaults](https://docs.cloudraker.com/capabilities/redact#what-counts-as-sensitive); it does not extend them.** Sending a shorter list leaves everything outside it in the file. To keep the defaults and add to them, repeat the defaults next to your own entries.",
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "instructions": {
            "type": "string",
            "maxLength": 4000
          },
          "mode": {
            "type": "string",
            "enum": ["targeted", "lines"]
          },
          "style": {
            "type": "string",
            "enum": ["beep", "silence"]
          },
          "action": {
            "type": "string",
            "minLength": 1
          },
          "file": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "processing": {
                    "type": "string",
                    "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "ephemeral": {
                    "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                    "type": "boolean"
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) for this run and purged with it.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed.\n- `{ \"id\": \"…\", \"ephemeral\": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses."
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          },
          "ttl": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800,
            "default": 86400,
            "description": "How long, in seconds, to keep this run and its files before purging them automatically.\n\nThe maximum is 604800 (7 days). The deadline comes back as `expiresAt` on every read of the run. Call `POST /v1/runs/{id}/keep` before then to clear the TTL and move the results into a space permanently.\n\nE-signature runs are exempt — an envelope waits for its signers however long that takes."
          }
        },
        "required": ["file"]
      },
      "V1FillRun": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "fill_run"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "expiresAt": {
            "type": ["string", "null"]
          },
          "statusUrl": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": ["id", "name", "status"]
            }
          },
          "file": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            },
            "required": ["id", "name", "status"]
          },
          "error": {
            "description": "Why the run failed. Present whenever `status` is `failed`, and only then.\n\n`code` is the stable, snake_case reason (`input_unavailable`, `parse_failed`, …); `message` is the human-readable detail. Per-file and per-step failures are also reported in `files[].error` and, for a pipeline, `steps[].error`.",
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "output": {
            "description": "The completed form. Present once `status` is `processed`.\n\n`file` is the filled PDF with a signed download link; `fields` reports the values that were written into it, keyed by field name.",
            "type": "object",
            "properties": {
              "file": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                },
                "required": ["id", "name"]
              },
              "files": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": ["id", "name"]
                }
              },
              "fields": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              }
            },
            "required": ["files"]
          }
        },
        "required": ["object", "id", "status", "expiresAt", "statusUrl", "files"]
      },
      "V1FillBody": {
        "type": "object",
        "properties": {
          "template": {
            "description": "The blank form to fill, given one of two ways.\n\n- `{ \"id\": \"…\" }` — a saved template from `POST /v1/templates`, or any file you own.\n- `{ \"url\": \"…\", \"name\"?: \"…\" }` — fetched for this run only and purged with it.\n\nOptional when `action` names a saved config that carries one — sending it inline still wins.",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              },
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["url"]
              }
            ]
          },
          "instructions": {
            "description": "Free-form guidance for the drafting pass — which source document wins a conflict, how to format dates, which fields to leave blank.",
            "type": "string",
            "maxLength": 4000
          },
          "output": {
            "description": "What the produced PDF looks like. `flattened` (the default) bakes the values in so nothing can be changed; `editable` leaves the form fillable.",
            "type": "string",
            "enum": ["flattened", "editable"]
          },
          "action": {
            "description": "A saved fill action to run, by id or slug. Config you send inline is merged over the saved config.",
            "type": "string",
            "minLength": 1
          },
          "files": {
            "description": "The source documents the field values are drafted from, up to 100. Send this or `values`, never both.",
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "processing": {
                      "type": "string",
                      "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                    }
                  },
                  "required": ["url"]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "ephemeral": {
                      "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                      "type": "boolean"
                    }
                  },
                  "required": ["id"]
                }
              ],
              "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) for this run and purged with it.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed.\n- `{ \"id\": \"…\", \"ephemeral\": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses."
            }
          },
          "values": {
            "description": "The field values to write, keyed by field name — deterministic, no drafting pass. Send this or `files`, never both.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          },
          "ttl": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800,
            "default": 86400,
            "description": "How long, in seconds, to keep this run and its files before purging them automatically.\n\nThe maximum is 604800 (7 days). The deadline comes back as `expiresAt` on every read of the run. Call `POST /v1/runs/{id}/keep` before then to clear the TTL and move the results into a space permanently.\n\nE-signature runs are exempt — an envelope waits for its signers however long that takes."
          }
        },
        "additionalProperties": false
      },
      "V1SignRun": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "sign_run"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "expiresAt": {
            "type": ["string", "null"]
          },
          "statusUrl": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": ["id", "name", "status"]
            }
          },
          "file": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            },
            "required": ["id", "name", "status"]
          },
          "error": {
            "description": "Why the run failed. Present whenever `status` is `failed`, and only then.\n\n`code` is the stable, snake_case reason (`input_unavailable`, `parse_failed`, …); `message` is the human-readable detail. Per-file and per-step failures are also reported in `files[].error` and, for a pipeline, `steps[].error`.",
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "envelopeUrl": {
            "type": "string"
          },
          "output": {
            "description": "The signed document. Present once every required signing slot has completed.\n\n`file` is the sealed PDF, `signers[]` records who signed and when, and `auditUrl` points at the machine-readable audit trail.",
            "type": "object",
            "properties": {
              "file": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                },
                "required": ["id", "name"]
              },
              "files": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": ["id", "name"]
                }
              },
              "envelopeId": {
                "type": "string"
              },
              "signers": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "signedAt": {
                      "type": "string"
                    }
                  },
                  "required": ["name", "email"]
                }
              },
              "cc": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    }
                  },
                  "required": ["name", "email"]
                }
              },
              "auditUrl": {
                "type": "string"
              }
            },
            "required": ["files"]
          }
        },
        "required": ["object", "id", "status", "expiresAt", "statusUrl", "files", "envelopeUrl"]
      },
      "V1SignBody": {
        "type": "object",
        "properties": {
          "expiresInDays": {
            "default": 7,
            "description": "Days recipients have to complete signing, measured from dispatch. From 1 to 90; defaults to 7.",
            "type": "integer",
            "minimum": 1,
            "maximum": 90
          },
          "signers": {
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "delegated": {
                  "default": false,
                  "description": "True if your organization signs on this person’s behalf instead of them signing directly. Requires the e-signature-delegation entitlement and `templateId`. Ignored on `cc`.",
                  "type": "boolean"
                },
                "routingOrder": {
                  "default": 1,
                  "description": "Signing step. People in the same step sign in parallel; later steps wait.",
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "signingGroup": {
                  "description": "People with the same group share one signing slot. The first to sign completes it.",
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "fieldIndex": {
                  "description": "Document tag number. A group shares one number; otherwise defaults to roster position.",
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": ["name", "email"]
            },
            "description": "Who can sign — up to 50 people, each with a `name` and an `email`. Omitted `routingOrder` means everyone signs in parallel. Set increasing steps for ordered signing; use a shared `signingGroup` for any-one signing.\n\nEvery signer verifies their email with a one-time code, then signs by typing their name. Track them individually at `GET /v1/runs/{id}/envelope`."
          },
          "templateId": {
            "description": "Identifies the template your org signs delegated envelopes from. Consent is granted per template, so this is the scope the signer agrees to. A document produced by `POST /v1/compose` or `POST /v1/fill` carries its template sealed inside it and that value is used; this field is then ignored. Send it only for a delegated envelope whose document has no sealed template. Ignored when no signer is `delegated`.",
            "type": "string",
            "minLength": 1
          },
          "templateName": {
            "description": "Human-readable name of that template. Shown to the signer when their consent is requested, and printed on the audit page of every document signed under it. Like `templateId`, the value sealed into a composed or filled document wins. Required when any `signers[]` entry has `delegated: true` and the document carries no sealed template name: either the document has no seal, or its seal has no name. In the second case, also send the sealed `templateId`, or the run fails. Ignored otherwise.",
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "message": {
            "description": "A note included in the invitation email each signer receives.",
            "type": "string",
            "maxLength": 2000
          },
          "placement": {
            "default": "page",
            "description": "Where signatures land in the document.\n\n`page` appends a signature certificate page. `tags` replaces `[Signature N]` placeholders for each required signing slot. Optional `[Initials N]` and `[Date N]` tags add initials and signing dates. Any-one groups share their `fieldIndex` slot.",
            "type": "string",
            "enum": ["page", "tags"]
          },
          "cc": {
            "description": "Informed-only recipients. CC parties do not sign, receive no OTP or signature tag, and are emailed the sealed document when the envelope completes.",
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "delegated": {
                  "default": false,
                  "description": "True if your organization signs on this person’s behalf instead of them signing directly. Requires the e-signature-delegation entitlement and `templateId`. Ignored on `cc`.",
                  "type": "boolean"
                }
              },
              "required": ["name", "email"]
            }
          },
          "language": {
            "default": "en",
            "example": "fr",
            "description": "Language of every recipient-facing asset — invitation and code emails, the signing page, and the audit certificate. Applies to all signers and CC parties. Defaults to en.",
            "type": "string",
            "enum": ["en", "fr"]
          },
          "file": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "processing": {
                    "type": "string",
                    "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "ephemeral": {
                    "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                    "type": "boolean"
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) for this run and purged with it.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed.\n- `{ \"id\": \"…\", \"ephemeral\": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses."
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          },
          "ttl": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800,
            "default": 86400,
            "description": "How long, in seconds, to keep this run and its files before purging them automatically.\n\nThe maximum is 604800 (7 days). The deadline comes back as `expiresAt` on every read of the run. Call `POST /v1/runs/{id}/keep` before then to clear the TTL and move the results into a space permanently.\n\nE-signature runs are exempt — an envelope waits for its signers however long that takes."
          }
        },
        "required": ["signers", "file"]
      },
      "V1ClassSpec": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$",
            "example": "invoice"
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "example": "A bill from a supplier listing line items, quantities and a total amount due."
          }
        },
        "required": ["id", "description"],
        "description": "One class the document can be labelled with.\n\nThe `description` is the accuracy lever — there is no training data and no examples field, so say what the document looks like in plain words. `id` is what you branch on and is never rewritten."
      },
      "V1Usage": {
        "type": "object",
        "properties": {
          "pages": {
            "type": "number"
          },
          "parse": {
            "type": "number"
          },
          "split": {
            "type": "number"
          }
        }
      },
      "V1ClassifyDocument": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "classId": {
            "type": "string"
          },
          "confidence": {
            "description": "How sure the model was, 0–5. Route below 4 to a human; the label itself is never rewritten by a threshold.",
            "type": "number"
          },
          "reasoning": {
            "type": "string"
          }
        },
        "required": ["fileId"]
      },
      "V1ClassifyPage": {
        "type": "object",
        "properties": {
          "page": {
            "type": "number"
          },
          "classId": {
            "type": "string"
          },
          "documentStart": {
            "type": "boolean"
          },
          "confidence": {
            "description": "How sure the model was, 0–5. Route below 4 to a human; the label itself is never rewritten by a threshold.",
            "type": "number"
          },
          "reasoning": {
            "type": "string"
          }
        },
        "required": ["page", "classId"]
      },
      "V1ClassifySegment": {
        "type": "object",
        "properties": {
          "startPage": {
            "type": "number"
          },
          "endPage": {
            "type": "number"
          },
          "classId": {
            "type": "string"
          },
          "confidence": {
            "description": "How sure the model was, 0–5. Route below 4 to a human; the label itself is never rewritten by a threshold.",
            "type": "number"
          }
        },
        "required": ["startPage", "endPage"]
      },
      "V1ClassifyRun": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "classify_run"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "expiresAt": {
            "type": ["string", "null"]
          },
          "statusUrl": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": ["id", "name", "status"]
            }
          },
          "file": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            },
            "required": ["id", "name", "status"]
          },
          "error": {
            "description": "Why the run failed. Present whenever `status` is `failed`, and only then.\n\n`code` is the stable, snake_case reason (`input_unavailable`, `parse_failed`, …); `message` is the human-readable detail. Per-file and per-step failures are also reported in `files[].error` and, for a pipeline, `steps[].error`.",
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "config": {
            "type": "object",
            "properties": {
              "classes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/V1ClassSpec"
                }
              },
              "granularity": {
                "type": "string",
                "enum": ["document", "page"],
                "description": "What one label covers. `document` (the default) answers once for the whole file and bills only the pages sent to the model; `page` answers per page, derives `segments[]` from where documents start, and bills every page."
              },
              "rules": {
                "type": "object",
                "properties": {
                  "minPages": {
                    "type": "number"
                  }
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/V1Usage"
          },
          "output": {
            "description": "The labels. Present once `status` is `processed`.\n\nIn document mode `classId`, `confidence` and `reasoning` are the first document's, and `documents[]` is authoritative for a multi-file run. In page mode `pages[]` is the raw per-page answer and `segments[]` is what `POST /v1/split` consumes.",
            "type": "object",
            "properties": {
              "granularity": {
                "type": "string",
                "enum": ["document", "page"],
                "description": "What one label covers. `document` (the default) answers once for the whole file and bills only the pages sent to the model; `page` answers per page, derives `segments[]` from where documents start, and bills every page."
              },
              "classId": {
                "type": "string"
              },
              "confidence": {
                "description": "How sure the model was, 0–5. Route below 4 to a human; the label itself is never rewritten by a threshold.",
                "type": "number"
              },
              "reasoning": {
                "type": "string"
              },
              "documents": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/V1ClassifyDocument"
                }
              },
              "pages": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/V1ClassifyPage"
                }
              },
              "segments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/V1ClassifySegment"
                }
              },
              "unassignedPages": {
                "type": "array",
                "items": {
                  "type": "number"
                }
              }
            }
          }
        },
        "required": ["object", "id", "status", "expiresAt", "statusUrl", "files"]
      },
      "V1ClassifyBody": {
        "type": "object",
        "properties": {
          "classes": {
            "description": "The classes to choose from, at least 2 and at most 50. Required unless you name a saved `action` that carries them.\n\nOne class is the catch-all. Supply one with `id: \"other\"`, or one is injected for you and echoed back on the run — a closed set with no exit makes the model guess.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1ClassSpec"
            }
          },
          "granularity": {
            "type": "string",
            "enum": ["document", "page"],
            "description": "What one label covers. `document` (the default) answers once for the whole file and bills only the pages sent to the model; `page` answers per page, derives `segments[]` from where documents start, and bills every page."
          },
          "rules": {
            "description": "Page mode only. A segment shorter than `minPages` (default 1) merges into its neighbour.",
            "type": "object",
            "properties": {
              "minPages": {
                "type": "integer",
                "minimum": 1,
                "maximum": 750
              }
            }
          },
          "instructions": {
            "description": "Free-form guidance applied on top of the class descriptions — how to treat continuation sheets, which class wins a tie.",
            "type": "string",
            "maxLength": 4000
          },
          "pageRange": {
            "description": "The pages to consider, 1-based inclusive. Defaults to the first 750 pages, which is also the maximum — a wider range is a `page_limit_exceeded` error, never a silent truncation.",
            "type": "object",
            "properties": {
              "start": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "end": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              }
            },
            "required": ["start", "end"]
          },
          "action": {
            "description": "A saved classify config to run, by id or slug. Config you send inline is merged over it.",
            "type": "string",
            "minLength": 1
          },
          "file": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "processing": {
                    "type": "string",
                    "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "ephemeral": {
                    "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                    "type": "boolean"
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) for this run and purged with it.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed.\n- `{ \"id\": \"…\", \"ephemeral\": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses."
          },
          "files": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "processing": {
                      "type": "string",
                      "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                    }
                  },
                  "required": ["url"]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "ephemeral": {
                      "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                      "type": "boolean"
                    }
                  },
                  "required": ["id"]
                }
              ],
              "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) for this run and purged with it.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed.\n- `{ \"id\": \"…\", \"ephemeral\": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses."
            }
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          },
          "ttl": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800,
            "default": 86400,
            "description": "How long, in seconds, to keep this run and its files before purging them automatically.\n\nThe maximum is 604800 (7 days). The deadline comes back as `expiresAt` on every read of the run. Call `POST /v1/runs/{id}/keep` before then to clear the TTL and move the results into a space permanently.\n\nE-signature runs are exempt — an envelope waits for its signers however long that takes."
          }
        }
      },
      "V1Split": {
        "type": "object",
        "properties": {
          "index": {
            "type": "number"
          },
          "startPage": {
            "type": "number"
          },
          "endPage": {
            "type": "number"
          },
          "pageCount": {
            "type": "number"
          },
          "classId": {
            "type": "string"
          },
          "confidence": {
            "description": "How sure the model was, 0–5. Route below 4 to a human; the label itself is never rewritten by a threshold.",
            "type": "number"
          },
          "fileId": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          }
        },
        "required": ["index", "startPage", "endPage"]
      },
      "V1SplitRun": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "split_run"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "expiresAt": {
            "type": ["string", "null"]
          },
          "statusUrl": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": ["id", "name", "status"]
            }
          },
          "file": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            },
            "required": ["id", "name", "status"]
          },
          "error": {
            "description": "Why the run failed. Present whenever `status` is `failed`, and only then.\n\n`code` is the stable, snake_case reason (`input_unavailable`, `parse_failed`, …); `message` is the human-readable detail. Per-file and per-step failures are also reported in `files[].error` and, for a pipeline, `steps[].error`.",
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "usage": {
            "$ref": "#/components/schemas/V1Usage"
          },
          "output": {
            "description": "The children. Present once `status` is `processed`.\n\n`splits[].fileId` is the authoritative id of each child, ready for `POST /v1/extract`; `documentIds[]` is the same list flattened. `classId` and `confidence` are echoed from whatever you supplied — split has no opinion about what a page is. With `materialize: false` the ranges come back with no `fileId`.",
            "type": "object",
            "properties": {
              "file": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                },
                "required": ["id", "name"]
              },
              "files": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": ["id", "name"]
                }
              },
              "classifyRunId": {
                "type": "string"
              },
              "splits": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/V1Split"
                }
              },
              "documentIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": ["files"]
          }
        },
        "required": ["object", "id", "status", "expiresAt", "statusUrl", "files"]
      },
      "V1SegmentSpec": {
        "type": "object",
        "properties": {
          "startPage": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "endPage": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "classId": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
          }
        },
        "required": ["startPage", "endPage"],
        "description": "A page range, 1-based and inclusive. `classId` is optional and is echoed back untouched — split never labels anything."
      },
      "V1SplitBody": {
        "type": "object",
        "properties": {
          "file": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "processing": {
                    "type": "string",
                    "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "ephemeral": {
                    "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                    "type": "boolean"
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) for this run and purged with it.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed.\n- `{ \"id\": \"…\", \"ephemeral\": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses."
          },
          "segments": {
            "description": "The ranges to cut, 1-based inclusive, ascending and non-overlapping, at most 100. Gaps are allowed — drop a separator page on purpose. Send this or `classifyRunId`, never both.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1SegmentSpec"
            }
          },
          "classifyRunId": {
            "example": "clr_01K3F0000000000000000000",
            "description": "A page-mode classify run to take the ranges from. Its `output.segments` are copied verbatim, `classId` and confidence included. The run must be on the same file and must not have expired.",
            "type": "string",
            "minLength": 1
          },
          "materialize": {
            "default": true,
            "description": "Whether to create the child files. `false` returns the ranges only and creates nothing — the safe first call on a large packet.",
            "type": "boolean"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          },
          "ttl": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800,
            "default": 86400,
            "description": "How long, in seconds, to keep this run and its files before purging them automatically.\n\nThe maximum is 604800 (7 days). The deadline comes back as `expiresAt` on every read of the run. Call `POST /v1/runs/{id}/keep` before then to clear the TTL and move the results into a space permanently.\n\nE-signature runs are exempt — an envelope waits for its signers however long that takes."
          }
        },
        "required": ["file"]
      },
      "V1PipelineAccepted": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "pipeline_run"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "statusUrl": {
            "type": "string"
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": ["string", "null"]
                },
                "capability": {
                  "type": "string",
                  "enum": [
                    "extract",
                    "parse",
                    "redact",
                    "fill",
                    "sign",
                    "classify",
                    "split",
                    "action"
                  ]
                }
              },
              "required": ["id", "capability"]
            }
          }
        },
        "required": ["object", "id", "status", "statusUrl", "steps"]
      },
      "V1PipelineStep": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "extract": {
                "type": "object",
                "properties": {
                  "schema": {
                    "description": "The shape to extract, as a JSON Schema object. Send `action` instead to use a saved shape, or neither to have one inferred.\n\nThe root must be `{\"type\": \"object\"}`. The dialect is deliberately narrow — no `$ref`, `$defs`, `oneOf`, `anyOf`, `allOf`, `const` or `pattern` — with a maximum nesting depth of 5 and a 64 KB size limit. Make primitives nullable (`{\"type\": [\"string\", \"null\"]}`) so a missing value reads as `null` rather than a hallucination.",
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "action": {
                    "example": "act_01JQ8ZKMRT4V6WXYZ0ABCDEFGH",
                    "description": "A saved action to run, by id or slug. An alternative to `schema`.\n\nThe action carries the output shape and any saved settings. Config you send inline on the same call is merged over it, so `action` plus `instructions` refines a saved action for one run without redefining it.",
                    "type": "string",
                    "minLength": 1
                  },
                  "hints": {
                    "description": "Prose guidance for **schema inference** — only valid when you send neither `schema` nor `action`.\n\nSay what the documents are and what matters in them (\"freight bills of lading; I care about the load number, the shipper and the total\") and the shape is inferred from the document itself. Sending `hints` alongside `schema` or `action` is a `400`: the shape is already decided.",
                    "type": "string",
                    "maxLength": 2000
                  },
                  "instructions": {
                    "description": "Free-form guidance for the extraction, applied on top of the schema — house rules, formatting preferences, how to handle ambiguity.",
                    "type": "string"
                  },
                  "citations": {
                    "description": "Whether to ground each extracted value in the source document. Off by default — grounding is an explicit add-on, so send `citations: true` to ask for it.\n\nWhen on, `output.citations` maps every extracted field to where it came from — `fileId` plus page and bounding box for documents, or `timecodeStart`/`timecodeEnd` for audio. A field the documents simply do not contain comes back as an entry with `notFound: true` and no location.",
                    "type": "boolean"
                  },
                  "unit": {
                    "description": "What one extraction result covers.\n\n- `per_document`: one result object per file (the default).\n- `across_documents`: one result object for the whole set. The files are read together as one source, in the order you list them, so a recording split into parts reads as one recording. Audio mixed with documents cannot be read as one source: each file is then extracted on its own and the results are merged.\n- `rows_per_document`: a list of results per file, for documents that hold repeated records.",
                    "type": "string",
                    "enum": ["per_document", "across_documents", "rows_per_document"]
                  },
                  "judge": {
                    "description": "Run a second review pass that scores each extracted value against the evidence it cites, adding a `confidence` (0–5) and leaving the values themselves alone. **It is the only pass that scores**: grounding cites without grading, so an unjudged run returns citations with no `confidence`. Slower and more thorough; worth it on documents where an error is expensive.\n\n**The judge audits citations, so it needs `citations: true`.** It scores cited evidence and never re-extracts, so with grounding off there is nothing for it to audit. Sending `judge: true` with `citations: false` is a `400`. When you name an `action`, the saved config's `citations` setting counts — a judge on a saved action that does not ground does nothing.",
                    "type": "boolean"
                  }
                }
              }
            },
            "required": ["extract"]
          },
          {
            "type": "object",
            "properties": {
              "redact": {
                "type": "object",
                "properties": {
                  "categories": {
                    "description": "What counts as sensitive, as free text, not an enum. Each hit reports back under the label you asked for, copied exactly.\n\n**This list replaces the [defaults](https://docs.cloudraker.com/capabilities/redact#what-counts-as-sensitive); it does not extend them.** Sending a shorter list leaves everything outside it in the file. To keep the defaults and add to them, repeat the defaults next to your own entries.",
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "instructions": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "mode": {
                    "type": "string",
                    "enum": ["targeted", "lines"]
                  },
                  "style": {
                    "type": "string",
                    "enum": ["beep", "silence"]
                  },
                  "action": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              }
            },
            "required": ["redact"]
          },
          {
            "type": "object",
            "properties": {
              "fill": {
                "type": "object",
                "properties": {
                  "template": {
                    "description": "The blank form to fill, given one of two ways.\n\n- `{ \"id\": \"…\" }` — a saved template from `POST /v1/templates`, or any file you own.\n- `{ \"url\": \"…\", \"name\"?: \"…\" }` — fetched for this run only and purged with it.\n\nOptional when `action` names a saved config that carries one — sending it inline still wins.",
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": ["id"]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "format": "uri"
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": ["url"]
                      }
                    ]
                  },
                  "instructions": {
                    "description": "Free-form guidance for the drafting pass — which source document wins a conflict, how to format dates, which fields to leave blank.",
                    "type": "string",
                    "maxLength": 4000
                  },
                  "output": {
                    "description": "What the produced PDF looks like. `flattened` (the default) bakes the values in so nothing can be changed; `editable` leaves the form fillable.",
                    "type": "string",
                    "enum": ["flattened", "editable"]
                  },
                  "action": {
                    "description": "A saved fill action to run, by id or slug. Config you send inline is merged over the saved config.",
                    "type": "string",
                    "minLength": 1
                  }
                },
                "additionalProperties": false
              }
            },
            "required": ["fill"]
          },
          {
            "type": "object",
            "properties": {
              "sign": {
                "type": "object",
                "properties": {
                  "expiresInDays": {
                    "default": 7,
                    "description": "Days recipients have to complete signing, measured from dispatch. From 1 to 90; defaults to 7.",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 90
                  },
                  "signers": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        },
                        "delegated": {
                          "default": false,
                          "description": "True if your organization signs on this person’s behalf instead of them signing directly. Requires the e-signature-delegation entitlement and `templateId`. Ignored on `cc`.",
                          "type": "boolean"
                        },
                        "routingOrder": {
                          "default": 1,
                          "description": "Signing step. People in the same step sign in parallel; later steps wait.",
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        },
                        "signingGroup": {
                          "description": "People with the same group share one signing slot. The first to sign completes it.",
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "fieldIndex": {
                          "description": "Document tag number. A group shares one number; otherwise defaults to roster position.",
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": ["name", "email"]
                    },
                    "description": "Who can sign — up to 50 people, each with a `name` and an `email`. Omitted `routingOrder` means everyone signs in parallel. Set increasing steps for ordered signing; use a shared `signingGroup` for any-one signing.\n\nEvery signer verifies their email with a one-time code, then signs by typing their name. Track them individually at `GET /v1/runs/{id}/envelope`."
                  },
                  "templateId": {
                    "description": "Identifies the template your org signs delegated envelopes from. Consent is granted per template, so this is the scope the signer agrees to. A document produced by `POST /v1/compose` or `POST /v1/fill` carries its template sealed inside it and that value is used; this field is then ignored. Send it only for a delegated envelope whose document has no sealed template. Ignored when no signer is `delegated`.",
                    "type": "string",
                    "minLength": 1
                  },
                  "templateName": {
                    "description": "Human-readable name of that template. Shown to the signer when their consent is requested, and printed on the audit page of every document signed under it. Like `templateId`, the value sealed into a composed or filled document wins. Required when any `signers[]` entry has `delegated: true` and the document carries no sealed template name: either the document has no seal, or its seal has no name. In the second case, also send the sealed `templateId`, or the run fails. Ignored otherwise.",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "message": {
                    "description": "A note included in the invitation email each signer receives.",
                    "type": "string",
                    "maxLength": 2000
                  },
                  "placement": {
                    "default": "page",
                    "description": "Where signatures land in the document.\n\n`page` appends a signature certificate page. `tags` replaces `[Signature N]` placeholders for each required signing slot. Optional `[Initials N]` and `[Date N]` tags add initials and signing dates. Any-one groups share their `fieldIndex` slot.",
                    "type": "string",
                    "enum": ["page", "tags"]
                  },
                  "cc": {
                    "description": "Informed-only recipients. CC parties do not sign, receive no OTP or signature tag, and are emailed the sealed document when the envelope completes.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        },
                        "delegated": {
                          "default": false,
                          "description": "True if your organization signs on this person’s behalf instead of them signing directly. Requires the e-signature-delegation entitlement and `templateId`. Ignored on `cc`.",
                          "type": "boolean"
                        }
                      },
                      "required": ["name", "email"]
                    }
                  },
                  "language": {
                    "default": "en",
                    "example": "fr",
                    "description": "Language of every recipient-facing asset — invitation and code emails, the signing page, and the audit certificate. Applies to all signers and CC parties. Defaults to en.",
                    "type": "string",
                    "enum": ["en", "fr"]
                  }
                },
                "required": ["signers"]
              }
            },
            "required": ["sign"]
          },
          {
            "type": "object",
            "properties": {
              "parse": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              }
            },
            "required": ["parse"]
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "minLength": 1
              },
              "config": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              "params": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              }
            },
            "required": ["action"]
          }
        ]
      },
      "V1PipelineBody": {
        "type": "object",
        "properties": {
          "files": {
            "minItems": 1,
            "maxItems": 100,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "processing": {
                      "type": "string",
                      "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                    }
                  },
                  "required": ["url"]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    },
                    "ephemeral": {
                      "description": "Purge this file with the run (TTL expiry or `DELETE /v1/runs/{id}`), unless you `keep` the run. API workspace only: ignored under `/v1/spaces/{spaceId}/…`.",
                      "type": "boolean"
                    }
                  },
                  "required": ["id"]
                }
              ],
              "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) for this run and purged with it.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reusable across runs and never re-parsed.\n- `{ \"id\": \"…\", \"ephemeral\": true }` — a file you uploaded only for this run, purged with it. Use it only on a file no other run uses."
            },
            "description": "The input files, up to 100. They are parsed once and every step sees the same parsed set."
          },
          "steps": {
            "minItems": 1,
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1PipelineStep"
            },
            "description": "What to run over the files — up to 20 steps, executed in parallel rather than chained.\n\nEach step is either an inline capability config (`{ \"extract\": {…} }`, `{ \"redact\": {…} }`, `{ \"fill\": {…} }`, `{ \"sign\": {…} }`) or a saved action (`{ \"action\": \"…\", \"params\": {…} }`). There is no `parse` step: parsing is automatic. A step never consumes another step's output."
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          },
          "ttl": {
            "type": "integer",
            "minimum": 1,
            "maximum": 604800,
            "default": 86400,
            "description": "How long, in seconds, to keep this run and its files before purging them automatically.\n\nThe maximum is 604800 (7 days). The deadline comes back as `expiresAt` on every read of the run. Call `POST /v1/runs/{id}/keep` before then to clear the TTL and move the results into a space permanently.\n\nE-signature runs are exempt — an envelope waits for its signers however long that takes."
          }
        },
        "required": ["files", "steps"]
      },
      "V1RunListItem": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "extract_run",
              "parse_run",
              "redact_run",
              "fill_run",
              "sign_run",
              "classify_run",
              "split_run",
              "pipeline_run"
            ]
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "createdAt": {
            "type": "string"
          },
          "expiresAt": {
            "type": ["string", "null"]
          },
          "statusUrl": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "kept": {
            "type": "object",
            "properties": {
              "spaceId": {
                "type": "string"
              },
              "keptAt": {
                "type": "string"
              }
            },
            "required": ["spaceId", "keptAt"]
          }
        },
        "required": ["object", "id", "status", "createdAt", "expiresAt", "statusUrl"]
      },
      "V1RunList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1RunListItem"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "cursor": {
            "type": "string"
          }
        },
        "required": ["object", "data", "has_more"]
      },
      "V1PipelineStepView": {
        "type": "object",
        "properties": {
          "id": {
            "type": ["string", "null"]
          },
          "capability": {
            "type": "string",
            "enum": ["extract", "parse", "redact", "fill", "sign", "classify", "split", "action"]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "error": {
            "type": "string"
          },
          "output": {}
        },
        "required": ["id", "capability", "status"]
      },
      "V1PipelineRun": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "pipeline_run"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "processed",
              "failed",
              "cancelled",
              "expired",
              "needs_input"
            ],
            "description": "Where the run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted, not started |\n| `processing` | Work in flight |\n| `needs_input` | Waiting for an external action, such as an e-signature |\n| `processed` | Finished; `output` is populated |\n| `failed` | Finished unsuccessfully |\n| `cancelled` | Stopped on request |\n| `expired` | TTL elapsed and the data was purged |\n\nThe last four are terminal."
          },
          "expiresAt": {
            "type": ["string", "null"]
          },
          "statusUrl": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              },
              "required": ["id", "name", "status"]
            }
          },
          "file": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            },
            "required": ["id", "name", "status"]
          },
          "error": {
            "description": "Why the run failed. Present whenever `status` is `failed`, and only then.\n\n`code` is the stable, snake_case reason (`input_unavailable`, `parse_failed`, …); `message` is the human-readable detail. Per-file and per-step failures are also reported in `files[].error` and, for a pipeline, `steps[].error`.",
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1PipelineStepView"
            }
          }
        },
        "required": ["object", "id", "status", "expiresAt", "statusUrl", "files", "steps"]
      },
      "V1KeepResult": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "run"
          },
          "id": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          },
          "dashboardUrl": {
            "type": "string"
          }
        },
        "required": ["object", "id", "spaceId", "dashboardUrl"]
      },
      "V1KeepBody": {
        "type": "object",
        "properties": {
          "spaceId": {
            "type": "string",
            "minLength": 1
          },
          "space": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": ["name"]
          }
        }
      },
      "RunSignEnvelopeView": {
        "type": "object",
        "properties": {
          "envelope": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "docName": {
                "type": "string"
              },
              "docSha256": {
                "type": "string"
              },
              "docSize": {
                "type": "number"
              },
              "status": {
                "type": "string",
                "enum": ["pending", "finalizing", "completed", "failed", "voided"]
              },
              "signatureMode": {
                "type": "string"
              },
              "language": {
                "type": "string",
                "enum": ["en", "fr"]
              },
              "message": {
                "type": ["string", "null"]
              },
              "error": {
                "type": ["string", "null"]
              },
              "outputFileId": {
                "description": "The signed PDF. Download it with `GET /v1/files/{id}`.",
                "type": ["string", "null"]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "completedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              }
            },
            "required": [
              "id",
              "docName",
              "docSha256",
              "docSize",
              "status",
              "signatureMode",
              "language",
              "message",
              "error",
              "outputFileId",
              "createdAt",
              "completedAt",
              "expiresAt"
            ]
          },
          "signers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "position": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "routingOrder": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "signingGroup": {
                  "type": ["string", "null"]
                },
                "fieldIndex": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "source": {
                  "type": "string",
                  "enum": ["install", "run"]
                },
                "status": {
                  "type": "string",
                  "enum": ["pending", "needs_input", "waiting", "signed", "skipped"]
                },
                "emailVerifiedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "signedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "typedName": {
                  "type": ["string", "null"]
                },
                "lastInvitedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "email",
                "position",
                "source",
                "status",
                "emailVerifiedAt",
                "signedAt",
                "typedName",
                "lastInvitedAt"
              ]
            },
            "description": "Ordered by signing position. Never carries a signing link."
          },
          "cc": {
            "description": "Informed-only recipients, emailed the sealed PDF on completion.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                }
              },
              "required": ["name", "email"]
            }
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "actor": {
                  "type": "string",
                  "description": "Signer name, or `system`."
                },
                "signerId": {
                  "type": ["string", "null"]
                },
                "ip": {
                  "type": ["string", "null"]
                },
                "occurredAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "data": {
                  "anyOf": [
                    {},
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": ["id", "type", "actor", "signerId", "ip", "occurredAt", "data"]
            }
          }
        },
        "required": ["envelope", "signers", "events"]
      },
      "SignAuditTrail": {
        "type": "object",
        "properties": {
          "envelopeId": {
            "type": "string"
          },
          "document": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "sha256": {
                "type": "string"
              },
              "size": {
                "type": "number"
              }
            },
            "required": ["name", "sha256", "size"]
          },
          "status": {
            "type": "string"
          },
          "completedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "signers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "status": {
                  "type": "string",
                  "enum": ["pending", "needs_input", "waiting", "signed", "skipped"]
                },
                "routingOrder": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "signingGroup": {
                  "type": ["string", "null"]
                },
                "fieldIndex": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "typedName": {
                  "type": ["string", "null"]
                },
                "emailVerifiedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "signedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ip": {
                  "type": ["string", "null"]
                },
                "userAgent": {
                  "type": ["string", "null"]
                }
              },
              "required": [
                "name",
                "email",
                "typedName",
                "emailVerifiedAt",
                "signedAt",
                "ip",
                "userAgent"
              ]
            }
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                }
              },
              "required": ["name", "email"]
            }
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "occurredAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "eventType": {
                  "type": "string"
                },
                "actor": {
                  "type": "string"
                },
                "ip": {
                  "type": ["string", "null"]
                }
              },
              "required": ["occurredAt", "eventType", "actor", "ip"]
            }
          }
        },
        "required": ["envelopeId", "document", "status", "completedAt", "signers", "events"],
        "description": "Served as an attachment. The same material the signed PDF carries as `audit-trail.json`, plus `status`, minus the page count."
      },
      "VoidRunEnvelopeResult": {
        "type": "object",
        "properties": {
          "voided": {
            "type": "boolean",
            "const": true
          }
        },
        "required": ["voided"]
      },
      "ResendRunSignerResult": {
        "type": "object",
        "properties": {
          "resent": {
            "type": "boolean",
            "const": true
          }
        },
        "required": ["resent"]
      },
      "V1File": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "file"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "mimeType": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["uploading", "processing", "ready", "failed"]
          },
          "createdAt": {
            "type": "string"
          },
          "parentFileId": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "error": {
            "type": "string"
          },
          "uploadUrl": {
            "type": "string"
          },
          "uploadExpiresAt": {
            "type": "string"
          },
          "urls": {
            "type": "object",
            "properties": {
              "content": {
                "type": "string"
              },
              "markdown": {
                "type": "string"
              },
              "json": {
                "type": "string"
              }
            }
          }
        },
        "required": ["object", "id", "name", "mimeType", "status", "createdAt"]
      },
      "V1FileProcessing": {
        "type": "string",
        "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize", "none"]
      },
      "V1CreateFileBody": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "example": "https://example.com/invoice.pdf"
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "processing": {
                "$ref": "#/components/schemas/V1FileProcessing"
              }
            },
            "required": ["url"]
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "example": "recording.mp3"
              },
              "mimeType": {
                "type": "string",
                "minLength": 1,
                "example": "audio/mpeg"
              },
              "processing": {
                "$ref": "#/components/schemas/V1FileProcessing"
              }
            },
            "required": ["name", "mimeType"]
          }
        ]
      },
      "V1FileList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1File"
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1Template": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "template"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "mimeType": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["uploading", "processing", "ready", "failed"]
          },
          "createdAt": {
            "type": "string"
          },
          "downloadUrl": {
            "type": "string"
          },
          "uploadUrl": {
            "type": "string"
          },
          "uploadExpiresAt": {
            "type": "string"
          }
        },
        "required": ["object", "id", "name", "mimeType", "status", "createdAt"]
      },
      "V1CreateTemplateBody": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "example": "https://example.com/w9.pdf"
              },
              "name": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": ["url"]
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "example": "w9.pdf"
              },
              "mimeType": {
                "type": "string",
                "minLength": 1,
                "example": "application/pdf"
              }
            },
            "required": ["name", "mimeType"]
          }
        ]
      },
      "V1TemplateList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1Template"
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1TemplateField": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The field name — the key `values` and task submissions use."
          },
          "type": {
            "type": "string",
            "example": "text"
          },
          "label": {
            "description": "Human label, read from the form or inferred. `null` when neither worked.",
            "type": ["string", "null"]
          },
          "description": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "options": {
            "description": "Choice options (radio, dropdown, listbox).",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "maxLength": {
            "description": "Character cap the widget enforces — longer values are truncated on fill.",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "multiline": {
            "type": "boolean"
          },
          "section": {
            "description": "Heading the field sits under, if any.",
            "type": "string"
          },
          "page": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "0-based page the field sits on."
          },
          "box": {
            "type": "object",
            "properties": {
              "x": {
                "type": "number"
              },
              "y": {
                "type": "number"
              },
              "width": {
                "type": "number"
              },
              "height": {
                "type": "number"
              }
            },
            "required": ["x", "y", "width", "height"],
            "description": "Widget box in points, origin top-left."
          },
          "ignore": {
            "description": "Curated as not-fillable.",
            "type": "boolean"
          }
        },
        "required": ["name", "type", "label", "page", "box"]
      },
      "V1TemplateInspection": {
        "type": "object",
        "properties": {
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1TemplateField"
            }
          },
          "schema": {
            "description": "A JSON Schema describing the `values` object the fields accept.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "pageBoxes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "width": {
                  "type": "number"
                },
                "height": {
                  "type": "number"
                }
              },
              "required": ["width", "height"]
            },
            "description": "Page size in points, one entry per page."
          },
          "pageCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "detected": {
            "type": "boolean",
            "description": "True when the fields were detected rather than read from an existing AcroForm."
          },
          "templateHash": {
            "description": "sha256 of the prepared template bytes — save it with the fields to spot a stale curation.",
            "type": "string"
          }
        },
        "required": ["fields", "pageBoxes", "pageCount", "detected"]
      },
      "V1WebhookEndpoint": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "webhook_endpoint"
          },
          "id": {
            "type": "string",
            "example": "whe_01JQ8ZKMRT4V6WXYZ0ABCDEFGH"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "disabled": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": ["object", "id", "url", "disabled", "createdAt"]
      },
      "V1CreateWebhookBody": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://example.com/hooks/cloudraker"
          },
          "events": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "processing.started",
                "file.processed",
                "file.failed",
                "run.completed",
                "run.failed",
                "processing.completed",
                "processing.expired",
                "space.expired",
                "agent_run.waiting",
                "agent_run.needs_input",
                "agent_run.approval_requested",
                "agent_run.task_ready",
                "agent_run.completed",
                "agent_run.failed",
                "work_session.opened",
                "work_session.waiting",
                "work_session.done",
                "turn.started",
                "turn.finished",
                "turn.failed",
                "approval.requested",
                "approval.decided",
                "artifact.created",
                "artifact.committed",
                "embed.document_saved",
                "embed.document_approved"
              ]
            }
          },
          "disabled": {
            "type": "boolean"
          }
        },
        "required": ["url"]
      },
      "V1WebhookList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1WebhookEndpoint"
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1UpdateWebhookBody": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://example.com/hooks/cloudraker"
          },
          "events": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "processing.started",
                "file.processed",
                "file.failed",
                "run.completed",
                "run.failed",
                "processing.completed",
                "processing.expired",
                "space.expired",
                "agent_run.waiting",
                "agent_run.needs_input",
                "agent_run.approval_requested",
                "agent_run.task_ready",
                "agent_run.completed",
                "agent_run.failed",
                "work_session.opened",
                "work_session.waiting",
                "work_session.done",
                "turn.started",
                "turn.finished",
                "turn.failed",
                "approval.requested",
                "approval.decided",
                "artifact.created",
                "artifact.committed",
                "embed.document_saved",
                "embed.document_approved"
              ]
            }
          },
          "disabled": {
            "type": "boolean"
          }
        }
      },
      "V1WebhookDelivery": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "webhook_delivery"
          },
          "endpointId": {
            "type": "string"
          },
          "processingId": {
            "type": "string"
          },
          "eventId": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "attempt": {
            "type": "number"
          },
          "responseStatus": {
            "type": "number"
          },
          "ok": {
            "type": "boolean"
          },
          "at": {
            "type": "string"
          }
        },
        "required": ["object", "endpointId"]
      },
      "V1WebhookDeliveryList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1WebhookDelivery"
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1CapabilityCatalogEntry": {
        "type": "object",
        "properties": {
          "capability": {
            "type": "string",
            "enum": ["extract", "redact", "fill", "sign", "classify", "split", "compose"]
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "slugs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "slug": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "configSchema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": ["slug", "name", "description", "configSchema"]
            }
          }
        },
        "required": ["capability", "name", "description", "slugs", "actions"]
      },
      "V1CapabilityCatalog": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1CapabilityCatalogEntry"
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1Action": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "action"
          },
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "capability": {
            "type": "string",
            "enum": ["extract", "redact", "fill", "sign", "classify", "split", "compose"]
          },
          "config": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": ["object", "id", "slug", "name", "capability", "config"]
      },
      "V1CreateActionBody": {
        "type": "object",
        "properties": {
          "capability": {
            "type": "string",
            "enum": ["extract", "redact", "fill", "sign", "classify", "split", "compose"]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "example": "Medical intake"
          },
          "config": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "mimeType": {
            "example": "application/pdf",
            "type": "string",
            "minLength": 1
          }
        },
        "required": ["capability", "name"],
        "additionalProperties": false
      },
      "V1ActionList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1Action"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": ["object", "data", "has_more"]
      },
      "V1Config": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "config"
          },
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "capability": {
            "type": "string",
            "enum": ["extract", "redact", "fill", "sign", "classify", "split", "compose"]
          },
          "config": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "updatedAt": {
            "type": "string"
          },
          "revision": {
            "description": "The number of the saved config. It starts at 1, and each update that changes `config` adds one. Each run reports the revision it used, in `config.revision`.",
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          }
        },
        "required": ["object", "id", "slug", "name", "capability", "config"]
      },
      "V1CreateConfigBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "example": "Medical intake"
          },
          "config": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": ["name"],
        "additionalProperties": false
      },
      "V1ConfigList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1Config"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": ["object", "data", "has_more"]
      },
      "V1UpdateConfigBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "config": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "additionalProperties": false
      },
      "V1CreateRedactConfigBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "example": "Medical intake"
          },
          "config": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "mimeType": {
            "example": "application/pdf",
            "description": "Disambiguates document vs audio redaction",
            "type": "string",
            "minLength": 1
          }
        },
        "required": ["name"],
        "additionalProperties": false
      },
      "V1FillConfig": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "config"
          },
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "capability": {
            "type": "string",
            "const": "fill"
          },
          "config": {
            "type": "object",
            "properties": {
              "template": {
                "type": "string",
                "minLength": 1
              },
              "instructions": {
                "type": "string",
                "maxLength": 4000
              },
              "output": {
                "type": "string",
                "enum": ["flattened", "editable"]
              },
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "type": {
                      "type": "string",
                      "minLength": 1
                    },
                    "label": {
                      "type": ["string", "null"]
                    },
                    "description": {
                      "type": "string"
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "maxLength": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "multiline": {
                      "type": "boolean"
                    },
                    "section": {
                      "type": "string"
                    },
                    "page": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "box": {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        },
                        "width": {
                          "type": "number"
                        },
                        "height": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y", "width", "height"]
                    },
                    "ignore": {
                      "type": "boolean"
                    }
                  },
                  "required": ["name", "type", "label", "page", "box"],
                  "additionalProperties": false
                }
              },
              "templateHash": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            },
            "additionalProperties": false
          },
          "updatedAt": {
            "type": "string"
          },
          "revision": {
            "description": "The number of the saved config. It starts at 1, and each update that changes `config` adds one. Each run reports the revision it used, in `config.revision`.",
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          }
        },
        "required": ["object", "id", "slug", "name", "capability", "config"]
      },
      "V1CreateFillConfigBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "example": "Medical intake"
          },
          "config": {
            "type": "object",
            "properties": {
              "template": {
                "type": "string",
                "minLength": 1
              },
              "instructions": {
                "type": "string",
                "maxLength": 4000
              },
              "output": {
                "type": "string",
                "enum": ["flattened", "editable"]
              },
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "type": {
                      "type": "string",
                      "minLength": 1
                    },
                    "label": {
                      "type": ["string", "null"]
                    },
                    "description": {
                      "type": "string"
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "maxLength": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "multiline": {
                      "type": "boolean"
                    },
                    "section": {
                      "type": "string"
                    },
                    "page": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "box": {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        },
                        "width": {
                          "type": "number"
                        },
                        "height": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y", "width", "height"]
                    },
                    "ignore": {
                      "type": "boolean"
                    }
                  },
                  "required": ["name", "type", "label", "page", "box"],
                  "additionalProperties": false
                }
              },
              "templateHash": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            },
            "additionalProperties": false
          }
        },
        "required": ["name"],
        "additionalProperties": false
      },
      "V1FillConfigList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1FillConfig"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": ["object", "data", "has_more"]
      },
      "V1UpdateFillConfigBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "config": {
            "type": "object",
            "properties": {
              "template": {
                "type": "string",
                "minLength": 1
              },
              "instructions": {
                "type": "string",
                "maxLength": 4000
              },
              "output": {
                "type": "string",
                "enum": ["flattened", "editable"]
              },
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "type": {
                      "type": "string",
                      "minLength": 1
                    },
                    "label": {
                      "type": ["string", "null"]
                    },
                    "description": {
                      "type": "string"
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "maxLength": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "multiline": {
                      "type": "boolean"
                    },
                    "section": {
                      "type": "string"
                    },
                    "page": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "box": {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        },
                        "width": {
                          "type": "number"
                        },
                        "height": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y", "width", "height"]
                    },
                    "ignore": {
                      "type": "boolean"
                    }
                  },
                  "required": ["name", "type", "label", "page", "box"],
                  "additionalProperties": false
                }
              },
              "templateHash": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "V1Conversion": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "conversion"
          },
          "format": {
            "type": "string",
            "const": "markdown"
          },
          "fileId": {
            "type": "string"
          },
          "markdown": {
            "type": "string"
          }
        },
        "required": ["object", "format", "fileId", "markdown"]
      },
      "V1RenderPageBody": {
        "type": "object",
        "properties": {
          "page": {
            "example": 1,
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "scale": {
            "example": 2,
            "type": "number",
            "minimum": 0.1,
            "maximum": 6
          }
        },
        "additionalProperties": false
      },
      "V1StitchBody": {
        "type": "object",
        "properties": {
          "files": {
            "minItems": 2,
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "example": ["part1.mp3", "part2.mp3"]
          },
          "format": {
            "type": "string",
            "enum": ["mp3", "m4a", "wav"]
          }
        },
        "required": ["files"],
        "additionalProperties": false
      },
      "V1RedlineSession": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "redline_session"
          },
          "id": {
            "type": "string",
            "example": "rdl_01K9Z6P2R4"
          },
          "fileId": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": ["object", "id", "fileId", "expiresAt", "revision"]
      },
      "V1RedlineBody": {
        "type": "object",
        "properties": {
          "ttl": {
            "example": 86400,
            "type": "integer",
            "minimum": 60,
            "maximum": 604800
          }
        },
        "additionalProperties": false
      },
      "V1RedlineSessionState": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "summary": {
            "type": "object",
            "properties": {
              "paragraphCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "comments": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "trackedChanges": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": ["paragraphCount", "comments", "trackedChanges"]
          }
        },
        "required": ["id", "filename", "createdAt", "expiresAt", "revision", "summary"]
      },
      "V1RedlineContent": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "blockId": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              },
              "required": ["blockId", "text"]
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1RedlineMutation": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "summary": {
            "type": "object",
            "properties": {
              "paragraphCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "comments": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "trackedChanges": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": ["paragraphCount", "comments", "trackedChanges"]
          }
        },
        "required": ["revision", "summary"]
      },
      "V1RedlineEdit": {
        "type": "object",
        "properties": {
          "op": {
            "type": "string",
            "enum": ["replace", "insertMarkdown", "fill", "deleteText"]
          },
          "anchorText": {
            "example": "thirty (30) days",
            "type": "string"
          },
          "occurrence": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "all": {
            "type": "boolean"
          },
          "replacement": {
            "example": "sixty (60) days",
            "type": "string"
          },
          "markdown": {
            "type": "string"
          },
          "position": {
            "type": "string",
            "enum": ["before", "after", "end"]
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "anchorText": {
                  "type": "string"
                },
                "replacement": {
                  "type": "string"
                },
                "occurrence": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "all": {
                  "type": "boolean"
                }
              },
              "required": ["anchorText", "replacement"],
              "additionalProperties": {}
            }
          },
          "tracked": {
            "type": "boolean"
          },
          "author": {
            "type": "string"
          }
        },
        "required": ["op"],
        "additionalProperties": {}
      },
      "V1RedlineSuggestionList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "example": "tc3"
                },
                "kind": {
                  "type": "string"
                },
                "author": {
                  "type": "string"
                },
                "date": {
                  "type": "string"
                },
                "blockId": {
                  "type": "string"
                },
                "snippet": {
                  "type": "string"
                }
              },
              "required": ["id", "kind", "author", "date", "blockId", "snippet"]
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1ApplySuggestionsBody": {
        "type": "object",
        "properties": {
          "accept": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reject": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false
      },
      "V1RedlineRevisionList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "seq": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "ts": {
                  "type": "string"
                },
                "actor": {
                  "type": "string"
                }
              },
              "required": ["seq", "ts", "actor"]
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1RedlineCommentList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "example": "c2"
                },
                "author": {
                  "type": "string",
                  "example": "Counsel"
                },
                "date": {
                  "type": "string"
                },
                "body": {
                  "type": "string"
                },
                "resolved": {
                  "type": "boolean"
                },
                "parentId": {
                  "example": "c0",
                  "type": "string"
                },
                "blockId": {
                  "type": "string",
                  "example": "p3"
                }
              },
              "required": ["id", "author", "date", "body", "resolved", "blockId"]
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1RedlineCommentMutation": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "result": {
            "type": "object",
            "properties": {
              "commentId": {
                "type": "string",
                "example": "c2"
              },
              "resolved": {
                "type": "boolean"
              }
            },
            "required": ["commentId"]
          },
          "summary": {
            "type": "object",
            "properties": {
              "paragraphCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "comments": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "trackedChanges": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": ["paragraphCount", "comments", "trackedChanges"]
          }
        },
        "required": ["revision", "result", "summary"]
      },
      "V1AddRedlineCommentBody": {
        "type": "object",
        "properties": {
          "anchorText": {
            "type": "string",
            "minLength": 1,
            "example": "thirty (30) days"
          },
          "occurrence": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "body": {
            "type": "string",
            "minLength": 1,
            "example": "Sixty days is the market standard here."
          },
          "author": {
            "example": "Counsel",
            "type": "string",
            "minLength": 1
          }
        },
        "required": ["anchorText", "body"],
        "additionalProperties": false
      },
      "V1RedlineCommentReplyBody": {
        "type": "object",
        "properties": {
          "body": {
            "type": "string",
            "minLength": 1,
            "example": "Agreed, updated."
          },
          "author": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": ["body"],
        "additionalProperties": false
      },
      "V1RedlineCommentResolveBody": {
        "type": "object",
        "properties": {
          "resolved": {
            "example": true,
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "V1FlushRedlineBody": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string",
            "minLength": 1,
            "example": "msa.docx"
          }
        },
        "required": ["fileId"],
        "additionalProperties": false
      },
      "V1ComposedFile": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "file"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "mimeType": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["uploading", "processing", "ready", "failed"]
          },
          "createdAt": {
            "type": "string"
          },
          "parentFileId": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "error": {
            "type": "string"
          },
          "uploadUrl": {
            "type": "string"
          },
          "uploadExpiresAt": {
            "type": "string"
          },
          "urls": {
            "type": "object",
            "properties": {
              "content": {
                "type": "string"
              },
              "markdown": {
                "type": "string"
              },
              "json": {
                "type": "string"
              }
            }
          },
          "composeTemplate": {
            "type": "string"
          },
          "templateHash": {
            "type": "string"
          },
          "composedAt": {
            "type": "string"
          }
        },
        "required": ["object", "id", "name", "mimeType", "status", "createdAt"]
      },
      "V1ComposeBody": {
        "type": "object",
        "properties": {
          "template": {
            "type": "string",
            "minLength": 1,
            "example": "invoice"
          },
          "data": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "example": {
              "total": 1240
            }
          },
          "output": {
            "type": "string",
            "enum": ["file", "raw"]
          }
        },
        "required": ["template", "data"],
        "additionalProperties": false
      },
      "V1ComposedFileList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1ComposedFile"
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1ComposeBatchBody": {
        "type": "object",
        "properties": {
          "template": {
            "type": "string",
            "minLength": 1,
            "example": "invoice"
          },
          "items": {
            "minItems": 2,
            "maxItems": 25,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "data": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "name": {
                  "example": "acme-0042",
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                }
              },
              "required": ["data"],
              "additionalProperties": false
            }
          },
          "output": {
            "type": "string",
            "enum": ["files", "zip"]
          }
        },
        "required": ["template", "items"],
        "additionalProperties": false
      },
      "V1ComposeBundleFile": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "file"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "example": "invoice.typ"
          },
          "mimeType": {
            "type": "string",
            "example": "text/plain"
          },
          "size": {
            "type": ["number", "null"]
          },
          "uploadUrl": {
            "type": "string"
          },
          "uploadExpiresAt": {
            "type": "string"
          }
        },
        "required": ["object", "id", "name", "mimeType", "size"]
      },
      "V1ComposeBundleFileList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1ComposeBundleFile"
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1ComposeAddFileBody": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "example": "invoice.typ"
              },
              "content": {
                "type": "string",
                "example": "#set page(margin: 2cm)"
              }
            },
            "required": ["name", "content"]
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "example": "logo.png"
              },
              "mimeType": {
                "type": "string",
                "minLength": 1,
                "example": "image/png"
              }
            },
            "required": ["name", "mimeType"]
          }
        ]
      },
      "V1ComposeConfig": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "main": {
            "example": "invoice.typ",
            "description": "The bundle file the render starts from. It must be a typst source — a name ending in `.typ`.",
            "type": "string",
            "minLength": 1
          },
          "files": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "examples": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "example": "Acme invoice"
                },
                "data": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              },
              "required": ["name", "data"],
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      },
      "V1ComposeConfigObject": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "config"
          },
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "capability": {
            "type": "string",
            "const": "compose"
          },
          "config": {
            "$ref": "#/components/schemas/V1ComposeConfig"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": ["object", "id", "slug", "name", "capability", "config"]
      },
      "V1ComposePreviewBody": {
        "type": "object",
        "properties": {
          "example": {
            "type": "string",
            "minLength": 1
          }
        },
        "additionalProperties": false
      },
      "V1AgentTask": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "task-1"
          },
          "title": {
            "type": "string"
          },
          "executor": {
            "type": "string",
            "enum": ["agent", "human"],
            "description": "Who performs the step: `agent` runs by itself, `human` waits for a person to complete it."
          },
          "dependsOn": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": ["id", "title", "executor", "dependsOn"]
      },
      "V1AgentAction": {
        "type": "object",
        "properties": {
          "name": {
            "type": ["string", "null"]
          },
          "approval": {
            "type": "string",
            "enum": ["auto", "before", "output", "both"],
            "description": "When a person has to sign off on this step.\n\n- `auto` — no sign-off.\n- `before` — approve the proposed inputs before it runs.\n- `output` — approve the result before it is used.\n- `both` — both gates."
          }
        },
        "required": ["name", "approval"]
      },
      "V1Agent": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "agent"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "version": {
            "type": "number"
          },
          "tasks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1AgentTask"
            }
          },
          "actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1AgentAction"
            }
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "id",
          "name",
          "description",
          "version",
          "tasks",
          "actions",
          "updatedAt"
        ]
      },
      "V1AgentList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1Agent"
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1Error": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          },
          "requestId": {
            "type": "string"
          },
          "docUrl": {
            "type": "string"
          }
        },
        "required": ["code", "message", "retryable", "requestId"]
      },
      "V1AgentRunTask": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "executor": {
            "type": "string",
            "enum": ["agent", "human"],
            "description": "Who performs the step: `agent` runs by itself, `human` waits for a person to complete it."
          },
          "status": {
            "type": "string",
            "enum": ["pending", "ready", "in_progress", "completed", "skipped"],
            "description": "Where this step stands. `pending` is blocked on its dependencies, `ready` is claimable, `skipped` satisfies anything waiting on it."
          },
          "summary": {
            "type": ["string", "null"]
          },
          "note": {
            "type": "string"
          },
          "completedAt": {
            "type": ["string", "null"]
          }
        },
        "required": ["id", "title", "executor", "status", "summary", "completedAt"]
      },
      "V1AgentRunApproval": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": ["before", "output"]
          },
          "action": {
            "type": "string"
          },
          "requestedAt": {
            "type": "string"
          },
          "rationale": {
            "type": ["string", "null"]
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": ["id", "name"]
            }
          },
          "params": {
            "description": "The inputs proposed for the step, for a `before` approval.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": ["id", "kind", "action", "requestedAt", "files"]
      },
      "V1AgentRun": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "agent_run"
          },
          "id": {
            "type": "string",
            "example": "agr_01JQ8ZKMRT4V6WXYZ0ABCDEFGH"
          },
          "agent": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "number"
              }
            },
            "required": ["id", "name", "version"]
          },
          "input": {
            "type": "object",
            "properties": {
              "files": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": ["id"]
                },
                "description": "The immutable input file ids. Reuse these with `agent.id` to start a successor after a terminal run."
              }
            },
            "required": ["files"]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "waiting",
              "paused",
              "completed",
              "failed",
              "cancelled",
              "expired"
            ],
            "description": "Where the agent run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted; its files are still being prepared |\n| `processing` | The agent is working |\n| `waiting` | Blocked on a person — see `waiting`, `approvals` and `tasks[]` |\n| `paused` | Stopped short of finishing and resumable; not a failure |\n| `completed` | Finished; `result` and `output` are populated |\n| `failed` | Finished without producing a result |\n| `cancelled` | Stopped on request |\n| `expired` | Reached its `expiresAt` without finishing |\n\n`completed`, `failed`, `cancelled` and `expired` are terminal. A `completed` run that still had outstanding work also carries `incomplete: true`."
          },
          "waiting": {
            "description": "What is blocking the run. Present while `status` is `waiting`.",
            "type": "object",
            "properties": {
              "approvals": {
                "type": "number"
              },
              "tasks": {
                "type": "number"
              },
              "summary": {
                "type": "string"
              }
            },
            "required": ["approvals", "tasks", "summary"]
          },
          "paused": {
            "description": "Why the run parked. Present while `status` is `paused`. A paused run keeps everything it produced and can be started again.",
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "enum": ["model_error", "system_error"]
              }
            },
            "required": ["reason"]
          },
          "progress": {
            "type": "object",
            "properties": {
              "tasks": {
                "type": "object",
                "properties": {
                  "total": {
                    "type": "number"
                  },
                  "completed": {
                    "type": "number"
                  }
                },
                "required": ["total", "completed"]
              }
            },
            "required": ["tasks"]
          },
          "tasks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1AgentRunTask"
            }
          },
          "approvals": {
            "description": "Sign-offs the run is waiting on, oldest first.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1AgentRunApproval"
            }
          },
          "incomplete": {
            "description": "Present and `true` on a `completed` run that still had outstanding work — read `tasks[]` to see what.",
            "type": "boolean"
          },
          "result": {
            "description": "The agent's closing summary.",
            "type": "string"
          },
          "output": {
            "description": "Files attached to the run while its steps were completed, each with a signed download link valid for about an hour.",
            "type": "object",
            "properties": {
              "files": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": ["id", "name"]
                }
              }
            },
            "required": ["files"]
          },
          "error": {
            "description": "Why the run failed. Present whenever `status` is `failed`.",
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          },
          "statusUrl": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "createdAt": {
            "type": "string"
          },
          "expiresAt": {
            "description": "The run’s deadline: about seven days after it starts, an unfinished run parks itself for good and its `status` becomes `expired`. `null` once the run is finished. Files and anything the run already filed are never taken back.",
            "type": ["string", "null"]
          },
          "finishedAt": {
            "type": ["string", "null"]
          }
        },
        "required": [
          "object",
          "id",
          "agent",
          "input",
          "status",
          "progress",
          "tasks",
          "statusUrl",
          "createdAt",
          "expiresAt",
          "finishedAt"
        ]
      },
      "V1AgentRunAccepted": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "agent_run"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "waiting",
              "paused",
              "completed",
              "failed",
              "cancelled",
              "expired"
            ],
            "description": "Where the agent run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted; its files are still being prepared |\n| `processing` | The agent is working |\n| `waiting` | Blocked on a person — see `waiting`, `approvals` and `tasks[]` |\n| `paused` | Stopped short of finishing and resumable; not a failure |\n| `completed` | Finished; `result` and `output` are populated |\n| `failed` | Finished without producing a result |\n| `cancelled` | Stopped on request |\n| `expired` | Reached its `expiresAt` without finishing |\n\n`completed`, `failed`, `cancelled` and `expired` are terminal. A `completed` run that still had outstanding work also carries `incomplete: true`."
          },
          "statusUrl": {
            "type": "string"
          }
        },
        "required": ["object", "id", "status", "statusUrl"]
      },
      "V1CreateAgentRunBody": {
        "type": "object",
        "properties": {
          "agent": {
            "type": "string",
            "minLength": 1,
            "description": "The agent to run, by id."
          },
          "files": {
            "minItems": 1,
            "maxItems": 200,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "processing": {
                      "type": "string",
                      "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                    }
                  },
                  "required": ["url"]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": ["id"]
                }
              ],
              "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) and added to your reusable corpus, so the run still has its inputs however long it waits. Never purged on a deadline.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reused as it is and never parsed twice."
            },
            "description": "The files the agent works on, up to 200."
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          }
        },
        "required": ["agent", "files"],
        "additionalProperties": false
      },
      "V1InvokeAgentBody": {
        "type": "object",
        "properties": {
          "input": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000,
            "description": "What you want done, in plain words. Frozen into the run — a later instruction is a steer, not a rewrite."
          },
          "files": {
            "description": "Files the agent works on. Omit entirely for a prompt-only run.",
            "maxItems": 200,
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "processing": {
                      "type": "string",
                      "enum": ["auto", "ocr", "simple", "transcribe", "transcribe_diarize"]
                    }
                  },
                  "required": ["url"]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "required": ["id"]
                }
              ],
              "description": "An input file, given one of two ways.\n\n- `{ \"url\": \"…\", \"name\"?: \"…\", \"processing\"?: \"…\" }` — fetched over http(s) and added to your reusable corpus, so the run still has its inputs however long it waits. Never purged on a deadline.\n- `{ \"id\": \"…\" }` — a file you already registered with `POST /v1/files`, reused as it is and never parsed twice."
            }
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          }
        },
        "required": ["input"],
        "additionalProperties": false
      },
      "V1AgentRunPointer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "waiting",
              "paused",
              "completed",
              "failed",
              "cancelled",
              "expired"
            ],
            "description": "Where the agent run is in its life.\n\n| Status | Meaning |\n| --- | --- |\n| `queued` | Accepted; its files are still being prepared |\n| `processing` | The agent is working |\n| `waiting` | Blocked on a person — see `waiting`, `approvals` and `tasks[]` |\n| `paused` | Stopped short of finishing and resumable; not a failure |\n| `completed` | Finished; `result` and `output` are populated |\n| `failed` | Finished without producing a result |\n| `cancelled` | Stopped on request |\n| `expired` | Reached its `expiresAt` without finishing |\n\n`completed`, `failed`, `cancelled` and `expired` are terminal. A `completed` run that still had outstanding work also carries `incomplete: true`."
          },
          "statusUrl": {
            "type": "string"
          }
        },
        "required": ["id", "status", "statusUrl"]
      },
      "V1AgentRunControl": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "agent_run_control"
          },
          "action": {
            "type": "string",
            "enum": ["steer", "pause", "resume", "cancel"]
          },
          "run": {
            "$ref": "#/components/schemas/V1AgentRunPointer"
          }
        },
        "required": ["object", "action", "run"]
      },
      "V1AgentRunControlBody": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          }
        },
        "required": ["message"],
        "additionalProperties": false
      },
      "V1Actor": {
        "description": "Who caused the event, when it was caused by someone identifiable.",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable id of the principal."
          },
          "name": {
            "description": "Display name, absent for principals that have none (embed tokens).",
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": ["member", "agent", "api_key", "automation", "embed", "external"],
            "description": "What kind of principal acted."
          }
        },
        "required": ["id", "kind"]
      },
      "V1AgentRunTimelineEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "at": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "run_started",
              "step",
              "task_ready",
              "task_claimed",
              "task_completed",
              "task_skipped",
              "action_proposed",
              "approval_requested",
              "approval_decided",
              "action_dispatched",
              "action_awaiting_input",
              "action_completed",
              "action_failed",
              "action_skipped",
              "output_review_requested",
              "output_edited",
              "steer",
              "pause",
              "resume",
              "stop_requested",
              "browser_session_created",
              "browser_session_paired",
              "browser_command",
              "browser_session_ended",
              "run_completed",
              "run_failed",
              "run_cancelled"
            ]
          },
          "title": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "actor": {
            "$ref": "#/components/schemas/V1Actor"
          }
        },
        "required": ["id", "at", "type", "title"]
      },
      "V1AgentRunTimeline": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1AgentRunTimelineEvent"
            }
          },
          "hasMore": {
            "type": "boolean"
          }
        },
        "required": ["object", "data", "hasMore"]
      },
      "V1AgentRunResult": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "agent_run_result"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["completed", "failed", "cancelled", "expired"]
          },
          "incomplete": {
            "type": "boolean"
          },
          "result": {
            "type": "string"
          },
          "output": {
            "type": "object",
            "properties": {
              "files": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": ["id", "name"]
                }
              }
            },
            "required": ["files"]
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": ["code", "message"]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "finishedAt": {
            "type": ["string", "null"]
          }
        },
        "required": ["object", "id", "status", "finishedAt"]
      },
      "V1AgentRunApprovalDecision": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "agent_run_approval"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": ["before", "output"]
          },
          "action": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["pending", "approved", "rejected", "void"]
          },
          "requestedAt": {
            "type": "string"
          },
          "decidedAt": {
            "type": ["string", "null"]
          },
          "note": {
            "type": ["string", "null"]
          },
          "run": {
            "$ref": "#/components/schemas/V1AgentRunPointer"
          }
        },
        "required": [
          "object",
          "id",
          "kind",
          "action",
          "status",
          "requestedAt",
          "decidedAt",
          "note",
          "run"
        ]
      },
      "V1DecideAgentRunApprovalBody": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": ["approve", "reject"],
            "description": "Approve to let the step run (or its result stand), reject to refuse it. A rejection needs a `note`."
          },
          "note": {
            "description": "Why. Required on a rejection, recorded on the run either way.",
            "type": "string",
            "maxLength": 4000
          },
          "params": {
            "description": "Replace the inputs proposed for the step before it runs.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "files": {
            "description": "Replace the files the step works on, by file id.",
            "minItems": 1,
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        },
        "required": ["decision"],
        "additionalProperties": false
      },
      "V1AgentRunTaskCompletion": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "agent_run_task"
          },
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "executor": {
            "type": "string",
            "enum": ["agent", "human"],
            "description": "Who performs the step: `agent` runs by itself, `human` waits for a person to complete it."
          },
          "status": {
            "type": "string",
            "enum": ["pending", "ready", "in_progress", "completed", "skipped"]
          },
          "summary": {
            "type": ["string", "null"]
          },
          "note": {
            "type": "string"
          },
          "completedAt": {
            "type": ["string", "null"]
          },
          "run": {
            "$ref": "#/components/schemas/V1AgentRunPointer"
          }
        },
        "required": ["object", "id", "title", "executor", "status", "summary", "completedAt", "run"]
      },
      "V1CompleteAgentRunTaskBody": {
        "type": "object",
        "properties": {
          "note": {
            "description": "What you did, recorded on the step and visible on the run.",
            "type": "string",
            "maxLength": 2000
          },
          "files": {
            "description": "Files produced while doing the step, by file id.",
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        },
        "additionalProperties": false
      },
      "OpenedWorkSession": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "type": "string",
                "const": "work_session"
              },
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": ["open", "working", "waiting", "done", "archived"]
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "agents": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "handle": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string"
                    }
                  },
                  "required": ["id", "handle", "name", "role"]
                }
              },
              "spaceIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "fileIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "counts": {
                "type": "object",
                "properties": {
                  "turns": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "approvalsPending": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "tasksPending": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["turns", "approvalsPending", "tasksPending"]
              },
              "apiVisible": {
                "type": "boolean"
              },
              "webhookUrl": {
                "type": "string"
              },
              "createdAt": {
                "type": "string"
              },
              "lastActivityAt": {
                "type": "string"
              },
              "closedAt": {
                "type": ["string", "null"]
              },
              "entriesUrl": {
                "type": "string"
              },
              "streamUrl": {
                "type": "string"
              },
              "artifactsUrl": {
                "type": "string"
              },
              "startedTurnIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "failedMentions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "object",
              "id",
              "status",
              "title",
              "description",
              "agents",
              "spaceIds",
              "fileIds",
              "counts",
              "apiVisible",
              "createdAt",
              "lastActivityAt",
              "closedAt",
              "entriesUrl",
              "streamUrl",
              "artifactsUrl",
              "startedTurnIds",
              "failedMentions"
            ]
          }
        },
        "required": ["data"]
      },
      "CreateWorkSessionBody": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "agents": {
            "default": [],
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "spaceIds": {
            "default": [],
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "fileIds": {
            "default": [],
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "webhookUrl": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri"
          },
          "apiVisible": {
            "default": false,
            "type": "boolean"
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": ["description"],
        "additionalProperties": false
      },
      "WorkSession": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "work_session"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["open", "working", "waiting", "done", "archived"]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "agents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "handle": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "role": {
                  "type": "string"
                }
              },
              "required": ["id", "handle", "name", "role"]
            }
          },
          "spaceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "fileIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "counts": {
            "type": "object",
            "properties": {
              "turns": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "approvalsPending": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "tasksPending": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": ["turns", "approvalsPending", "tasksPending"]
          },
          "apiVisible": {
            "type": "boolean"
          },
          "webhookUrl": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "lastActivityAt": {
            "type": "string"
          },
          "closedAt": {
            "type": ["string", "null"]
          },
          "entriesUrl": {
            "type": "string"
          },
          "streamUrl": {
            "type": "string"
          },
          "artifactsUrl": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "id",
          "status",
          "title",
          "description",
          "agents",
          "spaceIds",
          "fileIds",
          "counts",
          "apiVisible",
          "createdAt",
          "lastActivityAt",
          "closedAt",
          "entriesUrl",
          "streamUrl",
          "artifactsUrl"
        ]
      },
      "WorkSessionEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/WorkSession"
          }
        },
        "required": ["data"]
      },
      "WorkSessionSender": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": ["user", "agent", "api_key", "trigger", "external"]
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "avatarUrl": {
            "type": "string",
            "maxLength": 2048
          },
          "source": {
            "type": "string",
            "enum": [
              "web",
              "desktop",
              "api",
              "email",
              "webhook",
              "schedule",
              "slack",
              "assistant",
              "manual",
              "trigger"
            ]
          }
        },
        "required": ["kind", "id", "name"]
      },
      "WorkSessionEntry": {
        "type": "object",
        "properties": {
          "seq": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "comment",
              "system",
              "turn_started",
              "turn_finished",
              "turn_message",
              "approval",
              "task",
              "question",
              "artifact",
              "commit",
              "handoff",
              "trigger"
            ]
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "role": {
            "type": "string",
            "enum": ["user", "assistant", "system"]
          },
          "author": {
            "$ref": "#/components/schemas/WorkSessionSender"
          },
          "threadId": {
            "type": ["string", "null"]
          },
          "turnId": {
            "type": ["string", "null"]
          },
          "parts": {
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            }
          },
          "startedTurnIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "updatedSeq": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "seq",
          "id",
          "kind",
          "at",
          "role",
          "author",
          "threadId",
          "turnId",
          "parts",
          "startedTurnIds",
          "updatedSeq"
        ]
      },
      "WorkSessionEntryPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkSessionEntry"
            }
          },
          "nextAfterSeq": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["data", "nextAfterSeq"]
      },
      "SessionArtifact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "art_01J8Z…"
          },
          "sessionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "fileId": {
            "type": "string",
            "example": "file_01J8Z…"
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "example": 2
          },
          "name": {
            "type": "string",
            "example": "msa-redlined.md"
          },
          "mime": {
            "type": "string",
            "example": "text/markdown"
          },
          "state": {
            "type": "string",
            "enum": ["draft", "committed"]
          },
          "producedByTurn": {
            "type": ["string", "null"]
          },
          "committedTo": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "spaceId": {
                    "type": "string"
                  },
                  "fileId": {
                    "type": "string"
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  "by": {
                    "type": "string"
                  }
                },
                "required": ["spaceId", "fileId", "at", "by"]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "sessionId",
          "fileId",
          "version",
          "name",
          "mime",
          "state",
          "producedByTurn",
          "committedTo"
        ]
      },
      "WorkSessionArtifactPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionArtifact"
            }
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["data", "nextCursor"]
      },
      "AppendWorkSessionEntryResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "entry": {
                "$ref": "#/components/schemas/WorkSessionEntry"
              },
              "startedTurnIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "unresolvedMentions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "failedMentions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": ["entry", "startedTurnIds", "unresolvedMentions", "failedMentions"]
          }
        },
        "required": ["data"]
      },
      "AppendWorkSessionEntryBody": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          },
          "mentions": {
            "default": [],
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "fileIds": {
            "default": [],
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        },
        "required": ["text"],
        "additionalProperties": false
      },
      "DecideWorkSessionApprovalBody": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": ["approve", "reject"]
          },
          "note": {
            "type": "string",
            "maxLength": 2000
          },
          "editedParams": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "edits": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": ["decision"],
        "additionalProperties": false
      },
      "ComposeWorkSessionArtifactBody": {
        "type": "object",
        "properties": {
          "configId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "styleProfileId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        "additionalProperties": false
      },
      "PaperworkAgent": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "paperwork_agent"
          },
          "id": {
            "type": "string"
          },
          "handle": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "harness": {
            "type": "string",
            "enum": ["native", "sandbox"]
          }
        },
        "required": ["object", "id", "handle", "name", "role", "harness"]
      },
      "PaperworkAgentList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaperworkAgent"
            }
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["data", "nextCursor"]
      },
      "StartedPaperworkAgentSession": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "type": "string",
                "const": "work_session"
              },
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": ["open", "working", "waiting", "done", "archived"]
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "agents": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "handle": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string"
                    }
                  },
                  "required": ["id", "handle", "name", "role"]
                }
              },
              "spaceIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "fileIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "counts": {
                "type": "object",
                "properties": {
                  "turns": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "approvalsPending": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "tasksPending": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["turns", "approvalsPending", "tasksPending"]
              },
              "apiVisible": {
                "type": "boolean"
              },
              "webhookUrl": {
                "type": "string"
              },
              "createdAt": {
                "type": "string"
              },
              "lastActivityAt": {
                "type": "string"
              },
              "closedAt": {
                "type": ["string", "null"]
              },
              "entriesUrl": {
                "type": "string"
              },
              "streamUrl": {
                "type": "string"
              },
              "artifactsUrl": {
                "type": "string"
              },
              "startedTurnIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "failedMentions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "object",
              "id",
              "status",
              "title",
              "description",
              "agents",
              "spaceIds",
              "fileIds",
              "counts",
              "apiVisible",
              "createdAt",
              "lastActivityAt",
              "closedAt",
              "entriesUrl",
              "streamUrl",
              "artifactsUrl",
              "startedTurnIds",
              "failedMentions"
            ]
          }
        },
        "required": ["data"]
      },
      "StartPaperworkAgentSessionBody": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "fileIds": {
            "default": [],
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "spaceIds": {
            "default": [],
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "webhookUrl": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri"
          },
          "apiVisible": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": ["description"],
        "additionalProperties": false
      },
      "RealtimeTranscriptionTicket": {
        "description": "Only in the create response.",
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "realtime_transcription_ticket"
          },
          "url": {
            "type": "string",
            "description": "The `wss://` URL to open. It carries a single-use ticket that expires after 60 seconds."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": ["object", "url", "expiresAt"]
      },
      "RealtimeTranscription": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "realtime_transcription"
          },
          "id": {
            "type": "string",
            "example": "rtt_01KZ0000000000000000000000"
          },
          "status": {
            "type": "string",
            "enum": ["created", "active", "closing", "closed", "expired", "failed"]
          },
          "closeReason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "client_end",
                  "stopped",
                  "idle_timeout",
                  "max_duration",
                  "credits_exhausted",
                  "worker_unavailable",
                  "too_fast",
                  "internal_error"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "audio": {
            "type": "object",
            "properties": {
              "encoding": {
                "type": "string",
                "const": "pcm_s16le"
              },
              "sampleRate": {
                "type": "number",
                "const": 16000
              },
              "channels": {
                "type": "number",
                "const": 1
              }
            },
            "required": ["encoding", "sampleRate", "channels"]
          },
          "maxDurationSeconds": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "audioSeconds": {
            "type": "number",
            "description": "Received audio, in seconds."
          },
          "billedMinutes": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Minutes charged so far."
          },
          "finalPass": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "status": {
                "type": "string",
                "enum": [
                  "disabled",
                  "recording",
                  "uploading",
                  "processing",
                  "ready",
                  "failed",
                  "skipped"
                ]
              },
              "fileId": {
                "description": "A normal /v1 file (`GET /v1/files/{id}`).",
                "type": ["string", "null"]
              }
            },
            "required": ["enabled", "status", "fileId"]
          },
          "metadata": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "connectedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "closedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "connectBy": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Connect before this time, or the session expires. Null once a client connected."
          },
          "websocket": {
            "$ref": "#/components/schemas/RealtimeTranscriptionTicket"
          }
        },
        "required": [
          "object",
          "id",
          "status",
          "closeReason",
          "audio",
          "maxDurationSeconds",
          "audioSeconds",
          "billedMinutes",
          "finalPass",
          "metadata",
          "createdAt",
          "connectedAt",
          "closedAt",
          "connectBy"
        ]
      },
      "CreateRealtimeTranscriptionBody": {
        "type": "object",
        "properties": {
          "finalPass": {
            "default": false,
            "description": "Archive the audio as a file and run batch diarized transcription at close. Billed by the normal audio meters (minimum 1 diarized minute).",
            "type": "boolean"
          },
          "maxDurationSeconds": {
            "description": "Hard cap on received audio. Default and max 14400 (4 h); default and max 7200 with finalPass.",
            "type": "integer",
            "minimum": 60,
            "maximum": 14400
          },
          "metadata": {
            "description": "Kept 30 days after close. Do not put personal data here.",
            "type": "object",
            "propertyNames": {
              "type": "string",
              "maxLength": 64
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 512
            }
          }
        },
        "additionalProperties": false
      },
      "RealtimeTranscriptionList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RealtimeTranscription"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "cursor": {
            "description": "Present only when `has_more` is true. Treat it as opaque.",
            "type": "string"
          }
        },
        "required": ["object", "data", "has_more"]
      },
      "CreateRealtimeTranscriptionTicketBody": {
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "EmbedSession": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "embed_session"
          },
          "id": {
            "type": "string",
            "example": "ems_01K6ZQB3C4D5E6F7G8H9J0K1M2"
          },
          "view": {
            "type": "string",
            "enum": ["review", "transcript", "document"]
          },
          "mode": {
            "type": "string",
            "enum": ["read", "write"]
          },
          "url": {
            "type": "string",
            "description": "The iframe `src`. It carries the session token in its fragment: treat it as a secret."
          },
          "run": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": ["id"],
            "additionalProperties": false
          },
          "file": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": ["id"],
            "additionalProperties": false
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "expiresAt": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": ["object", "id", "view", "mode", "url", "documents", "expiresAt", "createdAt"]
      },
      "EmbedUser": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "email": {
            "type": "string",
            "maxLength": 254,
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          }
        },
        "required": ["id", "name"],
        "additionalProperties": false,
        "description": "The person who uses the embedded view, as your system knows them. It is stored as claimed and marked unverified. The email is never sent in a webhook or an audit event."
      },
      "EmbedTheme": {
        "type": "object",
        "properties": {
          "mode": {
            "default": "light",
            "type": "string",
            "enum": ["light", "dark"]
          },
          "colors": {
            "description": "Hex colors (`#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`) by theme key.",
            "type": "object",
            "propertyNames": {
              "type": "string",
              "enum": [
                "background",
                "foreground",
                "card",
                "card-foreground",
                "popover",
                "popover-foreground",
                "primary",
                "primary-foreground",
                "secondary",
                "secondary-foreground",
                "muted",
                "muted-foreground",
                "accent",
                "accent-foreground",
                "destructive",
                "border",
                "input",
                "ring"
              ]
            },
            "additionalProperties": {
              "type": "string",
              "pattern": "^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$"
            }
          },
          "radius": {
            "description": "Corner radius in `px` or `rem`, at most `32px` or `2rem`.",
            "type": "string",
            "pattern": "^\\d{1,2}(\\.\\d{1,3})?(px|rem)$"
          },
          "font": {
            "type": "string",
            "enum": ["inter", "system"]
          }
        },
        "additionalProperties": false,
        "description": "The look of the embedded view. The mode is fixed for the session."
      },
      "CreateEmbedBody": {
        "type": "object",
        "properties": {
          "view": {
            "default": "review",
            "description": "The embedded view. `review` shows the results of an extraction run. `transcript` shows an audio file with its speaker transcript. `document` shows a PDF, an office file preview or an image. `transcript` and `document` are read only.",
            "type": "string",
            "enum": ["review", "transcript", "document"]
          },
          "run": {
            "description": "The extraction run (`exr_…`) to review.",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": ["id"],
            "additionalProperties": false
          },
          "documents": {
            "description": "The file ids of the run to show, in this order. The default is every finished document of the run, in run order.",
            "minItems": 1,
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "file": {
            "description": "The file to show (`transcript` and `document` views).",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": ["id"],
            "additionalProperties": false
          },
          "space": {
            "description": "The space of `file` (`transcript` and `document` views). The default is the files of `/v1/files`.",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": ["id"],
            "additionalProperties": false
          },
          "mode": {
            "default": "read",
            "description": "`write` lets the person edit and approve the values.",
            "type": "string",
            "enum": ["read", "write"]
          },
          "origins": {
            "minItems": 1,
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 255
            },
            "description": "The exact origins of the pages that frame the view, such as `https://app.example.com`. No path, no wildcard, no trailing slash."
          },
          "user": {
            "$ref": "#/components/schemas/EmbedUser"
          },
          "webhook": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": ["url"]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["id"]
              }
            ],
            "description": "Where to deliver this run's events, given one of two ways.\n\n- `{ \"url\": \"…\" }` — a one-off https endpoint for this run only.\n- `{ \"id\": \"whe_…\" }` — a saved endpoint from `POST /v1/webhooks`. Runs hold the reference, so pausing or re-pointing that endpoint applies to this run too.\n\nDeliveries are at-least-once and signed — dedupe on `eventId` and verify against `GET /v1/webhooks/jwks.json`."
          },
          "theme": {
            "$ref": "#/components/schemas/EmbedTheme"
          },
          "locale": {
            "default": "en",
            "type": "string",
            "enum": ["en", "fr-ca"]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Arbitrary JSON you attach to the run and get back on every read of it.\n\nUse it to carry your own identifiers — an order number, a customer id — so a webhook or a polled run reconciles without a lookup table. Capped at 10 KB serialized."
          },
          "ttl": {
            "default": 3600,
            "description": "Session lifetime in seconds (60 to 28800). The session also ends when the run expires.",
            "type": "integer",
            "minimum": 60,
            "maximum": 28800
          }
        },
        "required": ["origins"],
        "additionalProperties": false
      },
      "V1Space": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "space"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "expiresAt": {
            "type": ["string", "null"]
          }
        },
        "required": ["object", "id", "name", "createdAt", "expiresAt"]
      },
      "V1CreateSpaceBody": {
        "type": "object",
        "properties": {
          "name": {
            "example": "Acme onboarding",
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "ttl": {
            "type": "integer",
            "minimum": 300,
            "maximum": 7776000,
            "description": "Seconds until the space expires, from now.",
            "example": 604800
          }
        },
        "additionalProperties": false
      },
      "V1SpaceList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/V1Space"
            }
          }
        },
        "required": ["object", "data"]
      },
      "V1UpdateSpaceBody": {
        "type": "object",
        "properties": {
          "name": {
            "description": "The new name for the space.",
            "example": "Acme onboarding",
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "ttl": {
            "type": "integer",
            "minimum": 300,
            "maximum": 7776000,
            "description": "Seconds until the space expires, from now.",
            "example": 604800
          }
        },
        "additionalProperties": false
      },
      "SearchMatch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Chunk id of the match."
          },
          "namespace": {
            "type": "string",
            "example": "space/3f1c…/file_01J…"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "score": {
            "type": "number",
            "description": "Relevance; higher is closer."
          },
          "metadata": {
            "description": "File grounding when the source was indexed with it: file id, page, bbox, and/or audio timecode.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": ["id", "namespace", "tags", "score"]
      },
      "SearchResults": {
        "type": "object",
        "properties": {
          "matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchMatch"
            },
            "description": "Ranked by relevance. No cursor."
          }
        },
        "required": ["matches"]
      },
      "OnboardingMembership": {
        "type": "object",
        "properties": {
          "organizationId": {
            "example": "org_01J…",
            "type": ["string", "null"]
          }
        },
        "required": ["organizationId"]
      },
      "OnboardingOrganization": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "example": "org_01J…"
          },
          "tenantSlug": {
            "type": "string",
            "example": "acme-corp"
          },
          "created": {
            "type": "boolean"
          }
        },
        "required": ["organizationId", "tenantSlug", "created"]
      },
      "OnboardingPendingInvitation": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "const": "pending_invitation"
          },
          "organizationId": {
            "type": "string",
            "example": "org_01J…"
          },
          "organizationName": {
            "type": "string",
            "example": "Acme Corp"
          }
        },
        "required": ["error", "organizationId", "organizationName"]
      },
      "OnboardingCreateOrganizationBody": {
        "type": "object",
        "properties": {
          "name": {
            "example": "Acme Corp",
            "description": "The organization name. Required when `workspace` is `organization` or absent. Not allowed when `workspace` is `personal`.",
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "workspace": {
            "example": "personal",
            "description": "What to create. Absent means `organization`.\n`personal`: a workspace for the caller alone. The name comes from the caller's first and last name, else from the email address (for example `Jane Doe's workspace`). The slug comes from the same text, with a short suffix when it is taken. Send no `name` and no `slug`.\n`organization`: an organization with the given `name`. The slug is `slug` when given, else it comes from the name.",
            "type": "string",
            "enum": ["personal", "organization"]
          },
          "ignorePendingInvitation": {
            "example": false,
            "type": "boolean"
          },
          "slug": {
            "example": "acme",
            "type": "string",
            "maxLength": 64
          },
          "product": {
            "example": "run",
            "type": "string",
            "enum": ["sign", "paperwork", "run"]
          }
        }
      },
      "OnboardingTenant": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "example": "org_01J…"
          },
          "tenantSlug": {
            "type": "string",
            "example": "acme-corp"
          },
          "provisioned": {
            "type": "boolean"
          }
        },
        "required": ["organizationId", "tenantSlug", "provisioned"]
      },
      "SigningApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "keyId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "teamId": {
            "type": "string"
          },
          "scopes": {
            "minItems": 1,
            "maxItems": 24,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "documents:read",
                "documents:write",
                "documents:send",
                "templates:read",
                "templates:write",
                "contacts:read",
                "contacts:write",
                "groups:read",
                "groups:write",
                "forms:read",
                "forms:write",
                "jobs:read",
                "jobs:write",
                "branding:read",
                "branding:write",
                "reports:read",
                "reports:write",
                "archive:read",
                "archive:write",
                "delegations:read",
                "delegations:write",
                "delegations:use",
                "webhooks:read",
                "webhooks:write"
              ]
            }
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "lastUsedAt": {
            "type": ["string", "null"]
          },
          "createdBy": {
            "type": "string"
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "keyId",
          "name",
          "teamId",
          "scopes",
          "expiresAt",
          "createdAt",
          "updatedAt",
          "lastUsedAt",
          "createdBy",
          "revokedAt",
          "version"
        ]
      },
      "SigningApiKeyList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SigningApiKey"
            }
          }
        },
        "required": ["items"]
      },
      "CreatedSigningApiKey": {
        "type": "object",
        "properties": {
          "key": {
            "$ref": "#/components/schemas/SigningApiKey"
          },
          "value": {
            "type": "string"
          }
        },
        "required": ["key", "value"]
      },
      "CreateSigningApiKey": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "teamId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "scopes": {
            "minItems": 1,
            "maxItems": 24,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "documents:read",
                "documents:write",
                "documents:send",
                "templates:read",
                "templates:write",
                "contacts:read",
                "contacts:write",
                "groups:read",
                "groups:write",
                "forms:read",
                "forms:write",
                "jobs:read",
                "jobs:write",
                "branding:read",
                "branding:write",
                "reports:read",
                "reports:write",
                "archive:read",
                "archive:write",
                "delegations:read",
                "delegations:write",
                "delegations:use",
                "webhooks:read",
                "webhooks:write"
              ]
            }
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["name", "teamId", "scopes"],
        "additionalProperties": false
      },
      "UpdateSigningApiKey": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "scopes": {
            "minItems": 1,
            "maxItems": 24,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "documents:read",
                "documents:write",
                "documents:send",
                "templates:read",
                "templates:write",
                "contacts:read",
                "contacts:write",
                "groups:read",
                "groups:write",
                "forms:read",
                "forms:write",
                "jobs:read",
                "jobs:write",
                "branding:read",
                "branding:write",
                "reports:read",
                "reports:write",
                "archive:read",
                "archive:write",
                "delegations:read",
                "delegations:write",
                "delegations:use",
                "webhooks:read",
                "webhooks:write"
              ]
            }
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": ["version"],
        "additionalProperties": false
      },
      "SigningApiKeyVersion": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": ["version"],
        "additionalProperties": false
      },
      "ActionManifest": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string",
            "example": "extract-structured"
          },
          "name": {
            "type": "string",
            "example": "Document Understanding"
          },
          "description": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "input": {
            "type": "object",
            "properties": {
              "sources": {
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "file"
                        },
                        "content_types": {
                          "anyOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Accepted mime types, or null for any.",
                          "example": ["application/pdf"]
                        }
                      },
                      "required": ["type", "content_types"]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "byproduct"
                        },
                        "kind": {
                          "type": "string",
                          "description": "Required parsing byproduct, e.g. `structured` or `transcript`.",
                          "example": "structured"
                        }
                      },
                      "required": ["type", "kind"]
                    }
                  ]
                }
              },
              "multiple": {
                "type": "boolean",
                "description": "Whether one run may consume several files."
              }
            },
            "required": ["sources", "multiple"]
          },
          "config": {
            "type": "object",
            "properties": {
              "install": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "JSON Schema for install-time configuration (UI hint only)."
              },
              "run": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "JSON Schema for per-run parameters (UI hint only)."
              },
              "documents": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Config keys that reference a file id, e.g. `template`."
              }
            },
            "required": ["install", "run", "documents"]
          },
          "output": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["json", "byproduct", "file"]
              },
              "kind": {
                "type": ["string", "null"]
              },
              "content_type": {
                "type": ["string", "null"]
              }
            },
            "required": ["type", "kind", "content_type"]
          },
          "timeout_seconds": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "example": 900
          },
          "execution": {
            "anyOf": [
              {
                "type": "string",
                "const": "playbook-native"
              },
              {
                "type": "null"
              }
            ],
            "description": "Non-null marks an action that only a playbook may dispatch."
          }
        },
        "required": [
          "slug",
          "name",
          "description",
          "version",
          "input",
          "config",
          "output",
          "timeout_seconds",
          "execution"
        ]
      },
      "ActionLibraryList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActionManifest"
            }
          }
        },
        "required": ["data"]
      },
      "ActionCatalogEntry": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string",
            "example": "extract-structured"
          },
          "action": {
            "type": "string",
            "description": "Catalog entry identifier."
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "shortDescription": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "theme": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "icon": {
            "type": "string",
            "enum": ["clipboard-list", "file-input", "file-search", "scale", "signature", "zap"]
          },
          "accent": {
            "type": "string",
            "enum": ["blue", "green", "neutral", "orange", "purple", "teal"]
          },
          "config": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Default configuration seeded on install."
          },
          "manifest": {
            "$ref": "#/components/schemas/ActionManifest"
          },
          "section": {
            "type": "string"
          },
          "firstParty": {
            "type": "boolean"
          }
        },
        "required": [
          "slug",
          "action",
          "title",
          "description",
          "shortDescription",
          "category",
          "theme",
          "tags",
          "icon",
          "accent",
          "config",
          "manifest",
          "section",
          "firstParty"
        ]
      },
      "ActionCatalogList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActionCatalogEntry"
            }
          }
        },
        "required": ["data"]
      },
      "InstalledAction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "act_01J…"
          },
          "slug": {
            "type": "string",
            "description": "Per-organization slug; interchangeable with `id` wherever an action is named.",
            "example": "contract-terms-extraction"
          },
          "action": {
            "type": "string",
            "description": "Catalog entry this install came from."
          },
          "name": {
            "type": "string",
            "example": "Contract terms"
          },
          "config": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991,
            "description": "The number of the saved config. It starts at 1, and each save that changes `config` adds one. Runs record the revision they used."
          },
          "created_at": {
            "type": ["string", "null"]
          },
          "updated_at": {
            "type": ["string", "null"]
          }
        },
        "required": [
          "id",
          "slug",
          "action",
          "name",
          "config",
          "revision",
          "created_at",
          "updated_at"
        ]
      },
      "InstalledActionList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InstalledAction"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": ["data", "has_more"]
      },
      "InstalledActionEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/InstalledAction"
          }
        },
        "required": ["data"]
      },
      "InstalledActionRevision": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "name": {
            "type": "string"
          },
          "config": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": ["string", "null"]
          },
          "created_by": {
            "description": "The user or API key that saved this config. Null for a config saved before revisions existed.",
            "type": ["string", "null"]
          }
        },
        "required": ["revision", "name", "config", "created_at", "created_by"]
      },
      "InstalledActionRevisionList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InstalledActionRevision"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": ["data", "has_more"]
      },
      "InstalledActionRevisionEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/InstalledActionRevision"
          }
        },
        "required": ["data"]
      },
      "UninstallActionResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              }
            },
            "required": ["id"]
          }
        },
        "required": ["data"]
      },
      "AccessCheckResults": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "permission": {
                  "type": "string",
                  "example": "space:read"
                },
                "resourceType": {
                  "type": "string",
                  "example": "space"
                },
                "resourceExternalId": {
                  "type": "string"
                },
                "authorized": {
                  "type": "boolean"
                }
              },
              "required": ["permission", "resourceType", "resourceExternalId", "authorized"]
            },
            "description": "One entry per requested check, in request order."
          }
        },
        "required": ["results"]
      },
      "AccessibleResources": {
        "type": "object",
        "properties": {
          "permission": {
            "type": "string"
          },
          "resourceType": {
            "type": "string"
          },
          "externalIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "External ids the caller holds `permission` on."
          }
        },
        "required": ["permission", "resourceType", "externalIds"]
      },
      "EffectivePermissions": {
        "type": "object",
        "properties": {
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Permission strings the caller effectively holds, role-derived and inherited.",
            "example": ["space:read", "space:contribute"]
          }
        },
        "required": ["permissions"]
      },
      "Group": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organizationId": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "example": "Legal"
          },
          "description": {
            "type": ["string", "null"]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": ["id", "organizationId", "name", "description", "createdAt", "updatedAt"]
      },
      "GroupList": {
        "type": "object",
        "properties": {
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Group"
            }
          }
        },
        "required": ["groups"]
      },
      "RoleGrant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organizationMembershipId": {
            "type": "string"
          },
          "role": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string",
                "example": "space-member"
              }
            },
            "required": ["slug"]
          },
          "resource": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "externalId": {
                "type": "string"
              },
              "resourceTypeSlug": {
                "type": "string",
                "example": "space"
              }
            },
            "required": ["id", "externalId", "resourceTypeSlug"]
          }
        },
        "required": ["id", "role", "resource"]
      },
      "ResourceGrants": {
        "type": "object",
        "properties": {
          "assignment": {
            "type": "string",
            "enum": ["direct", "indirect"]
          },
          "roleAssignments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoleGrant"
            }
          },
          "memberships": {
            "description": "The memberships behind the assignments, for rendering a share list.",
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            }
          }
        },
        "required": ["assignment"]
      },
      "SubjectGrants": {
        "type": "object",
        "properties": {
          "assignments": {
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            },
            "description": "Every grant the subject holds. Shape mirrors `RoleGrant` plus provider extras."
          }
        },
        "required": ["assignments"]
      },
      "GroupMemberList": {
        "type": "object",
        "properties": {
          "members": {
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            },
            "description": "Organization memberships in the group, as the identity provider returns them."
          }
        },
        "required": ["members"]
      },
      "ConnectionContract": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "number",
            "const": 1
          },
          "connectionType": {
            "type": "string"
          },
          "driver": {
            "type": "string",
            "enum": ["remote_mcp", "authenticated_http", "channel", "configuration"]
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["mcp_tools", "typed_operations", "authenticated_fetch", "channel_send"]
            }
          },
          "verification": {
            "type": "object",
            "properties": {
              "strategy": {
                "type": "string",
                "enum": [
                  "mcp_discovery",
                  "http_configuration",
                  "slack_auth",
                  "credential_configuration"
                ]
              },
              "live": {
                "type": "boolean"
              }
            },
            "required": ["strategy", "live"]
          },
          "permissions": {
            "type": "object",
            "properties": {
              "read": {
                "type": "boolean"
              },
              "write": {
                "type": "boolean"
              }
            },
            "required": ["read", "write"]
          },
          "provenance": {
            "type": "string",
            "enum": ["builtin", "imported"]
          }
        },
        "required": [
          "schemaVersion",
          "connectionType",
          "driver",
          "capabilities",
          "verification",
          "permissions",
          "provenance"
        ],
        "description": "What this connection can do, derived purely from its type and configuration. `permissions.write` is the whole gate: it is true only when the builder opted into writes, and it is what makes the connection appear as an approval-gated action instead of a read-only agent tool."
      },
      "Connection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "example": "slack-acme"
          },
          "scope": {
            "type": "string",
            "enum": ["space", "user"]
          },
          "spaceId": {
            "type": "string"
          },
          "ownerUserId": {
            "type": ["string", "null"]
          },
          "type": {
            "type": "string",
            "example": "remote_mcp"
          },
          "name": {
            "type": "string",
            "example": "Slack (Acme)"
          },
          "config": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Plaintext, non-secret settings. A credential is never stored here — secrets live in the encrypted secret store."
          },
          "credentialRef": {
            "description": "An opaque reference to the stored secret — never a secret value.",
            "type": ["string", "null"]
          },
          "definitionId": {
            "type": ["string", "null"]
          },
          "operationPolicy": {
            "type": "string",
            "enum": ["read_only", "all"]
          },
          "authStatus": {
            "type": "string",
            "enum": ["connected", "needs_reauth", "missing_scopes", "setup_incomplete", "unknown"]
          },
          "authErrorCode": {
            "type": ["string", "null"]
          },
          "authErrorMessage": {
            "type": ["string", "null"]
          },
          "authCheckedAt": {
            "type": ["string", "null"]
          },
          "tokenExpiresAt": {
            "type": ["string", "null"]
          },
          "verificationStatus": {
            "type": "string",
            "enum": [
              "ready",
              "configured",
              "needs_authorization",
              "misconfigured",
              "degraded",
              "unknown"
            ]
          },
          "verificationMessage": {
            "type": ["string", "null"]
          },
          "verificationCheckedAt": {
            "type": ["string", "null"]
          },
          "installedActionId": {
            "description": "The auto-provisioned `conn-<slug>` installed action, set only when the contract permits writes — that action is how a write reaches the approval gate.",
            "type": ["string", "null"]
          },
          "enabled": {
            "type": "boolean"
          },
          "createdBy": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "deletedAt": {
            "type": ["string", "null"]
          },
          "contract": {
            "$ref": "#/components/schemas/ConnectionContract"
          }
        },
        "required": [
          "id",
          "slug",
          "scope",
          "spaceId",
          "ownerUserId",
          "type",
          "name",
          "config",
          "credentialRef",
          "definitionId",
          "operationPolicy",
          "authStatus",
          "authErrorCode",
          "authErrorMessage",
          "authCheckedAt",
          "tokenExpiresAt",
          "verificationStatus",
          "verificationMessage",
          "verificationCheckedAt",
          "installedActionId",
          "enabled",
          "createdBy",
          "createdAt",
          "updatedAt",
          "deletedAt",
          "contract"
        ]
      },
      "ConnectionList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Connection"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": ["data", "has_more"]
      },
      "ConnectionEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Connection"
          }
        },
        "required": ["data"]
      },
      "ConnectionDiscovery": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "baseUrl": {
                "type": "string"
              },
              "sourceUrl": {
                "type": "string"
              },
              "domainMismatch": {
                "type": "boolean",
                "description": "True when the spec’s own base host differs from the host the user typed — the UI must ask for explicit confirmation before importing (P5-D11)."
              },
              "typedHost": {
                "type": "string"
              },
              "operations": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "method": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string"
                    },
                    "access": {
                      "type": "string",
                      "enum": ["read", "write"]
                    }
                  },
                  "required": ["id", "name", "description", "method", "path", "access"]
                }
              }
            },
            "required": ["baseUrl", "sourceUrl", "domainMismatch", "typedHost", "operations"]
          }
        },
        "required": ["data"]
      },
      "DeletedConnection": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "deleted": {
                "type": "boolean",
                "const": true
              }
            },
            "required": ["id", "deleted"]
          }
        },
        "required": ["data"]
      },
      "ConnectionMethodList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "example": {
                  "type": "string"
                },
                "access": {
                  "type": "string",
                  "enum": ["read", "write"]
                },
                "sideEffect": {
                  "type": "boolean"
                },
                "externalDelivery": {
                  "type": "boolean"
                },
                "inputSchema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "outputSchema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              },
              "required": [
                "name",
                "description",
                "example",
                "access",
                "sideEffect",
                "externalDelivery",
                "inputSchema"
              ]
            }
          }
        },
        "required": ["data"]
      },
      "ConnectionVerification": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "verificationStatus": {
                "type": "string",
                "enum": [
                  "ready",
                  "configured",
                  "needs_authorization",
                  "misconfigured",
                  "degraded",
                  "unknown"
                ]
              },
              "verificationMessage": {
                "type": ["string", "null"]
              },
              "verificationCheckedAt": {
                "type": ["string", "null"]
              },
              "authStatus": {
                "type": "string",
                "enum": [
                  "connected",
                  "needs_reauth",
                  "missing_scopes",
                  "setup_incomplete",
                  "unknown"
                ]
              }
            },
            "required": [
              "verificationStatus",
              "verificationMessage",
              "verificationCheckedAt",
              "authStatus"
            ]
          }
        },
        "required": ["data"]
      },
      "ConnectionCredentialRef": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "credentialRef": {
                "type": "string"
              },
              "purpose": {
                "type": "string"
              }
            },
            "required": ["credentialRef", "purpose"]
          }
        },
        "required": ["data"]
      },
      "DeveloperObservation": {
        "type": "object",
        "properties": {
          "eventId": {
            "type": "string"
          },
          "traceId": {
            "type": "string"
          },
          "spanId": {
            "type": "string"
          },
          "parentSpanId": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          },
          "org": {
            "type": "string"
          },
          "tenant": {
            "type": "string"
          },
          "capability": {
            "type": "string",
            "enum": [
              "extract",
              "parse",
              "redact",
              "fill",
              "sign",
              "pipeline",
              "files",
              "actions",
              "agent",
              "runs",
              "templates",
              "webhooks"
            ]
          },
          "kind": {
            "type": "string",
            "enum": ["request", "network", "queue", "inference", "action", "storage"]
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["running", "ok", "error", "cancelled", "expired"]
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "durationMs": {
            "type": "number"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "method": {
            "type": "string",
            "enum": ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]
          },
          "route": {
            "type": "string"
          },
          "statusCode": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "model": {
            "type": "string"
          },
          "inputTokens": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "outputTokens": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "bytes": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "errorCode": {
            "type": "string"
          }
        },
        "required": ["eventId", "traceId", "spanId", "org", "kind", "name", "status", "startedAt"]
      },
      "DeveloperObservationList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeveloperObservation"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["data", "nextCursor"]
      },
      "DeveloperObservationDetail": {
        "type": "object",
        "properties": {
          "traceId": {
            "type": "string"
          },
          "observations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeveloperObservation"
            }
          },
          "source": {
            "type": "object",
            "properties": {
              "pipeline": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string"
                      },
                      "expiresAt": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "keptSpaceId": {
                        "type": ["string", "null"]
                      },
                      "files": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string"
                            },
                            "processingKind": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": ["id", "status", "processingKind"]
                        }
                      },
                      "actions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "runId": {
                              "type": ["string", "null"]
                            },
                            "installedActionId": {
                              "type": "string"
                            },
                            "stepId": {
                              "type": ["string", "null"]
                            },
                            "status": {
                              "type": "string"
                            }
                          },
                          "required": ["runId", "installedActionId", "stepId", "status"]
                        }
                      }
                    },
                    "required": ["id", "status", "expiresAt", "keptSpaceId", "files", "actions"]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "playbookRuns": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "spaceId": {
                      "type": "string"
                    },
                    "playbookId": {
                      "type": "string"
                    },
                    "playbookVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "status": {
                      "type": "string"
                    },
                    "taskProgress": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "completed": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": ["total", "completed"]
                    },
                    "pendingCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "outcome": {
                      "type": ["string", "null"]
                    },
                    "parentRunId": {
                      "type": ["string", "null"]
                    },
                    "rootRunId": {
                      "type": ["string", "null"]
                    },
                    "depth": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "modelSteps": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "finishedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "spaceId",
                    "playbookId",
                    "playbookVersion",
                    "status",
                    "taskProgress",
                    "pendingCount",
                    "outcome",
                    "parentRunId",
                    "rootRunId",
                    "depth",
                    "modelSteps",
                    "createdAt",
                    "updatedAt",
                    "finishedAt"
                  ]
                }
              },
              "actionRuns": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "spaceId": {
                      "type": "string"
                    },
                    "actionSlug": {
                      "type": "string"
                    },
                    "actionVersion": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "installedActionId": {
                      "type": "string"
                    },
                    "playbookRunId": {
                      "type": ["string", "null"]
                    },
                    "status": {
                      "type": "string"
                    },
                    "documentCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "outputCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "awaitingInputCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "timeoutSeconds": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "lastEventAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "finishedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "spaceId",
                    "actionSlug",
                    "actionVersion",
                    "installedActionId",
                    "playbookRunId",
                    "status",
                    "documentCount",
                    "outputCount",
                    "awaitingInputCount",
                    "timeoutSeconds",
                    "lastEventAt",
                    "createdAt",
                    "finishedAt"
                  ]
                }
              },
              "files": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "parentType": {
                      "type": "string"
                    },
                    "parentId": {
                      "type": "string"
                    },
                    "mimeType": {
                      "type": "string"
                    },
                    "size": {
                      "type": ["number", "null"]
                    },
                    "status": {
                      "type": "string"
                    },
                    "processingKind": {
                      "type": ["string", "null"]
                    },
                    "parentFileId": {
                      "type": ["string", "null"]
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "storedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "processedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "parentType",
                    "parentId",
                    "mimeType",
                    "size",
                    "status",
                    "processingKind",
                    "parentFileId",
                    "createdAt",
                    "storedAt",
                    "processedAt"
                  ]
                }
              },
              "issues": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": ["pipeline", "playbook_run", "action_run", "files"]
                    },
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": ["missing", "unavailable"]
                    }
                  },
                  "required": ["kind", "id", "status"]
                }
              }
            },
            "required": ["pipeline", "playbookRuns", "actionRuns", "files", "issues"]
          }
        },
        "required": ["traceId", "observations", "source"]
      },
      "ErrorEnvelope": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "The sentence a human reads."
          },
          "error_code": {
            "type": "string",
            "description": "The stable snake_case branch key."
          },
          "issues": {
            "description": "Per-field detail, present only on a validation failure.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": ["path", "code", "message"]
            }
          }
        },
        "required": ["error", "error_code"]
      },
      "AssistantConversation": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "owner": {
                "type": "object",
                "properties": {
                  "organizationId": {
                    "type": "string"
                  },
                  "userId": {
                    "type": "string"
                  },
                  "name": {
                    "type": ["string", "null"]
                  },
                  "email": {
                    "type": ["string", "null"]
                  },
                  "timeZone": {
                    "type": "string"
                  }
                },
                "required": ["organizationId", "userId", "name", "email", "timeZone"]
              },
              "assistant": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "appearance": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "emoji": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": ["🌿", "🦉", "🦊", "🐙", "☁️", "✦"],
                                "x-fern-enum": {
                                  "🌿": {
                                    "name": "Herb"
                                  },
                                  "🦉": {
                                    "name": "Owl"
                                  },
                                  "🦊": {
                                    "name": "Fox"
                                  },
                                  "🐙": {
                                    "name": "Octopus"
                                  },
                                  "☁️": {
                                    "name": "Cloud"
                                  },
                                  "✦": {
                                    "name": "Star"
                                  }
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "accent": {
                            "type": "string",
                            "enum": ["sage", "sand", "sky", "rose", "lilac"]
                          }
                        },
                        "required": ["emoji", "accent"],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["name", "appearance"]
              },
              "active": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "runId": {
                        "type": "string"
                      },
                      "entryId": {
                        "type": "string"
                      },
                      "startedAt": {
                        "type": "string",
                        "example": "2026-10-08T09:00:00-04:00"
                      }
                    },
                    "required": ["runId", "entryId", "startedAt"]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "queued": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "error": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "message": {
                        "type": "string"
                      },
                      "entryId": {
                        "type": "string"
                      },
                      "at": {
                        "type": "string",
                        "example": "2026-10-08T09:00:00-04:00"
                      }
                    },
                    "required": ["code", "message", "at"]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "policyVersion": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "cloudraker": {
                        "type": "string"
                      },
                      "company": {
                        "type": ["string", "null"]
                      }
                    },
                    "required": ["cloudraker", "company"]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "home": {
                "type": "object",
                "properties": {
                  "lastDreamAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "example": "2026-10-08T09:00:00-04:00"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "nextDreamAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "example": "2026-10-08T09:00:00-04:00"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": ["never", "running", "ready", "stale", "failed"]
                  }
                },
                "required": ["lastDreamAt", "nextDreamAt", "status"]
              }
            },
            "required": ["owner", "assistant", "active", "queued", "error", "policyVersion", "home"]
          }
        },
        "required": ["data"]
      },
      "AssistantEntry": {
        "type": "object",
        "properties": {
          "seq": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "id": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": ["user", "assistant"]
          },
          "text": {
            "type": "string"
          },
          "replyTo": {
            "type": "string"
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "running": {
                  "type": "string"
                },
                "done": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": ["read", "code"]
                },
                "status": {
                  "type": "string",
                  "enum": ["running", "done", "error"]
                }
              },
              "required": ["id", "running", "done", "kind", "status"]
            }
          },
          "createdAt": {
            "type": "string",
            "example": "2026-10-08T09:00:00-04:00"
          }
        },
        "required": ["seq", "id", "role", "text", "createdAt"]
      },
      "AssistantHome": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "snapshot": {
                "anyOf": [
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The last published briefing (version 1), or null."
              },
              "freshness": {
                "type": "object",
                "properties": {
                  "lastDreamAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "example": "2026-10-08T09:00:00-04:00"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "nextDreamAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "example": "2026-10-08T09:00:00-04:00"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": ["never", "running", "ready", "stale", "failed"]
                  }
                },
                "required": ["lastDreamAt", "nextDreamAt", "status"]
              }
            },
            "required": ["snapshot", "freshness"]
          }
        },
        "required": ["data"]
      },
      "AssistantRoutine": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "tier": {
            "type": "string",
            "enum": ["cloudraker", "company", "user"]
          },
          "name": {
            "type": "string"
          },
          "schedule": {
            "type": "string"
          },
          "instruction": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "markdown": {
            "type": "string"
          },
          "nextRunAt": {
            "anyOf": [
              {
                "type": "string",
                "example": "2026-10-08T09:00:00-04:00"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastRunAt": {
            "anyOf": [
              {
                "type": "string",
                "example": "2026-10-08T09:00:00-04:00"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastOutcome": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "queued",
                  "running",
                  "completed",
                  "failed",
                  "refused",
                  "conflict",
                  "disabled"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "tier",
          "name",
          "schedule",
          "instruction",
          "enabled",
          "markdown",
          "nextRunAt",
          "lastRunAt",
          "lastOutcome"
        ]
      },
      "AssistantReceipt": {
        "type": "object",
        "properties": {
          "attemptId": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "running",
              "succeeded",
              "failed",
              "cancelled",
              "unknown_effect",
              "interrupted",
              "superseded"
            ]
          },
          "startedAt": {
            "type": "string",
            "example": "2026-10-08T09:00:00-04:00"
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string",
                "example": "2026-10-08T09:00:00-04:00"
              },
              {
                "type": "null"
              }
            ]
          },
          "outcome": {
            "type": "string",
            "enum": ["unverified", "verified", "failed", "unknown"]
          },
          "outcomeDetail": {
            "type": ["string", "null"]
          },
          "result": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "fileId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": ["fileId", "name"]
              },
              {
                "type": "null"
              }
            ],
            "description": "The saved file, only once it is stored."
          },
          "delivery": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": ["none", "pending", "delivered", "suppressed", "failed"]
              },
              "at": {
                "anyOf": [
                  {
                    "type": "string",
                    "example": "2026-10-08T09:00:00-04:00"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "entryId": {
                "type": ["string", "null"]
              },
              "reason": {
                "type": ["string", "null"]
              }
            },
            "required": ["state", "at", "entryId", "reason"]
          }
        },
        "required": [
          "attemptId",
          "state",
          "startedAt",
          "finishedAt",
          "outcome",
          "outcomeDetail",
          "result",
          "delivery"
        ]
      },
      "AssistantCommitment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^cmt_[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "outcome": {
            "type": "string"
          },
          "completion": {
            "type": "string"
          },
          "nextAction": {
            "type": "string"
          },
          "schedule": {
            "type": ["string", "null"]
          },
          "state": {
            "type": "string",
            "enum": ["active", "waiting", "blocked", "completed", "cancelled", "failed"]
          },
          "origin": {
            "type": "string",
            "enum": ["chat", "routine", "owner"]
          },
          "background": {
            "type": "boolean"
          },
          "originEntryId": {
            "type": ["string", "null"]
          },
          "nextWakeAt": {
            "anyOf": [
              {
                "type": "string",
                "example": "2026-10-08T09:00:00-04:00"
              },
              {
                "type": "null"
              }
            ]
          },
          "waitingFor": {
            "type": ["string", "null"]
          },
          "blocker": {
            "type": ["string", "null"]
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Send it back with an edit."
          },
          "running": {
            "type": "boolean"
          },
          "updatedAt": {
            "type": "string",
            "example": "2026-10-08T09:00:00-04:00"
          },
          "attempts": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "succeeded": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "failed": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": ["total", "succeeded", "failed"]
          },
          "receipts": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantReceipt"
            }
          }
        },
        "required": [
          "id",
          "outcome",
          "completion",
          "nextAction",
          "schedule",
          "state",
          "origin",
          "background",
          "originEntryId",
          "nextWakeAt",
          "waitingFor",
          "blocker",
          "version",
          "running",
          "updatedAt",
          "attempts",
          "receipts"
        ]
      },
      "AssistantDelivery": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "quietHours": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "start": {
                        "type": "string"
                      },
                      "end": {
                        "type": "string"
                      }
                    },
                    "required": ["start", "end"]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "paused": {
                "type": "boolean"
              },
              "recent": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "lane": {
                      "type": "string",
                      "enum": ["obligation", "suggestion"]
                    },
                    "state": {
                      "type": "string",
                      "enum": ["pending", "delivered", "suppressed"]
                    },
                    "reason": {
                      "type": ["string", "null"]
                    },
                    "issueKey": {
                      "type": ["string", "null"]
                    },
                    "notBefore": {
                      "anyOf": [
                        {
                          "type": "string",
                          "example": "2026-10-08T09:00:00-04:00"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "entryId": {
                      "type": ["string", "null"]
                    },
                    "at": {
                      "type": "string",
                      "example": "2026-10-08T09:00:00-04:00"
                    }
                  },
                  "required": [
                    "id",
                    "lane",
                    "state",
                    "reason",
                    "issueKey",
                    "notBefore",
                    "entryId",
                    "at"
                  ]
                }
              }
            },
            "required": ["quietHours", "paused", "recent"]
          }
        },
        "required": ["data"]
      },
      "AssistantLearnedSkill": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "activeVersion": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "versions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "version": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "evaluating",
                    "rejected",
                    "proposed",
                    "active",
                    "superseded",
                    "rolled_back"
                  ]
                },
                "reason": {
                  "type": ["string", "null"]
                },
                "content": {
                  "type": "string"
                },
                "tools": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "cases": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "heldOut": {
                        "type": "boolean"
                      },
                      "result": {
                        "type": "string"
                      }
                    },
                    "required": ["heldOut", "result"]
                  }
                },
                "updatedAt": {
                  "type": "string",
                  "example": "2026-10-08T09:00:00-04:00"
                }
              },
              "required": ["version", "state", "reason", "content", "tools", "cases", "updatedAt"]
            }
          }
        },
        "required": ["slug", "summary", "activeVersion", "versions"]
      },
      "AssistantLearning": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "skills": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AssistantLearnedSkill"
                }
              },
              "recent": {
                "maxItems": 30,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "at": {
                      "type": "string",
                      "example": "2026-10-08T09:00:00-04:00"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "state": {
                      "type": "string"
                    },
                    "reason": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["at", "slug", "version", "state", "reason"]
                }
              }
            },
            "required": ["skills", "recent"]
          }
        },
        "required": ["data"]
      },
      "AssistantProfile": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "nameOverride": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ]
          },
          "organizationName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ]
          },
          "appearance": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "emoji": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": ["🌿", "🦉", "🦊", "🐙", "☁️", "✦"],
                        "x-fern-enum": {
                          "🌿": {
                            "name": "Herb"
                          },
                          "🦉": {
                            "name": "Owl"
                          },
                          "🦊": {
                            "name": "Fox"
                          },
                          "🐙": {
                            "name": "Octopus"
                          },
                          "☁️": {
                            "name": "Cloud"
                          },
                          "✦": {
                            "name": "Star"
                          }
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "accent": {
                    "type": "string",
                    "enum": ["sage", "sand", "sky", "rose", "lilac"]
                  }
                },
                "required": ["emoji", "accent"],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "timeZone": {
            "description": "The owner’s IANA time zone, or null until the browser sets it once.",
            "type": ["string", "null"]
          }
        },
        "required": ["name", "nameOverride", "organizationName", "appearance", "timeZone"],
        "additionalProperties": false
      },
      "Me": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "example": "user_01ABC…"
          },
          "organizationId": {
            "type": "string",
            "example": "org_01XYZ…"
          },
          "tenantSlug": {
            "type": "string",
            "example": "acme"
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": ["admin"]
          },
          "name": {
            "example": "Ada Lovelace",
            "type": "string"
          },
          "avatarUrl": {
            "example": "https://…/ada.png",
            "type": "string"
          }
        },
        "required": ["userId", "organizationId", "tenantSlug", "roles"]
      },
      "UserPreferences": {
        "type": "object",
        "properties": {
          "language": {
            "anyOf": [
              {
                "type": "string",
                "enum": ["en", "fr-ca"]
              },
              {
                "type": "null"
              }
            ],
            "description": "The user's chosen language, or null if never set.",
            "example": "en"
          },
          "developer": {
            "type": "boolean",
            "description": "Whether developer mode is enabled. Defaults to false.",
            "example": false
          },
          "notifications": {
            "type": "object",
            "properties": {
              "approvalRequested": {
                "type": "boolean",
                "description": "Email when something needs the user to approve or review it. Defaults to true."
              },
              "humanTask": {
                "type": "boolean",
                "description": "Email when a task is ready for (or assigned to) the user. Defaults to true."
              },
              "runState": {
                "type": "boolean",
                "description": "Email when something the user started pauses or fails. Defaults to true."
              },
              "signingProgress": {
                "type": "boolean",
                "description": "Email when a recipient signs or declines a document the user sent, or when it completes. Defaults to true."
              }
            },
            "required": ["approvalRequested", "humanTask", "runState", "signingProgress"],
            "description": "Notification preferences, always fully populated (missing keys read true)."
          },
          "files": {
            "type": "object",
            "properties": {
              "sortKey": {
                "type": "string",
                "enum": ["createdAt", "kind", "name", "size", "updatedAt"],
                "description": "Field the file list is ordered by. Defaults to name.",
                "example": "name"
              },
              "sortDirection": {
                "type": "string",
                "enum": ["asc", "desc"],
                "description": "Direction of that ordering. Defaults to asc.",
                "example": "asc"
              }
            },
            "required": ["sortKey", "sortDirection"],
            "description": "File list sort preferences, always fully populated (missing keys read their default)."
          }
        },
        "required": ["language", "developer", "notifications", "files"]
      },
      "UpdateUserPreferences": {
        "type": "object",
        "properties": {
          "language": {
            "type": "string",
            "enum": ["en", "fr-ca"]
          },
          "developer": {
            "type": "boolean"
          },
          "notifications": {
            "type": "object",
            "properties": {
              "approvalRequested": {
                "type": "boolean",
                "description": "Email when something needs the user to approve or review it. Defaults to true."
              },
              "humanTask": {
                "type": "boolean",
                "description": "Email when a task is ready for (or assigned to) the user. Defaults to true."
              },
              "runState": {
                "type": "boolean",
                "description": "Email when something the user started pauses or fails. Defaults to true."
              },
              "signingProgress": {
                "type": "boolean",
                "description": "Email when a recipient signs or declines a document the user sent, or when it completes. Defaults to true."
              }
            },
            "additionalProperties": false
          },
          "files": {
            "type": "object",
            "properties": {
              "sortKey": {
                "type": "string",
                "enum": ["createdAt", "kind", "name", "size", "updatedAt"],
                "description": "Field the file list is ordered by. Defaults to name.",
                "example": "name"
              },
              "sortDirection": {
                "type": "string",
                "enum": ["asc", "desc"],
                "description": "Direction of that ordering. Defaults to asc.",
                "example": "asc"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "Desk": {
        "type": "object",
        "properties": {
          "spaceId": {
            "type": "string"
          }
        },
        "required": ["spaceId"]
      },
      "WorkItem": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "approval",
              "human_task",
              "parked",
              "run_attention",
              "connector",
              "question",
              "mention"
            ]
          },
          "runId": {
            "type": ["string", "null"]
          },
          "sessionId": {
            "type": ["string", "null"]
          },
          "sessionTurnId": {
            "type": ["string", "null"]
          },
          "spaceId": {
            "type": "string"
          },
          "playbookName": {
            "type": ["string", "null"]
          },
          "itemId": {
            "type": "string"
          },
          "refId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "approvalKind": {
            "anyOf": [
              {
                "type": "string",
                "enum": ["pre", "post"]
              },
              {
                "type": "null"
              }
            ]
          },
          "assignee": {
            "type": ["string", "null"]
          },
          "status": {
            "type": "string",
            "enum": ["open", "read", "done"]
          },
          "taskStatus": {
            "type": ["string", "null"]
          },
          "runStatus": {
            "type": ["string", "null"]
          },
          "requestedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "attention": {
            "anyOf": [
              {
                "type": "string",
                "enum": ["waiting", "failed"]
              },
              {
                "type": "null"
              }
            ]
          },
          "unattended": {
            "type": ["boolean", "null"]
          },
          "origin": {
            "anyOf": [
              {
                "type": "string",
                "enum": ["automation", "channel", "api"]
              },
              {
                "type": "null"
              }
            ]
          },
          "originId": {
            "type": ["string", "null"]
          },
          "reauthUrl": {
            "type": ["string", "null"]
          },
          "brokenCode": {
            "type": ["string", "null"]
          }
        },
        "required": [
          "kind",
          "runId",
          "sessionId",
          "sessionTurnId",
          "spaceId",
          "playbookName",
          "itemId",
          "refId",
          "title",
          "approvalKind",
          "assignee",
          "status",
          "taskStatus",
          "runStatus",
          "requestedAt",
          "attention",
          "unattended",
          "origin",
          "originId",
          "reauthUrl",
          "brokenCode"
        ]
      },
      "MyWork": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "runId": {
                  "type": ["string", "null"]
                },
                "sessionId": {
                  "type": ["string", "null"]
                },
                "spaceId": {
                  "type": ["string", "null"]
                },
                "playbookName": {
                  "type": ["string", "null"]
                },
                "runCreatedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "asOf": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "items": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WorkItem"
                  }
                }
              },
              "required": ["runId", "spaceId", "playbookName", "runCreatedAt", "asOf", "items"]
            }
          },
          "totalCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "unreadCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "nextCursor": {
            "type": ["string", "null"]
          },
          "asOf": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": ["data", "totalCount", "nextCursor", "asOf"]
      },
      "ThreadRunResult": {
        "type": "object",
        "properties": {
          "threadId": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "steered": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          }
        },
        "required": ["threadId", "runId", "steered", "status", "spaceId"]
      },
      "CreateThreadBody": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000,
            "description": "The request that founds the thread (frozen into the first run’s snapshot)."
          },
          "playbookId": {
            "description": "The agent the thread talks to. Omit for the default agent. Every run in the thread (including rollover successors) executes this agent.",
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "fileIds": {
            "description": "Files to attach to the first run. Omit for a prompt-only start.",
            "minItems": 1,
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "spaceId": {
            "description": "Start the thread in this space instead of the caller’s private desk — everyone who holds `space:contribute` on it can then read and continue the thread. Requires `space:contribute` (404 otherwise). A desk id (`me:…`) is never a valid target (400 `cannot_target_desk`).",
            "example": "9f2c1c3e-…",
            "type": "string",
            "minLength": 1
          }
        },
        "required": ["prompt"],
        "additionalProperties": false
      },
      "SendMessageBody": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          }
        },
        "required": ["message"],
        "additionalProperties": false
      },
      "SharedThreadResult": {
        "type": "object",
        "properties": {
          "threadId": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "steered": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          },
          "sharedFromThreadId": {
            "type": "string",
            "description": "The thread this one continues."
          }
        },
        "required": ["threadId", "runId", "steered", "status", "spaceId", "sharedFromThreadId"]
      },
      "ShareThreadBody": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "spaceId": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": ["spaceId"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "spaceTypeId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": ["spaceTypeId", "title"],
            "additionalProperties": false
          }
        ]
      },
      "AgentRunSummary": {
        "type": "object",
        "properties": {
          "runId": {
            "type": "string"
          },
          "sessionId": {
            "type": ["string", "null"]
          },
          "sessionTurnId": {
            "type": ["string", "null"]
          },
          "spaceId": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "threadId": {
            "type": ["string", "null"]
          },
          "threadTitle": {
            "type": ["string", "null"]
          },
          "playbookName": {
            "type": ["string", "null"]
          },
          "taskProgress": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "total": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "completed": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["total", "completed"]
              },
              {
                "type": "null"
              }
            ],
            "description": "Task progress on the run (null on legacy rows)."
          },
          "createdAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "updatedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "startedBy": {
            "type": ["string", "null"]
          },
          "spaceTitle": {
            "type": ["string", "null"]
          },
          "channelKind": {
            "type": ["string", "null"]
          },
          "threadStatus": {
            "type": "string",
            "enum": ["idle", "running", "unread"]
          },
          "unread": {
            "type": "boolean"
          }
        },
        "required": [
          "runId",
          "sessionId",
          "sessionTurnId",
          "spaceId",
          "status",
          "threadId",
          "threadTitle",
          "playbookName",
          "taskProgress",
          "createdAt",
          "updatedAt",
          "startedBy",
          "spaceTitle",
          "channelKind",
          "threadStatus",
          "unread"
        ]
      },
      "AgentRuns": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentRunSummary"
            }
          },
          "totalCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "unreadCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "nextCursor": {
            "type": ["string", "null"]
          },
          "asOf": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": ["data", "totalCount", "nextCursor", "asOf"]
      },
      "Home": {
        "type": "object",
        "properties": {
          "summary": {
            "type": "object",
            "properties": {
              "pendingApprovals": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "runsInProgress": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "doneToday": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": ["pendingApprovals", "runsInProgress", "doneToday"]
          },
          "pendingApprovals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "spaceId": {
                  "type": "string"
                },
                "sessionId": {
                  "type": ["string", "null"]
                },
                "title": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": ["open", "read", "done"]
                },
                "createdAt": {
                  "type": "string"
                },
                "unread": {
                  "type": "boolean"
                }
              },
              "required": ["id", "spaceId", "sessionId", "title", "status", "createdAt", "unread"]
            }
          },
          "activity": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "spaceId": {
                  "type": ["string", "null"]
                },
                "actor": {
                  "type": "object",
                  "properties": {
                    "userId": {
                      "type": "string"
                    }
                  }
                },
                "resource": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  }
                },
                "status": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string"
                }
              },
              "required": ["id", "type", "spaceId", "actor", "createdAt"]
            }
          },
          "recentSpaces": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "spaceType": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string"
                }
              },
              "required": ["id", "title", "spaceType", "updatedAt"]
            }
          }
        },
        "required": ["summary", "pendingApprovals", "activity", "recentSpaces"]
      },
      "Automation": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": ["agent_task"]
          },
          "enabled": {
            "type": "boolean"
          },
          "playbookId": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "fileIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "spaceId": {
            "type": "string"
          },
          "threadId": {
            "type": "string"
          },
          "threadPolicy": {
            "type": "string",
            "enum": ["reuse", "new"]
          },
          "runAs": {
            "type": "string"
          },
          "createdBy": {
            "type": "string"
          },
          "organizationId": {
            "type": "string"
          },
          "schedule": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "cron"
                  },
                  "expression": {
                    "type": "string",
                    "example": "0 9 * * 1-5"
                  },
                  "timezone": {
                    "type": "string",
                    "example": "Europe/Paris"
                  }
                },
                "required": ["kind", "expression", "timezone"]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "once"
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "example": "2026-08-14T15:00:00.000Z"
                  }
                },
                "required": ["kind", "at"]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "manual"
                  }
                },
                "required": ["kind"]
              }
            ]
          },
          "nextRunAt": {
            "type": ["string", "null"]
          },
          "lastFiredAt": {
            "type": "string"
          },
          "lastRunStatus": {
            "type": "string",
            "enum": ["started", "success", "busy", "needs_input", "blocked", "error"]
          },
          "lastRunId": {
            "type": "string"
          },
          "trigger": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "secretPreview": {
                "type": "string",
                "example": "whsec_…9f3a"
              },
              "secretRotatedAt": {
                "type": "string"
              }
            },
            "required": ["enabled", "secretPreview"],
            "additionalProperties": false
          },
          "originThreadId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "runtimeStatus": {
            "type": "string",
            "enum": ["idle", "disabled", "needs_input", "blocked", "error"]
          },
          "cadence": {
            "type": "string"
          },
          "triggerRef": {
            "type": "string"
          }
        },
        "required": [
          "_id",
          "name",
          "kind",
          "enabled",
          "playbookId",
          "prompt",
          "spaceId",
          "threadPolicy",
          "runAs",
          "createdBy",
          "organizationId",
          "schedule",
          "nextRunAt",
          "trigger",
          "createdAt",
          "updatedAt",
          "runtimeStatus",
          "cadence",
          "triggerRef"
        ],
        "additionalProperties": false
      },
      "AutomationRun": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string"
          },
          "automationId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": ["agent_task"]
          },
          "trigger": {
            "type": "string",
            "enum": ["schedule", "webhook", "manual"]
          },
          "status": {
            "type": "string",
            "enum": ["started", "success", "busy", "needs_input", "blocked", "error"]
          },
          "scheduledFor": {
            "type": "string"
          },
          "startedAt": {
            "type": "string"
          },
          "completedAt": {
            "type": ["string", "null"]
          },
          "threadId": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "message": {
            "type": ["string", "null"]
          }
        },
        "required": ["_id", "automationId", "kind", "trigger", "status", "startedAt"],
        "additionalProperties": false
      },
      "CreateAutomationBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "example": "Monday inbox sweep"
          },
          "description": {
            "type": "string",
            "maxLength": 400
          },
          "playbookId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000,
            "description": "The user message injected into the thread when the automation fires."
          },
          "fileIds": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "spaceId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "threadPolicy": {
            "default": "reuse",
            "type": "string",
            "enum": ["reuse", "new"]
          },
          "schedule": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "cron"
                  },
                  "expression": {
                    "type": "string",
                    "example": "0 9 * * 1-5"
                  },
                  "timezone": {
                    "type": "string",
                    "example": "Europe/Paris"
                  }
                },
                "required": ["kind", "expression", "timezone"]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "once"
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "example": "2026-08-14T15:00:00.000Z"
                  }
                },
                "required": ["kind", "at"]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "manual"
                  }
                },
                "required": ["kind"]
              }
            ]
          },
          "enabled": {
            "default": true,
            "type": "boolean"
          },
          "triggerEnabled": {
            "default": false,
            "type": "boolean"
          },
          "originThreadId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        "required": ["name", "prompt", "schedule"]
      },
      "UpdateAutomationBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "example": "Monday inbox sweep"
          },
          "description": {
            "type": "string",
            "maxLength": 400
          },
          "playbookId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000,
            "description": "The user message injected into the thread when the automation fires."
          },
          "fileIds": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "spaceId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "threadPolicy": {
            "type": "string",
            "enum": ["reuse", "new"]
          },
          "schedule": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "cron"
                  },
                  "expression": {
                    "type": "string",
                    "example": "0 9 * * 1-5"
                  },
                  "timezone": {
                    "type": "string",
                    "example": "Europe/Paris"
                  }
                },
                "required": ["kind", "expression", "timezone"]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "once"
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                    "example": "2026-08-14T15:00:00.000Z"
                  }
                },
                "required": ["kind", "at"]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "manual"
                  }
                },
                "required": ["kind"]
              }
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "triggerEnabled": {
            "type": "boolean"
          },
          "threadId": {
            "type": "null"
          }
        }
      },
      "Organization": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "org_01H…"
          },
          "name": {
            "type": "string",
            "example": "Acme Inc"
          },
          "assistantName": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ]
          },
          "slug": {
            "description": "Tenant key. Immutable — `PATCH /organization` only renames.",
            "example": "acme",
            "type": ["string", "null"]
          },
          "domains": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": ["acme.com"]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": ["id", "name", "assistantName", "slug", "domains", "createdAt", "updatedAt"]
      },
      "OrganizationEnvelope": {
        "type": "object",
        "properties": {
          "organization": {
            "$ref": "#/components/schemas/Organization"
          }
        },
        "required": ["organization"]
      },
      "OrganizationUser": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "user_01H…"
          },
          "organizationMembershipId": {
            "type": ["string", "null"]
          },
          "invitationId": {
            "type": ["string", "null"]
          },
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "firstName": {
            "type": ["string", "null"]
          },
          "lastName": {
            "type": ["string", "null"]
          },
          "profilePictureUrl": {
            "type": ["string", "null"]
          },
          "role": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string"
                  }
                },
                "required": ["slug"]
              },
              {
                "type": "null"
              }
            ]
          },
          "isOwner": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": ["active", "inactive", "invited"]
          },
          "lastSignInAt": {
            "type": ["string", "null"]
          },
          "directoryManaged": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "organizationMembershipId",
          "invitationId",
          "email",
          "firstName",
          "lastName",
          "profilePictureUrl",
          "role",
          "isOwner",
          "status",
          "lastSignInAt",
          "directoryManaged"
        ]
      },
      "OrganizationUserList": {
        "type": "object",
        "properties": {
          "users": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrganizationUser"
            }
          }
        },
        "required": ["users"]
      },
      "InvitationResponse": {
        "type": "object",
        "properties": {
          "invitation": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "email": {
                "type": "string",
                "format": "email",
                "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
              },
              "expiresAt": {
                "type": "string"
              }
            },
            "required": ["id", "email", "expiresAt"]
          }
        },
        "required": ["invitation"]
      },
      "OrganizationRole": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "example": "admin"
          },
          "name": {
            "type": "string",
            "example": "Administrator"
          },
          "description": {
            "type": ["string", "null"]
          }
        },
        "required": ["id", "slug", "name", "description"]
      },
      "OrganizationRoleList": {
        "type": "object",
        "properties": {
          "roles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrganizationRole"
            }
          }
        },
        "required": ["roles"]
      },
      "Membership": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organization_id": {
            "type": "string",
            "example": "org_01H…"
          },
          "organization_name": {
            "type": "string"
          },
          "role": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string",
                "example": "admin"
              }
            },
            "required": ["slug"]
          },
          "status": {
            "type": "string",
            "example": "active"
          },
          "logoUrl": {
            "description": "URL of the org's logo content (`/organization-logos/{orgId}/content`), or null when the org has no logo.",
            "type": ["string", "null"]
          }
        },
        "required": ["id", "organization_id", "organization_name", "role", "status", "logoUrl"]
      },
      "MembershipList": {
        "type": "object",
        "properties": {
          "memberships": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Membership"
            }
          }
        },
        "required": ["memberships"]
      },
      "OrganizationLogo": {
        "type": "object",
        "properties": {
          "logoUrl": {
            "description": "URL of the logo's binary content (`/organization-logos/{orgId}/content`), or null when unset.",
            "type": ["string", "null"]
          }
        },
        "required": ["logoUrl"]
      },
      "WidgetToken": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "example": "eyJhbGciOi…"
          }
        },
        "required": ["token"]
      },
      "ApiKeyCreator": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "user_01H…"
          },
          "type": {
            "type": "string",
            "enum": ["user", "apiKey"]
          },
          "name": {
            "example": "Jérôme Lin",
            "type": ["string", "null"]
          },
          "email": {
            "description": "Null for an API-key creator.",
            "type": ["string", "null"]
          }
        },
        "required": ["id", "type", "name", "email"]
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "key_01H…"
          },
          "name": {
            "type": "string",
            "example": "CI pipeline"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "v1Only": {
            "type": "boolean",
            "description": "Restricted to the public /v1 API — all other routes answer 403."
          },
          "lastUsedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ApiKeyCreator"
              },
              {
                "type": "null"
              }
            ],
            "description": "Who created the key, or null when that is not known."
          }
        },
        "required": ["id", "name", "permissions", "v1Only", "lastUsedAt", "createdAt", "createdBy"]
      },
      "ApiKeyList": {
        "type": "object",
        "properties": {
          "apiKeys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiKey"
            }
          }
        },
        "required": ["apiKeys"]
      },
      "CreatedApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "key_01H…"
          },
          "name": {
            "type": "string",
            "example": "CI pipeline"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "v1Only": {
            "type": "boolean",
            "description": "Restricted to the public /v1 API — all other routes answer 403."
          },
          "lastUsedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ApiKeyCreator"
              },
              {
                "type": "null"
              }
            ],
            "description": "Who created the key, or null when that is not known."
          },
          "value": {
            "type": "string",
            "description": "The plaintext key. Returned ONCE, at creation, and never retrievable again.",
            "example": "sk_…"
          }
        },
        "required": [
          "id",
          "name",
          "permissions",
          "v1Only",
          "lastUsedAt",
          "createdAt",
          "createdBy",
          "value"
        ]
      },
      "OrganizationDefaultSpace": {
        "type": "object",
        "properties": {
          "spaceId": {
            "type": "string",
            "example": "default"
          }
        },
        "required": ["spaceId"]
      },
      "BillingPlanViewResponse": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "object",
            "properties": {
              "name": {
                "example": "Free",
                "type": ["string", "null"]
              }
            },
            "required": ["name"]
          },
          "balance": {
            "type": "object",
            "properties": {
              "settled": {
                "type": "number",
                "example": 19940
              },
              "granted": {
                "type": "number",
                "example": 20000
              },
              "creditValueUsd": {
                "type": "number",
                "example": 0.001
              }
            },
            "required": ["settled", "granted", "creditValueUsd"]
          },
          "aiWallet": {
            "type": "object",
            "properties": {
              "settled": {
                "type": "number",
                "example": 1000
              },
              "granted": {
                "type": "number",
                "example": 1025
              },
              "creditValueUsd": {
                "type": "number",
                "example": 0.01
              },
              "recharged": {
                "type": "boolean",
                "example": true
              }
            },
            "required": ["settled", "granted", "creditValueUsd", "recharged"]
          },
          "credits": {
            "type": "object",
            "properties": {
              "balance": {
                "type": "number",
                "example": 49716.547
              },
              "held": {
                "type": "number",
                "example": 22.5
              },
              "currency": {
                "type": "string",
                "example": "credits"
              }
            },
            "required": ["balance", "held", "currency"]
          },
          "rates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "feature": {
                  "type": "string",
                  "example": "Parse — Simple Page"
                },
                "unit": {
                  "type": "string",
                  "example": "page"
                },
                "credits": {
                  "type": "number",
                  "example": 5
                }
              },
              "required": ["feature", "unit", "credits"]
            }
          },
          "grants": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "reason": {
                  "example": "plan",
                  "type": ["string", "null"]
                },
                "granted": {
                  "type": "number",
                  "example": 20000
                },
                "remaining": {
                  "type": "number",
                  "example": 19940
                },
                "grantedAt": {
                  "type": "string",
                  "example": "2026-07-26T17:41:42Z"
                },
                "expiresAt": {
                  "example": "2027-07-26T17:41:42Z",
                  "type": ["string", "null"]
                }
              },
              "required": ["reason", "granted", "remaining", "grantedAt", "expiresAt"]
            }
          },
          "usage": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string",
                  "example": "2026-07-25T12:00:00Z"
                },
                "event": {
                  "example": "page_extracted",
                  "type": ["string", "null"]
                },
                "feature": {
                  "example": "Extraction — Smart",
                  "type": ["string", "null"]
                },
                "quantity": {
                  "type": "number",
                  "example": 3
                },
                "credits": {
                  "example": -45,
                  "type": ["number", "null"]
                },
                "dimensions": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": ["string", "number", "boolean"]
                  }
                }
              },
              "required": ["at", "event", "feature", "quantity", "credits"]
            }
          }
        },
        "required": ["plan", "balance", "aiWallet", "credits", "rates", "grants", "usage"]
      },
      "BillingUnavailableResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "enum": ["not_configured", "metering_unavailable"]
          }
        },
        "required": ["error"]
      },
      "BillingRate": {
        "type": "object",
        "properties": {
          "event": {
            "type": "string",
            "example": "sandbox_minutes"
          },
          "unit": {
            "type": "string",
            "enum": ["count", "quantity"]
          },
          "creditsPerUnit": {
            "description": "Credits charged per unit. `null` means the resolved plan prices no meter for this event — reserve nothing rather than guess a price.",
            "type": ["number", "null"]
          },
          "match": {
            "description": "Dimensions this rate applies to, e.g. `{ \"model\": \"gpt-5\" }`. Absent means every row of the event. Read the card IN ORDER and take the first row your dimensions satisfy.",
            "example": {
              "model": "gpt-5-mini"
            },
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1
            },
            "additionalProperties": {
              "type": ["string", "number", "boolean"]
            }
          }
        },
        "required": ["event", "unit", "creditsPerUnit"]
      },
      "BillingRatesResponse": {
        "type": "object",
        "properties": {
          "creditUsd": {
            "type": "number",
            "example": 0.001
          },
          "rates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BillingRate"
            }
          }
        },
        "required": ["creditUsd", "rates"]
      },
      "BillingPortalTokenResponse": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "example": "token_…"
          },
          "componentId": {
            "type": "string",
            "example": "cmpn_…"
          }
        },
        "required": ["token", "componentId"]
      },
      "FileDoc": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "a1b2c3d4"
          },
          "fileName": {
            "type": "string",
            "example": "invoice.pdf"
          },
          "parentType": {
            "type": "string",
            "example": "space"
          },
          "parentId": {
            "type": "string"
          },
          "mimeType": {
            "type": "string",
            "example": "application/pdf"
          },
          "size": {
            "description": "Size in bytes, null until stored.",
            "type": ["number", "null"]
          },
          "status": {
            "type": "string",
            "enum": ["waiting", "stored", "processing", "processed", "failed"],
            "description": "Terminal values are `stored` (uploaded, no processing requested), `processed` and `failed`; `waiting` and `processing` mean keep polling."
          },
          "processingKind": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "doc-simple",
                  "doc-ocr",
                  "doc-auto",
                  "audio-transcribe",
                  "audio-transcribe-and-diarize"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "processingError": {
            "type": "string"
          },
          "processingProgress": {
            "description": "Present while `status` is `processing`. `queued` means that the organization is at its concurrent parse limit and no page of this file is in parse.",
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": ["queued", "processing"]
              },
              "pagesTotal": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "pagesDone": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": ["state", "pagesTotal", "pagesDone"]
          },
          "parentFileId": {
            "description": "Source file this one was generated from (e.g. a redacted or signed copy).",
            "type": "string"
          },
          "artifacts": {
            "description": "Parsing byproducts present, e.g. `structured`, `transcript`.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "indexVectors": {
            "type": "boolean"
          },
          "indexOntology": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "storedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "processedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "urls": {
            "description": "Minted download links, each valid ~1 hour. Present on single-file reads only — list responses mint none.",
            "type": "object",
            "properties": {
              "file": {
                "description": "The stored original.",
                "type": "string"
              },
              "processedJson": {
                "description": "Structured/grounded JSON.",
                "type": "string"
              },
              "processedMd": {
                "description": "Extracted markdown.",
                "type": "string"
              },
              "previewPdf": {
                "type": "string"
              }
            }
          }
        },
        "required": [
          "id",
          "fileName",
          "parentType",
          "parentId",
          "mimeType",
          "size",
          "status",
          "processingKind",
          "createdAt"
        ]
      },
      "CreatedFile": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "uploadUrl": {
            "type": "string",
            "description": "Presigned upload URL, valid 15 minutes. PUT the raw bytes there with a `Content-Type` header EXACTLY equal to the `mimeType` sent at create."
          },
          "uploadExpiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "file": {
            "$ref": "#/components/schemas/FileDoc"
          }
        },
        "required": ["id", "uploadUrl", "uploadExpiresAt", "file"]
      },
      "FileList": {
        "type": "object",
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FileDoc"
            }
          }
        },
        "required": ["files"]
      },
      "Playbook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "example": "Contract intake"
          },
          "description": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["draft", "active", "archived"]
          },
          "spaceTypes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Space-type identifiers this playbook applies to. Empty means every space type."
          },
          "tasks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "instructions": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 4000
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "dependsOn": {
                  "maxItems": 30,
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Task ids that must complete first."
                },
                "executor": {
                  "type": "string",
                  "enum": ["agent", "human"],
                  "description": "`human` tasks are completed by a person out-of-band; the agent never does them."
                },
                "assignee": {
                  "description": "User id. Human tasks only; null = anyone in the space.",
                  "type": ["string", "null"]
                }
              },
              "required": ["id", "title", "instructions", "dependsOn", "executor", "assignee"]
            }
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "installedActionId": {
                  "type": "string",
                  "minLength": 1
                },
                "preApproval": {
                  "type": "boolean",
                  "description": "Gate the action behind a human approval."
                },
                "postApproval": {
                  "type": "boolean",
                  "description": "Review the action output before continuing."
                },
                "dependsOn": {
                  "maxItems": 30,
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Task ids only — an action may never depend on another action."
                },
                "trigger": {
                  "type": "string",
                  "enum": ["agent", "user"],
                  "description": "`user` actions are started from the run view; the agent never proposes them."
                }
              },
              "required": [
                "installedActionId",
                "preApproval",
                "postApproval",
                "dependsOn",
                "trigger"
              ]
            }
          },
          "model": {
            "description": "Optional model override for agent runs. Validated against an allowlist.",
            "type": ["string", "null"]
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "status",
          "spaceTypes",
          "tasks",
          "actions",
          "model",
          "version",
          "createdAt",
          "updatedAt",
          "createdBy"
        ]
      },
      "PlaybookList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Playbook"
            }
          }
        },
        "required": ["data"]
      },
      "PlaybookEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Playbook"
          }
        },
        "required": ["data"]
      },
      "PlaybookValidation": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "issues": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "severity": {
                      "type": "string",
                      "enum": ["error", "warning"]
                    }
                  },
                  "required": ["path", "message", "severity"]
                }
              }
            },
            "required": ["issues"]
          }
        },
        "required": ["data"]
      },
      "DeletedPlaybook": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              }
            },
            "required": ["id"]
          }
        },
        "required": ["data"]
      },
      "PlaybookFileScope": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "const": "space"
              }
            },
            "required": ["mode"]
          },
          {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "const": "picked"
              },
              "fileIds": {
                "minItems": 1,
                "maxItems": 200,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              }
            },
            "required": ["mode", "fileIds"]
          }
        ]
      },
      "PlaybookRunDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          },
          "playbookId": {
            "type": "string"
          },
          "playbookVersion": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "playbookName": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "waiting_approval",
              "waiting_action",
              "waiting_user",
              "paused",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "fileScope": {
            "$ref": "#/components/schemas/PlaybookFileScope"
          },
          "taskProgress": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "completed": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": ["total", "completed"]
          },
          "pendingApproval": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": ["pre", "post"]
                  },
                  "actionName": {
                    "type": "string"
                  },
                  "requestedAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  }
                },
                "required": ["id", "kind", "actionName", "requestedAt"]
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {
            "type": ["string", "null"]
          },
          "error": {
            "type": ["string", "null"]
          },
          "startedBy": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "currentActivity": {
            "type": ["string", "null"]
          },
          "snapshot": {
            "type": "object",
            "properties": {
              "playbookId": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "tasks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "instructions": {
                      "type": ["string", "null"]
                    },
                    "dependsOn": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "executor": {
                      "type": "string",
                      "enum": ["agent", "human"]
                    },
                    "assignee": {
                      "type": ["string", "null"]
                    },
                    "status": {
                      "type": "string",
                      "enum": ["pending", "ready", "in_progress", "completed", "skipped"]
                    },
                    "claimedBy": {
                      "type": ["string", "null"]
                    },
                    "summary": {
                      "type": ["string", "null"]
                    },
                    "completedBy": {
                      "type": ["string", "null"]
                    },
                    "note": {
                      "type": ["string", "null"]
                    },
                    "fileIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "completedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": ["id", "title", "dependsOn", "status", "summary", "completedAt"]
                }
              },
              "actions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "installedActionId": {
                      "type": "string"
                    },
                    "preApproval": {
                      "type": "boolean"
                    },
                    "postApproval": {
                      "type": "boolean"
                    },
                    "dependsOn": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "actionSlug": {
                      "type": "string"
                    },
                    "actionName": {
                      "type": "string"
                    },
                    "trigger": {
                      "type": "string",
                      "enum": ["agent", "user"]
                    },
                    "browserSession": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": ["pairing", "live", "ended", "expired"]
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": ["status", "createdAt"]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "installedActionId",
                    "preApproval",
                    "postApproval",
                    "dependsOn",
                    "actionSlug",
                    "actionName",
                    "trigger",
                    "browserSession"
                  ]
                }
              },
              "fileScope": {
                "$ref": "#/components/schemas/PlaybookFileScope"
              }
            },
            "required": [
              "playbookId",
              "version",
              "name",
              "description",
              "tasks",
              "actions",
              "fileScope"
            ],
            "description": "The playbook as captured at launch. Later edits never affect a run."
          }
        },
        "required": [
          "id",
          "spaceId",
          "playbookId",
          "playbookVersion",
          "playbookName",
          "status",
          "fileScope",
          "taskProgress",
          "pendingApproval",
          "result",
          "error",
          "startedBy",
          "createdAt",
          "updatedAt",
          "finishedAt",
          "currentActivity",
          "snapshot"
        ]
      },
      "PlaybookRunEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PlaybookRunDetail"
          }
        },
        "required": ["data"]
      },
      "PlaybookRun": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          },
          "playbookId": {
            "type": "string"
          },
          "playbookVersion": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "playbookName": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "waiting_approval",
              "waiting_action",
              "waiting_user",
              "paused",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "fileScope": {
            "$ref": "#/components/schemas/PlaybookFileScope"
          },
          "taskProgress": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "completed": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": ["total", "completed"]
          },
          "pendingApproval": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": ["pre", "post"]
                  },
                  "actionName": {
                    "type": "string"
                  },
                  "requestedAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  }
                },
                "required": ["id", "kind", "actionName", "requestedAt"]
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {
            "type": ["string", "null"]
          },
          "error": {
            "type": ["string", "null"]
          },
          "startedBy": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "spaceId",
          "playbookId",
          "playbookVersion",
          "playbookName",
          "status",
          "fileScope",
          "taskProgress",
          "pendingApproval",
          "result",
          "error",
          "startedBy",
          "createdAt",
          "updatedAt",
          "finishedAt"
        ]
      },
      "PlaybookRunList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlaybookRun"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": ["data", "has_more"]
      },
      "PlaybookTimelineEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "type": {
            "type": "string",
            "enum": [
              "run_started",
              "step",
              "task_ready",
              "task_claimed",
              "task_completed",
              "task_skipped",
              "action_proposed",
              "approval_requested",
              "approval_decided",
              "action_dispatched",
              "action_awaiting_input",
              "action_completed",
              "action_failed",
              "action_skipped",
              "output_review_requested",
              "output_edited",
              "steer",
              "pause",
              "resume",
              "stop_requested",
              "browser_session_created",
              "browser_session_paired",
              "browser_command",
              "browser_session_ended",
              "run_completed",
              "run_failed",
              "run_cancelled"
            ]
          },
          "title": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "data": {
            "description": "Sanitized for callers without `space:contribute` (artifact links stripped)."
          }
        },
        "required": ["id", "at", "type", "title"]
      },
      "PlaybookRunTimeline": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlaybookTimelineEvent"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": ["data", "has_more"]
      },
      "PlaybookApproval": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": ["pre", "post"],
            "description": "`pre` gates the dispatch; `post` reviews the output."
          },
          "actionSlug": {
            "type": "string"
          },
          "installedActionId": {
            "type": "string"
          },
          "actionName": {
            "type": "string"
          },
          "actionRunId": {
            "type": ["string", "null"]
          },
          "rationale": {
            "type": ["string", "null"]
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": ["id", "name"]
            }
          },
          "params": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "output": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "artifacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "const": "link"
                },
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "open": {
                  "type": "string",
                  "enum": ["tab", "embed"]
                }
              },
              "required": ["id", "kind", "title", "url", "open"]
            }
          },
          "status": {
            "type": "string",
            "enum": ["pending", "approved", "rejected", "void"]
          },
          "requestedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "decidedBy": {
            "type": ["string", "null"]
          },
          "decidedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "type": ["string", "null"]
          },
          "editedParams": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          },
          "editedFileIds": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "editedOutput": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "actionSlug",
          "installedActionId",
          "actionName",
          "actionRunId",
          "rationale",
          "files",
          "params",
          "output",
          "artifacts",
          "status",
          "requestedAt",
          "decidedBy",
          "decidedAt",
          "note",
          "editedParams",
          "editedFileIds",
          "editedOutput"
        ]
      },
      "PlaybookApprovalList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlaybookApproval"
            }
          }
        },
        "required": ["data"]
      },
      "PlaybookApprovalEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PlaybookApproval"
          }
        },
        "required": ["data"]
      },
      "PlaybookApprovalBatchOutcomeList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "approvalId": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": ["decided", "error"]
                },
                "approval": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/PlaybookApproval"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "error": {
                  "type": ["string", "null"]
                }
              },
              "required": ["approvalId", "status", "approval", "error"]
            }
          }
        },
        "required": ["data"]
      },
      "PlaybookRunTask": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "instructions": {
            "type": ["string", "null"]
          },
          "dependsOn": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "executor": {
            "type": "string",
            "enum": ["agent", "human"]
          },
          "assignee": {
            "type": ["string", "null"]
          },
          "status": {
            "type": "string",
            "enum": ["pending", "ready", "in_progress", "completed", "skipped"]
          },
          "claimedBy": {
            "type": ["string", "null"]
          },
          "summary": {
            "type": ["string", "null"]
          },
          "completedBy": {
            "type": ["string", "null"]
          },
          "note": {
            "type": ["string", "null"]
          },
          "fileIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "completedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["id", "title", "status", "summary", "completedAt"]
      },
      "PlaybookRunTaskEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PlaybookRunTask"
          }
        },
        "required": ["data"]
      },
      "PlaybookRunState": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "running",
                  "waiting_approval",
                  "waiting_action",
                  "waiting_user",
                  "paused",
                  "completed",
                  "failed",
                  "cancelled"
                ]
              },
              "taskProgress": {
                "type": "object",
                "properties": {
                  "total": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "completed": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["total", "completed"]
              },
              "pendingApproval": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "kind": {
                        "type": "string",
                        "enum": ["pre", "post"]
                      },
                      "actionName": {
                        "type": "string"
                      },
                      "requestedAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                      }
                    },
                    "required": ["id", "kind", "actionName", "requestedAt"]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "pendingApprovals": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": ["pre", "post"]
                    },
                    "actionName": {
                      "type": "string"
                    },
                    "requestedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": ["id", "kind", "actionName", "requestedAt"]
                }
              },
              "pendingCount": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "pendingHumanTasks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "taskId": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "assignee": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["taskId", "title", "assignee"]
                }
              },
              "currentActivity": {
                "type": ["string", "null"]
              },
              "result": {
                "type": ["string", "null"]
              },
              "error": {
                "type": ["string", "null"]
              }
            },
            "required": [
              "status",
              "taskProgress",
              "pendingApproval",
              "pendingApprovals",
              "pendingCount",
              "pendingHumanTasks",
              "currentActivity",
              "result",
              "error"
            ]
          }
        },
        "required": ["data"]
      },
      "PlaybookRunBrowserSession": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "sessionId": {
                "type": "string"
              },
              "installedActionId": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": ["pairing", "live", "ended", "expired"]
              },
              "pairUrl": {
                "type": "string",
                "description": "Open in a browser carrying the extension to pair the session."
              },
              "controlUrl": {
                "type": "string"
              },
              "startUrl": {
                "type": ["string", "null"]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              }
            },
            "required": [
              "sessionId",
              "installedActionId",
              "status",
              "pairUrl",
              "controlUrl",
              "startUrl",
              "createdAt"
            ]
          }
        },
        "required": ["data"]
      },
      "PlaybookRunWsTicket": {
        "type": "object",
        "properties": {
          "ticket": {
            "type": "string",
            "description": "Single-use and short-lived."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": ["ticket", "expiresAt"]
      },
      "SpaceTypePlaybook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["draft", "active", "archived"]
          },
          "spaceTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bound": {
            "type": "boolean",
            "description": "Its `spaceTypes` explicitly includes this type."
          },
          "global": {
            "type": "boolean",
            "description": "Its `spaceTypes` is empty, so it applies everywhere and cannot be unbound here."
          }
        },
        "required": ["id", "name", "description", "status", "spaceTypes", "bound", "global"]
      },
      "SpaceTypePlaybookList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SpaceTypePlaybook"
            }
          }
        },
        "required": ["data"]
      },
      "SkillCatalogEntry": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "example": "Vendor intake"
          },
          "description": {
            "type": "string"
          },
          "tier": {
            "type": "string",
            "enum": ["platform", "org", "agent"],
            "description": "Which tier won this slug. Higher tiers win the whole skill, reference files included."
          },
          "version": {
            "type": "string"
          },
          "usedByAgentCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "How many agents list this slug."
          }
        },
        "required": ["slug", "name", "description", "tier", "version", "usedByAgentCount"]
      },
      "SkillList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SkillCatalogEntry"
            }
          }
        },
        "required": ["data"],
        "description": "Catalog only — never the file bodies."
      },
      "Skill": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "tier": {
            "type": "string",
            "enum": ["platform", "org", "agent"],
            "description": "Which tier won this slug. Higher tiers win the whole skill, reference files included."
          },
          "requires": {
            "description": "Action slugs the guidance assumes. Purely informational: a missing action adds a \"not available here\" banner to what the agent reads — it never gates the read.",
            "type": "object",
            "properties": {
              "actions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": ["actions"]
          },
          "files": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            },
            "description": "Markdown files keyed by filename. `SKILL.md` is required and carries the frontmatter (`name`, `description`, optional `requires:` action slugs); siblings are progressive-disclosure references the agent reads on demand."
          }
        },
        "required": ["slug", "name", "description", "version", "tier", "files"]
      },
      "SkillEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Skill"
          }
        },
        "required": ["data"]
      },
      "DeletedSkill": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string"
              }
            },
            "required": ["slug"]
          }
        },
        "required": ["data"]
      },
      "AgentPolicy": {
        "type": "object",
        "properties": {
          "prepend": {
            "type": "string",
            "maxLength": 2000
          },
          "append": {
            "type": "string",
            "maxLength": 2000
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": ["prepend", "append", "version"]
      },
      "AgentPolicyEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/AgentPolicy"
          }
        },
        "required": ["data"]
      },
      "AgentAvatar": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": ["initials", "generated"]
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          }
        },
        "required": ["kind"]
      },
      "Agent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "handle": {
            "type": "string",
            "description": "Unique per org, derived from the name when not given (`mike`, `mike-2`, …)."
          },
          "name": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "avatar": {
            "$ref": "#/components/schemas/AgentAvatar"
          },
          "visibility": {
            "type": "string",
            "enum": ["org", "private"]
          },
          "ownerUserId": {
            "type": "string"
          },
          "publishedVersionId": {
            "description": "The `agv_` id a run is started with. Null until the agent is published.",
            "type": ["string", "null"]
          },
          "documentAgent": {
            "type": "boolean"
          },
          "draftVersionId": {
            "type": "string"
          },
          "emailTriggerId": {
            "type": ["string", "null"]
          },
          "sourcePlaybookId": {
            "description": "Set on agents created by the playbook migration; null otherwise.",
            "type": ["string", "null"]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "type": "string"
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "handle",
          "name",
          "role",
          "avatar",
          "visibility",
          "ownerUserId",
          "publishedVersionId",
          "draftVersionId",
          "emailTriggerId",
          "sourcePlaybookId",
          "createdAt",
          "updatedAt",
          "createdBy",
          "archivedAt"
        ]
      },
      "AgentList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Agent"
            }
          },
          "nextCursor": {
            "description": "Pass back as `cursor` for the next page — opaque, never parsed. Null on the last page.",
            "type": ["string", "null"]
          }
        },
        "required": ["data", "nextCursor"]
      },
      "ToolGrant": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "action"
              },
              "installedActionId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "preApproval": {
                "type": "boolean"
              },
              "postApproval": {
                "type": "boolean"
              }
            },
            "required": ["kind", "installedActionId"]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "connector"
              },
              "connectionId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "readOnlyTools": {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                }
              }
            },
            "required": ["kind", "connectionId"]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "platform"
              },
              "name": {
                "type": "string",
                "enum": [
                  "files",
                  "artifacts",
                  "spaces",
                  "compose",
                  "sign",
                  "search",
                  "objects",
                  "ontology",
                  "markdown"
                ]
              }
            },
            "required": ["kind", "name"]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "sandbox"
              },
              "name": {
                "type": "string",
                "enum": ["fs", "shell", "browser", "code", "net"]
              }
            },
            "required": ["kind", "name"]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "delegate"
              }
            },
            "required": ["kind"]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "ask_human"
              }
            },
            "required": ["kind"]
          }
        ],
        "description": "What the version may call. `fs` / `shell` / `browser` are refused on a `native` version at publish."
      },
      "AgentTask": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "instructions": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 4000
              },
              {
                "type": "null"
              }
            ]
          },
          "dependsOn": {
            "maxItems": 30,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "executor": {
            "type": "string",
            "enum": ["agent", "human"]
          },
          "assignee": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["id", "title"]
      },
      "AgentVersion": {
        "type": "object",
        "properties": {
          "documentAgent": {
            "description": "Offer this published agent as a document reviewer. Requires file reading and document editing tools.",
            "type": "boolean"
          },
          "harness": {
            "description": "Automatic execution keeps the agent loop in the platform and starts isolated compute only when a tool needs it. Default: `auto`. Legacy `native` and `sandbox` values remain accepted for existing integrations.",
            "type": "string",
            "enum": ["auto", "native", "sandbox"]
          },
          "instructions": {
            "description": "The standing instructions the agent runs under. A `native` version must also fit the engine ceiling (8000 chars) to publish.",
            "type": "string",
            "maxLength": 32768
          },
          "model": {
            "type": "object",
            "properties": {
              "policy": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "maxSteps": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              "budgetCredits": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              }
            }
          },
          "memory": {
            "description": "Saved memory the agent reads and updates across sessions. Private agents only: publishing an org agent with memory enabled answers 422 `memory_requires_private`. Default: on for `sandbox`, off otherwise.",
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              }
            },
            "required": ["enabled"],
            "additionalProperties": false
          },
          "skills": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "tools": {
            "maxItems": 40,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ToolGrant"
            }
          },
          "spaces": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": ["session", "fixed", "any"]
              },
              "spaceIds": {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "spaceTypes": {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9-]{0,38}[a-z0-9]$"
                }
              }
            }
          },
          "network": {
            "type": "object",
            "properties": {
              "policyId": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 128
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "approvals": {
            "type": "object",
            "properties": {
              "defaultForWrite": {
                "type": "string",
                "enum": ["ask", "allow"]
              },
              "sensitive": {
                "type": "string",
                "const": "ask"
              },
              "approvers": {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              }
            }
          },
          "delegation": {
            "type": "object",
            "properties": {
              "canInvite": {
                "anyOf": [
                  {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  {
                    "type": "string",
                    "enum": ["any", "none"]
                  }
                ]
              }
            }
          },
          "tasks": {
            "maxItems": 30,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentTask"
            }
          },
          "id": {
            "type": "string"
          },
          "agentId": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "publishedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "agentId",
          "version",
          "publishedAt",
          "createdAt",
          "updatedAt",
          "createdBy"
        ]
      },
      "AgentDetail": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "agent": {
                "$ref": "#/components/schemas/Agent"
              },
              "draft": {
                "$ref": "#/components/schemas/AgentVersion"
              },
              "published": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/AgentVersion"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": ["agent", "draft", "published"]
          }
        },
        "required": ["data"]
      },
      "PlaybookMigrationResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "created": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "playbookId": {
                      "type": "string"
                    },
                    "agentId": {
                      "type": "string"
                    },
                    "handle": {
                      "type": "string"
                    }
                  },
                  "required": ["playbookId", "agentId", "handle"]
                }
              },
              "skipped": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Playbook ids that already have an agent — the idempotency answer."
              },
              "failed": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "playbookId": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": ["playbookId", "error"]
                },
                "description": "Playbooks the import could not express as an agent (a legacy document the current schema refuses). Each is skipped on its own, the rest of the org still imports."
              }
            },
            "required": ["created", "skipped", "failed"]
          }
        },
        "required": ["data"]
      },
      "AgentEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Agent"
          }
        },
        "required": ["data"]
      },
      "NetworkPolicy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^net_[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "name": {
            "type": "string"
          },
          "hosts": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "credentialRef": {
                  "type": ["string", "null"]
                },
                "approval": {
                  "type": "boolean"
                }
              },
              "required": ["credentialRef", "approval"]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "type": "string"
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set once the policy is revoked. A revoked policy stays READABLE for history and every egress request under it is denied."
          }
        },
        "required": ["id", "name", "hosts", "createdAt", "createdBy", "revokedAt"]
      },
      "NetworkPolicyList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NetworkPolicy"
            }
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["data", "nextCursor"]
      },
      "NetworkPolicyEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/NetworkPolicy"
          }
        },
        "required": ["data"]
      },
      "NetworkPolicyBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "hosts": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "credentialRef": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The opaque Vault reference of an enabled connection in this organization, or `null` for an unauthenticated host. The proxy injects the headers host-side; the container never holds the value."
                },
                "approval": {
                  "default": false,
                  "description": "When true the proxy PARKS every request to this host as an `apr_` approval and holds the response until a declared approver decides it (or 408 after ten minutes).",
                  "type": "boolean"
                }
              },
              "required": ["credentialRef"],
              "additionalProperties": false
            },
            "description": "Host → rule. A key is an exact lowercase public DNS hostname: no port, no wildcard, no path, no IP literal, no internal or private target. At most 50."
          }
        },
        "required": ["name", "hosts"],
        "additionalProperties": false
      },
      "StyleProfileFontCatalog": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "fonts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "family": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    }
                  },
                  "required": ["family", "kind"]
                }
              },
              "defaults": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": ["fonts", "defaults"]
          }
        },
        "required": ["data"]
      },
      "StyleProfile": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "logoFileId": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              {
                "type": "null"
              }
            ]
          },
          "colors": {
            "default": {},
            "type": "object",
            "properties": {
              "primary": {
                "default": "#1F6FEB",
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$",
                "example": "#1F6FEB"
              },
              "secondary": {
                "default": "#6E7781",
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$",
                "example": "#1F6FEB"
              },
              "text": {
                "default": "#111111",
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$",
                "example": "#1F6FEB"
              }
            }
          },
          "fonts": {
            "default": {},
            "type": "object",
            "properties": {
              "body": {
                "default": "Noto Serif",
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "heading": {
                "default": "Roboto",
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "baseSize": {
                "default": 10.5,
                "type": "number",
                "minimum": 7,
                "maximum": 18
              }
            }
          },
          "page": {
            "default": {},
            "type": "object",
            "properties": {
              "paper": {
                "default": "a4",
                "type": "string",
                "enum": ["a4", "us-letter"]
              },
              "margins": {
                "default": {},
                "type": "object",
                "properties": {
                  "top": {
                    "default": 2.2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "bottom": {
                    "default": 2.2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "left": {
                    "default": 2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "right": {
                    "default": 2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  }
                }
              },
              "headerText": {
                "default": "",
                "type": "string",
                "maxLength": 200
              },
              "footerText": {
                "default": "",
                "type": "string",
                "maxLength": 200
              },
              "pageNumbers": {
                "default": true,
                "type": "boolean"
              }
            }
          },
          "headings": {
            "default": {},
            "type": "object",
            "properties": {
              "numbered": {
                "default": false,
                "type": "boolean"
              },
              "color": {
                "default": "primary",
                "type": "string",
                "enum": ["primary", "text"]
              }
            }
          },
          "table": {
            "default": {},
            "type": "object",
            "properties": {
              "headerFill": {
                "default": "secondary",
                "type": "string",
                "enum": ["primary", "secondary", "none"]
              },
              "stroke": {
                "default": true,
                "type": "boolean"
              }
            }
          },
          "isDefault": {
            "default": false,
            "type": "boolean"
          },
          "id": {
            "type": "string",
            "example": "sty_01J9ZQ8YV3K7M2N4P6R8T0W2X4"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "type": "string"
          }
        },
        "required": ["name", "id", "createdAt", "updatedAt", "createdBy"],
        "additionalProperties": false
      },
      "StyleProfileList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StyleProfile"
            }
          }
        },
        "required": ["data"]
      },
      "StyleProfileEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/StyleProfile"
          }
        },
        "required": ["data"]
      },
      "StyleProfileBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "logoFileId": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              {
                "type": "null"
              }
            ]
          },
          "colors": {
            "default": {},
            "type": "object",
            "properties": {
              "primary": {
                "default": "#1F6FEB",
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$",
                "example": "#1F6FEB"
              },
              "secondary": {
                "default": "#6E7781",
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$",
                "example": "#1F6FEB"
              },
              "text": {
                "default": "#111111",
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$",
                "example": "#1F6FEB"
              }
            }
          },
          "fonts": {
            "default": {},
            "type": "object",
            "properties": {
              "body": {
                "default": "Noto Serif",
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "heading": {
                "default": "Roboto",
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "baseSize": {
                "default": 10.5,
                "type": "number",
                "minimum": 7,
                "maximum": 18
              }
            }
          },
          "page": {
            "default": {},
            "type": "object",
            "properties": {
              "paper": {
                "default": "a4",
                "type": "string",
                "enum": ["a4", "us-letter"]
              },
              "margins": {
                "default": {},
                "type": "object",
                "properties": {
                  "top": {
                    "default": 2.2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "bottom": {
                    "default": 2.2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "left": {
                    "default": 2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "right": {
                    "default": 2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  }
                }
              },
              "headerText": {
                "default": "",
                "type": "string",
                "maxLength": 200
              },
              "footerText": {
                "default": "",
                "type": "string",
                "maxLength": 200
              },
              "pageNumbers": {
                "default": true,
                "type": "boolean"
              }
            }
          },
          "headings": {
            "default": {},
            "type": "object",
            "properties": {
              "numbered": {
                "default": false,
                "type": "boolean"
              },
              "color": {
                "default": "primary",
                "type": "string",
                "enum": ["primary", "text"]
              }
            }
          },
          "table": {
            "default": {},
            "type": "object",
            "properties": {
              "headerFill": {
                "default": "secondary",
                "type": "string",
                "enum": ["primary", "secondary", "none"]
              },
              "stroke": {
                "default": true,
                "type": "boolean"
              }
            }
          },
          "isDefault": {
            "default": false,
            "type": "boolean"
          }
        },
        "required": ["name"],
        "additionalProperties": false
      },
      "PatchStyleProfileBody": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "logoFileId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              {
                "type": "null"
              }
            ]
          },
          "colors": {
            "type": "object",
            "properties": {
              "primary": {
                "default": "#1F6FEB",
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$",
                "example": "#1F6FEB"
              },
              "secondary": {
                "default": "#6E7781",
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$",
                "example": "#1F6FEB"
              },
              "text": {
                "default": "#111111",
                "type": "string",
                "pattern": "^#[0-9a-fA-F]{6}$",
                "example": "#1F6FEB"
              }
            }
          },
          "fonts": {
            "type": "object",
            "properties": {
              "body": {
                "default": "Noto Serif",
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "heading": {
                "default": "Roboto",
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "baseSize": {
                "default": 10.5,
                "type": "number",
                "minimum": 7,
                "maximum": 18
              }
            }
          },
          "page": {
            "type": "object",
            "properties": {
              "paper": {
                "default": "a4",
                "type": "string",
                "enum": ["a4", "us-letter"]
              },
              "margins": {
                "default": {},
                "type": "object",
                "properties": {
                  "top": {
                    "default": 2.2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "bottom": {
                    "default": 2.2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "left": {
                    "default": 2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "right": {
                    "default": 2,
                    "type": "number",
                    "minimum": 1,
                    "maximum": 5
                  }
                }
              },
              "headerText": {
                "default": "",
                "type": "string",
                "maxLength": 200
              },
              "footerText": {
                "default": "",
                "type": "string",
                "maxLength": 200
              },
              "pageNumbers": {
                "default": true,
                "type": "boolean"
              }
            }
          },
          "headings": {
            "type": "object",
            "properties": {
              "numbered": {
                "default": false,
                "type": "boolean"
              },
              "color": {
                "default": "primary",
                "type": "string",
                "enum": ["primary", "text"]
              }
            }
          },
          "table": {
            "type": "object",
            "properties": {
              "headerFill": {
                "default": "secondary",
                "type": "string",
                "enum": ["primary", "secondary", "none"]
              },
              "stroke": {
                "default": true,
                "type": "boolean"
              }
            }
          },
          "isDefault": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "WorkspaceSession": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 8000
          },
          "status": {
            "type": "string",
            "enum": ["open", "working", "waiting", "done", "archived"]
          },
          "workStatus": {
            "type": "string",
            "enum": ["active", "ready_for_review", "done"],
            "description": "Whether the WORK is done, which only people decide. `status` stays the derived state of the turns."
          },
          "openedBy": {
            "$ref": "#/components/schemas/WorkSessionSender"
          },
          "openedVia": {
            "type": "string",
            "enum": ["web", "desktop", "api", "email", "webhook", "schedule", "slack", "assistant"]
          },
          "participants": {
            "type": "object",
            "properties": {
              "humans": {
                "maxItems": 200,
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "agents": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "agentId": {
                      "type": "string"
                    },
                    "versionId": {
                      "type": "string"
                    },
                    "handle": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string"
                    },
                    "joinedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": ["agentId", "versionId", "handle", "name", "role", "joinedAt"]
                }
              }
            },
            "required": ["humans", "agents"]
          },
          "spaces": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "spaceId": {
                  "type": "string"
                },
                "access": {
                  "type": "string",
                  "enum": ["read", "commit"]
                }
              },
              "required": ["spaceId", "access"]
            }
          },
          "files": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fileId": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "enum": ["input", "artifact"]
                }
              },
              "required": ["fileId", "role"]
            }
          },
          "triggerId": {
            "type": ["string", "null"]
          },
          "parentSessionId": {
            "type": ["string", "null"]
          },
          "counts": {
            "type": "object",
            "properties": {
              "turns": {
                "type": "number"
              },
              "approvalsPending": {
                "type": "number"
              },
              "tasksPending": {
                "type": "number"
              },
              "unread": {
                "type": "number"
              }
            },
            "required": ["turns", "approvalsPending", "tasksPending", "unread"]
          },
          "lastActivityAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "closedAt": {
            "type": ["string", "null"]
          }
        },
        "required": [
          "id",
          "title",
          "description",
          "status",
          "workStatus",
          "openedBy",
          "openedVia",
          "participants",
          "spaces",
          "files",
          "triggerId",
          "parentSessionId",
          "counts",
          "lastActivityAt",
          "createdAt",
          "closedAt"
        ]
      },
      "WorkSessionDetail": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/WorkspaceSession"
          }
        },
        "required": ["data"]
      },
      "WorkspaceSpaceLink": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          {
            "type": "object",
            "properties": {
              "spaceId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "access": {
                "default": "commit",
                "type": "string",
                "enum": ["read", "commit"]
              }
            },
            "required": ["spaceId"]
          }
        ]
      },
      "OpenWorkspaceSessionBody": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8000
          },
          "agentIds": {
            "default": [],
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "spaceIds": {
            "default": [],
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkspaceSpaceLink"
            }
          },
          "fileIds": {
            "default": [],
            "description": "The session’s working set. EVERY turn the session runs is scoped to these files, plus whatever the comment that woke it attaches — a caller never has to re-send them.",
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        },
        "required": ["description"]
      },
      "WorkSessionSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["open", "working", "waiting", "done", "archived"]
          },
          "workStatus": {
            "type": "string",
            "enum": ["active", "ready_for_review", "done"],
            "description": "Whether the WORK is done, which only people decide. `status` stays the derived state of the turns."
          },
          "openedByUserId": {
            "type": ["string", "null"]
          },
          "openedVia": {
            "type": ["string", "null"]
          },
          "participantUserIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "agentIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "spaceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "primarySpaceId": {
            "type": ["string", "null"]
          },
          "counts": {
            "type": "object",
            "properties": {
              "turns": {
                "type": "number"
              },
              "approvalsPending": {
                "type": "number"
              },
              "tasksPending": {
                "type": "number"
              },
              "unread": {
                "type": "number"
              }
            },
            "required": ["turns", "approvalsPending", "tasksPending", "unread"]
          },
          "lastActivityAt": {
            "type": ["string", "null"]
          },
          "createdAt": {
            "type": ["string", "null"]
          },
          "updatedAt": {
            "type": ["string", "null"]
          },
          "archivedAt": {
            "type": ["string", "null"]
          }
        },
        "required": [
          "id",
          "title",
          "description",
          "status",
          "workStatus",
          "openedByUserId",
          "openedVia",
          "participantUserIds",
          "agentIds",
          "spaceIds",
          "primarySpaceId",
          "counts",
          "lastActivityAt",
          "createdAt",
          "updatedAt",
          "archivedAt"
        ]
      },
      "WorkSessionList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkSessionSummary"
            }
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["data", "nextCursor"]
      },
      "PatchWorkspaceSessionBody": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 8000
          },
          "spaces": {
            "minItems": 1,
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkspaceSpaceLink"
            }
          },
          "addHumans": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "removeHumans": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "fileIds": {
            "description": "The session’s working set, replaced wholesale. Every id must exist and be readable by the caller; `[]` empties the set.",
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "archive": {
            "type": "boolean"
          },
          "workStatus": {
            "type": "string",
            "enum": ["active", "ready_for_review", "done"],
            "description": "Whether the WORK is done, which only people decide. `status` stays the derived state of the turns."
          }
        },
        "additionalProperties": false
      },
      "WorkSessionEntryList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkSessionEntry"
            }
          },
          "hasMore": {
            "type": "boolean"
          }
        },
        "required": ["data", "hasMore"]
      },
      "WorkSessionTurn": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "sessionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "agentId": {
            "type": "string"
          },
          "agentVersionId": {
            "type": "string"
          },
          "harness": {
            "type": "string",
            "enum": ["native", "sandbox"]
          },
          "outcome": {
            "anyOf": [
              {
                "type": "string",
                "const": "incomplete"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "waiting_approval",
              "waiting_action",
              "waiting_user",
              "paused",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "startedBy": {
            "$ref": "#/components/schemas/WorkSessionSender"
          },
          "reason": {
            "type": "string",
            "enum": ["mention", "trigger", "handoff", "steer", "assistant"]
          },
          "threadId": {
            "type": ["string", "null"]
          },
          "parentTurnId": {
            "type": ["string", "null"]
          },
          "nativeRunId": {
            "type": ["string", "null"]
          },
          "nativeSpaceId": {
            "type": ["string", "null"]
          },
          "sandboxId": {
            "type": ["string", "null"]
          },
          "waitingReason": {
            "anyOf": [
              {
                "type": "string",
                "enum": ["sandbox_capacity", "sandbox_provisioning", "budget_exceeded"]
              },
              {
                "type": "null"
              }
            ]
          },
          "fileIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "finishedAt": {
            "type": ["string", "null"]
          },
          "summary": {
            "type": ["string", "null"]
          },
          "error": {
            "type": ["string", "null"]
          }
        },
        "required": [
          "id",
          "sessionId",
          "agentId",
          "agentVersionId",
          "harness",
          "status",
          "startedBy",
          "reason",
          "threadId",
          "parentTurnId",
          "nativeRunId",
          "nativeSpaceId",
          "sandboxId",
          "startedAt",
          "finishedAt",
          "summary",
          "error"
        ]
      },
      "WorkSessionTurnList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkSessionTurn"
            }
          },
          "hasMore": {
            "type": "boolean"
          }
        },
        "required": ["data", "hasMore"]
      },
      "WorkSessionArtifactList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionArtifact"
            }
          },
          "hasMore": {
            "type": "boolean"
          }
        },
        "required": ["data", "hasMore"]
      },
      "DocumentAnchor": {
        "type": "object",
        "properties": {
          "artifactId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "example": "art_01J8Z…"
          },
          "from": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "example": 512
          },
          "to": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "example": 640
          }
        },
        "required": ["artifactId", "from", "to"]
      },
      "WorkSessionThread": {
        "type": "object",
        "properties": {
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "string",
            "example": "thd_01J8Z…"
          },
          "rootSeq": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "example": 12
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "anchor": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/DocumentAnchor"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "quote": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      },
                      "sourceVersion": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    }
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": ["id", "rootSeq", "createdAt", "anchor"]
      },
      "WorkSessionThreadList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkSessionThread"
            }
          },
          "hasMore": {
            "type": "boolean"
          }
        },
        "required": ["data", "hasMore"]
      },
      "AppendWorkspaceEntryResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "entry": {
                "$ref": "#/components/schemas/WorkSessionEntry"
              },
              "turns": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WorkSessionTurn"
                }
              },
              "unresolvedMentions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "refused": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "agentId": {
                      "type": "string"
                    },
                    "handle": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    }
                  },
                  "required": ["agentId", "handle", "reason"]
                }
              }
            },
            "required": ["entry", "turns", "unresolvedMentions", "refused"]
          }
        },
        "required": ["data"]
      },
      "AppendWorkspaceEntryBody": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          },
          "threadId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "mentions": {
            "default": [],
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "fileIds": {
            "description": "Files this comment ATTACHES. The turn runs on the session’s working set plus these, so re-sending the session’s own files is never necessary; a file that is new to the session widens the scope and starts a successor turn instead of steering the live one.",
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        },
        "required": ["text"]
      },
      "WorkspaceThread": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/WorkSessionThread"
          }
        },
        "required": ["data"]
      },
      "OpenWorkspaceThreadBody": {
        "type": "object",
        "properties": {
          "archived": {
            "type": "boolean"
          },
          "rootSeq": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "anchor": {
            "$ref": "#/components/schemas/DocumentAnchor"
          }
        },
        "required": ["rootSeq"]
      },
      "WorkSessionTurnResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          }
        },
        "required": ["data"]
      },
      "SteerWorkspaceTurnBody": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          }
        },
        "required": ["message"]
      },
      "CancelWorkspaceTurnBody": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          }
        }
      },
      "DecideWorkspaceApprovalBody": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": ["approve", "reject"]
          },
          "note": {
            "type": "string",
            "maxLength": 4000
          },
          "editedParams": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "edits": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": ["decision"]
      },
      "CompleteWorkspaceTaskBody": {
        "type": "object",
        "properties": {
          "note": {
            "type": "string",
            "maxLength": 2000
          },
          "fileIds": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        }
      },
      "SkipWorkspaceTaskBody": {
        "type": "object",
        "properties": {
          "note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000
          }
        },
        "required": ["note"]
      },
      "WorkspaceSandboxState": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": ["none", "queued", "provisioning", "ready", "sleeping"]
          },
          "sbxId": {
            "type": "string"
          },
          "lastSeenAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "backupAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": ["state"]
      },
      "WorkSessionWsTicketResult": {
        "type": "object",
        "properties": {
          "ticket": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          }
        },
        "required": ["ticket", "expiresAt"]
      },
      "WorkspaceInboxItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "approval",
              "human_task",
              "question",
              "mention",
              "parked",
              "run_attention",
              "connector"
            ]
          },
          "document": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "threadId": {
                    "type": "string"
                  }
                },
                "required": ["artifactId", "threadId"]
              },
              {
                "type": "null"
              }
            ]
          },
          "sessionId": {
            "type": ["string", "null"]
          },
          "turnId": {
            "type": ["string", "null"]
          },
          "refId": {
            "type": ["string", "null"]
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": ["string", "null"]
          },
          "status": {
            "type": "string",
            "enum": ["open", "read", "done"]
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          },
          "readAt": {
            "type": ["string", "null"]
          },
          "unread": {
            "type": "boolean"
          },
          "audience": {
            "type": "string",
            "enum": ["space", "user"]
          },
          "spaceId": {
            "type": ["string", "null"]
          },
          "assignee": {
            "type": ["string", "null"]
          },
          "claimedBy": {
            "type": ["string", "null"]
          },
          "taskStatus": {
            "type": ["string", "null"]
          },
          "runId": {
            "type": ["string", "null"]
          },
          "threadId": {
            "type": ["string", "null"]
          },
          "runCreatedAt": {
            "type": ["string", "null"]
          },
          "playbookName": {
            "type": ["string", "null"]
          },
          "startedBy": {
            "type": ["string", "null"]
          },
          "runStatus": {
            "type": ["string", "null"]
          },
          "failureAt": {
            "type": ["string", "null"]
          },
          "initializationPending": {
            "type": "boolean"
          },
          "legacyImportPending": {
            "type": "boolean"
          },
          "unattended": {
            "type": ["boolean", "null"]
          },
          "connectionId": {
            "type": ["string", "null"]
          },
          "reauthUrl": {
            "type": ["string", "null"]
          },
          "brokenCode": {
            "type": ["string", "null"]
          }
        },
        "required": [
          "id",
          "userId",
          "kind",
          "sessionId",
          "turnId",
          "refId",
          "title",
          "body",
          "status",
          "createdAt",
          "updatedAt",
          "readAt"
        ]
      },
      "WorkspaceInboxList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkspaceInboxItem"
            }
          },
          "nextCursor": {
            "type": ["string", "null"]
          },
          "unreadCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Unread rows across every page, the badge number. Never counts a resolved (`done`) row, whatever `status` asked for, and includes the synthesized broken-connector rows."
          },
          "totalCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Rows across every page in the SAME set this call pages over: `status=open` (the default) counts unresolved rows only, `status=all` counts resolved rows too. Includes the synthesized broken-connector rows."
          }
        },
        "required": ["data", "nextCursor", "unreadCount", "totalCount"]
      },
      "WorkspaceInboxItemEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/WorkspaceInboxItem"
          }
        },
        "required": ["data"]
      },
      "WorkspaceAgentWorkPolicy": {
        "type": "object",
        "properties": {
          "harness": {
            "type": "string",
            "enum": ["auto", "native", "sandbox"]
          },
          "spaces": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": ["any", "fixed", "session"]
              },
              "spaceTypes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "spaceIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": ["mode"]
          },
          "handoffs": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": ["none", "any", "list"]
              },
              "agentIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": ["mode"]
          }
        },
        "required": ["harness", "spaces", "handoffs"]
      },
      "WorkspaceAgentDirectory": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "handle": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "role": {
                  "type": "string"
                },
                "publishedVersionId": {
                  "type": ["string", "null"]
                },
                "workPolicy": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/WorkspaceAgentWorkPolicy"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": ["id", "handle", "name", "role", "publishedVersionId", "workPolicy"],
              "additionalProperties": {}
            }
          },
          "nextCursor": {
            "type": ["string", "null"]
          }
        },
        "required": ["data", "nextCursor"]
      },
      "WorkspaceDocumentContent": {
        "type": "object",
        "properties": {
          "artifactId": {
            "type": "string",
            "example": "art_01J8Z…"
          },
          "name": {
            "type": "string",
            "example": "acme-msa.md"
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "example": 2
          },
          "markdown": {
            "type": "string"
          },
          "editorState": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000000
              },
              {
                "type": "null"
              }
            ]
          },
          "readOnly": {
            "type": "boolean"
          }
        },
        "required": ["artifactId", "name", "version", "markdown", "readOnly"]
      },
      "WorkspaceDocumentArtifact": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/SessionArtifact"
          }
        },
        "required": ["data"]
      },
      "SaveWorkspaceDocumentBody": {
        "type": "object",
        "properties": {
          "markdown": {
            "type": "string",
            "maxLength": 1000000
          },
          "editorState": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000000
              },
              {
                "type": "null"
              }
            ]
          },
          "summary": {
            "type": "string",
            "maxLength": 1000
          },
          "baseVersion": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": ["markdown"],
        "additionalProperties": false
      },
      "ComposeWorkspaceDocumentBody": {
        "type": "object",
        "properties": {
          "styleProfileId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "configId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        "additionalProperties": false
      },
      "PreviewWorkspaceDocumentBody": {
        "type": "object",
        "properties": {
          "styleProfileId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        "additionalProperties": false
      },
      "ExportWorkspaceDocumentBody": {
        "type": "object",
        "properties": {
          "format": {
            "type": "string",
            "const": "docx"
          }
        },
        "required": ["format"],
        "additionalProperties": false
      },
      "ImportWorkspaceDocumentBody": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        },
        "required": ["fileId"],
        "additionalProperties": false
      },
      "OnboardingDefaultSpace": {
        "type": "object",
        "properties": {
          "spaceId": {
            "type": "string",
            "example": "default"
          }
        },
        "required": ["spaceId"]
      },
      "SeedPresetDocumentBody": {
        "type": "object",
        "properties": {
          "presetSlug": {
            "type": "string",
            "enum": [
              "patient-intake-extraction",
              "claim-packet-extraction",
              "insurance-policy-declarations-extraction",
              "contract-key-terms",
              "manufacturing-invoice-extraction",
              "real-estate-lease-abstraction-extraction",
              "credit-agreement-extraction",
              "public-sector-solicitation-extraction",
              "signature-packet",
              "base-redact-pdf",
              "base-redact-audio",
              "fill-form-from-records"
            ],
            "example": "patient-intake-extraction"
          },
          "industry": {
            "example": "healthcare",
            "type": "string"
          },
          "installId": {
            "example": "act_01J…",
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9_-]+$"
          }
        },
        "required": ["presetSlug"]
      },
      "OnboardingProfileBody": {
        "type": "object",
        "properties": {
          "product": {
            "type": "string",
            "enum": ["sign", "paperwork", "run"],
            "example": "paperwork"
          },
          "role": {
            "example": "operations",
            "type": "string",
            "enum": ["operations", "finance", "legal", "engineering", "other"]
          },
          "teamSize": {
            "example": "2-10",
            "type": "string",
            "enum": ["1", "2-10", "11-50", "51-200", "201+"]
          },
          "signVolume": {
            "example": "10-100",
            "type": "string",
            "enum": ["lt10", "10-100", "gt100"]
          },
          "paperworkFocus": {
            "example": ["intake", "invoices"],
            "maxItems": 6,
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["intake", "invoices", "contracts", "vendor-onboarding", "claims", "other"]
            }
          },
          "runAudience": {
            "example": "internal",
            "type": "string",
            "enum": ["internal", "product"]
          },
          "technical": {
            "example": true,
            "type": "boolean"
          },
          "source": {
            "example": "website-pricing",
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        },
        "required": ["product"],
        "additionalProperties": false
      },
      "SpaceTypeListItem": {
        "type": "object",
        "properties": {
          "identifier": {
            "type": "string",
            "description": "The stable lowercase key.",
            "example": "legal"
          },
          "title": {
            "type": "string",
            "example": "Legal"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "description": "User id of the creator.",
            "type": "string"
          },
          "ontology": {
            "description": "Per-space-type extraction configuration, applied to future ingests.",
            "type": "object",
            "properties": {
              "prompt": {
                "description": "Freeform guidance appended to the extraction instructions.",
                "type": "string",
                "maxLength": 4000
              },
              "entities": {
                "description": "Allowed entity types. When non-empty this list REPLACES the built-in types; extracted entities are validated against these keys.",
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_-]{0,63}$",
                      "example": "vendor"
                    },
                    "description": {
                      "example": "A supplier organization",
                      "type": "string",
                      "maxLength": 500
                    }
                  },
                  "required": ["key"]
                }
              },
              "includeDateTime": {
                "description": "Include the current date and time during extraction.",
                "type": "boolean"
              }
            }
          },
          "viewerCanContribute": {
            "type": "boolean",
            "description": "Whether the caller may create a space under this type. True for administrators or an explicit `spacetype:contribute` grant."
          }
        },
        "required": ["identifier", "title", "createdAt", "updatedAt", "viewerCanContribute"]
      },
      "SpaceTypeList": {
        "type": "object",
        "properties": {
          "spaceTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SpaceTypeListItem"
            }
          }
        },
        "required": ["spaceTypes"]
      },
      "SpaceType": {
        "type": "object",
        "properties": {
          "identifier": {
            "type": "string",
            "description": "The stable lowercase key.",
            "example": "legal"
          },
          "title": {
            "type": "string",
            "example": "Legal"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "description": "User id of the creator.",
            "type": "string"
          },
          "ontology": {
            "description": "Per-space-type extraction configuration, applied to future ingests.",
            "type": "object",
            "properties": {
              "prompt": {
                "description": "Freeform guidance appended to the extraction instructions.",
                "type": "string",
                "maxLength": 4000
              },
              "entities": {
                "description": "Allowed entity types. When non-empty this list REPLACES the built-in types; extracted entities are validated against these keys.",
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_-]{0,63}$",
                      "example": "vendor"
                    },
                    "description": {
                      "example": "A supplier organization",
                      "type": "string",
                      "maxLength": 500
                    }
                  },
                  "required": ["key"]
                }
              },
              "includeDateTime": {
                "description": "Include the current date and time during extraction.",
                "type": "boolean"
              }
            }
          }
        },
        "required": ["identifier", "title", "createdAt", "updatedAt"]
      },
      "SpaceTypeEnvelope": {
        "type": "object",
        "properties": {
          "spaceType": {
            "$ref": "#/components/schemas/SpaceType"
          }
        },
        "required": ["spaceType"]
      },
      "Space": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "example": "Acme MSA"
          },
          "spaceType": {
            "type": "string",
            "description": "Identifier of the parent space type."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "type": "string"
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Deadline of an API-managed (`/v1`) space, after which it is closed and its files deleted. `null` for a space created in the app, which never expires."
          }
        },
        "required": ["id", "title", "spaceType", "createdAt", "updatedAt", "expiresAt"]
      },
      "SpaceList": {
        "type": "object",
        "properties": {
          "spaces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Space"
            }
          }
        },
        "required": ["spaces"]
      },
      "SpaceEnvelope": {
        "type": "object",
        "properties": {
          "space": {
            "$ref": "#/components/schemas/Space"
          }
        },
        "required": ["space"]
      },
      "Participant": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": ["member", "group"],
            "description": "Always `member` today — group-derived access is listed as its individual members."
          },
          "userId": {
            "type": "string"
          },
          "groupId": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "example": "Ada Lovelace"
          },
          "avatarUrl": {
            "type": "string"
          },
          "memberCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "role": {
            "type": "string",
            "example": "space-contributor"
          },
          "canWrite": {
            "type": "boolean"
          }
        },
        "required": ["kind", "name", "role", "canWrite"]
      },
      "Participants": {
        "type": "object",
        "properties": {
          "participants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Participant"
            }
          },
          "viewerCanWrite": {
            "type": "boolean"
          },
          "viewerCanShare": {
            "type": "boolean"
          }
        },
        "required": ["participants", "viewerCanWrite", "viewerCanShare"]
      },
      "ObjectDefinition": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "example": "def_contract"
          },
          "nameSingular": {
            "type": "string",
            "example": "contract"
          },
          "namePlural": {
            "type": "string",
            "example": "contracts"
          },
          "labelSingular": {
            "type": "string",
            "example": "Contract"
          },
          "labelPlural": {
            "type": "string",
            "example": "Contracts"
          },
          "description": {
            "type": "string"
          },
          "icon": {
            "type": "string"
          },
          "color": {
            "type": ["string", "null"]
          },
          "labelFieldKey": {
            "type": "string",
            "description": "Field key whose value is the object’s display label."
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            },
            "description": "The type-discriminated field model (13 field types plus composites). Emitted permissively so the resource stays navigable."
          },
          "fieldGroups": {
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            }
          },
          "version": {
            "type": "number",
            "description": "Bumps only on a schema-affecting change."
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "type": "string"
          }
        },
        "required": [
          "_id",
          "nameSingular",
          "namePlural",
          "labelSingular",
          "labelPlural",
          "description",
          "icon",
          "color",
          "labelFieldKey",
          "fields",
          "fieldGroups",
          "version",
          "archivedAt",
          "createdAt",
          "updatedAt",
          "createdBy"
        ]
      },
      "ObjectDefinitionList": {
        "type": "object",
        "properties": {
          "definitions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObjectDefinition"
            }
          }
        },
        "required": ["definitions"]
      },
      "ObjectDefinitionEnvelope": {
        "type": "object",
        "properties": {
          "definition": {
            "$ref": "#/components/schemas/ObjectDefinition"
          }
        },
        "required": ["definition"]
      },
      "ObjectDefinitionSchemaEnvelope": {
        "type": "object",
        "properties": {
          "schema": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "JSON Schema an object’s `data` must satisfy for this definition."
          }
        },
        "required": ["schema"]
      },
      "DataObjectCounts": {
        "type": "object",
        "properties": {
          "counts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "definitionId": {
                  "type": "string"
                },
                "count": {
                  "type": "number",
                  "description": "Live (non-deleted) objects in the space."
                }
              },
              "required": ["definitionId", "count"]
            }
          }
        },
        "required": ["counts"]
      },
      "ObjectOrigin": {
        "description": "Set on create, never patchable.",
        "type": "object",
        "properties": {
          "actionRunId": {
            "type": "string"
          },
          "playbookRunId": {
            "description": "Set only when a playbook dispatched the run; callers cannot claim it.",
            "type": "string"
          }
        }
      },
      "DataObject": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          },
          "definitionId": {
            "type": "string"
          },
          "definitionVersion": {
            "type": "number"
          },
          "data": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Field values keyed by field key."
          },
          "fieldMeta": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "modifiedBy": {
                  "type": "string"
                },
                "modifiedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "source": {
                  "type": "string"
                },
                "locked": {
                  "description": "A locked field refuses writes with 409.",
                  "type": "boolean"
                }
              },
              "required": ["modifiedBy", "modifiedAt"]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "type": "string"
          },
          "updatedBy": {
            "type": "string"
          },
          "deletedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "provenance": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              }
            },
            "description": "Per-field grounding: field key → citation pointers, imported verbatim from the extraction feed."
          },
          "review": {
            "description": "Per-field review state. An approved or rejected field is locked against edits.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "enum": ["pending", "approved", "rejected"]
                },
                "by": {
                  "type": "string"
                },
                "at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "note": {
                  "type": "string"
                }
              },
              "required": ["status", "by", "at"]
            }
          },
          "origin": {
            "$ref": "#/components/schemas/ObjectOrigin"
          }
        },
        "required": [
          "_id",
          "spaceId",
          "definitionId",
          "definitionVersion",
          "data",
          "fieldMeta",
          "createdAt",
          "updatedAt",
          "createdBy",
          "updatedBy",
          "deletedAt"
        ]
      },
      "DataObjectList": {
        "type": "object",
        "properties": {
          "objects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataObject"
            }
          },
          "nextOffset": {
            "description": "Offset of the next page, or null when the list is exhausted.",
            "type": ["number", "null"]
          }
        },
        "required": ["objects", "nextOffset"]
      },
      "ObjectView": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          },
          "definitionId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "isDefault": {
            "type": "boolean",
            "description": "The seeded default view: never renamable, never deletable."
          },
          "filterLogic": {
            "type": "string"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fieldKey": {
                  "type": "string",
                  "minLength": 1
                },
                "isVisible": {
                  "type": "boolean"
                },
                "width": {
                  "type": "number",
                  "minimum": 1
                },
                "position": {
                  "type": "number"
                }
              },
              "required": ["fieldKey", "isVisible", "width", "position"]
            }
          },
          "filters": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fieldKey": {
                  "type": "string",
                  "minLength": 1
                },
                "subField": {
                  "type": "string"
                },
                "operand": {
                  "type": "string",
                  "minLength": 1,
                  "description": "One of the 14 supported operands."
                },
                "value": {}
              },
              "required": ["fieldKey", "operand"]
            }
          },
          "sorts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fieldKey": {
                  "type": "string",
                  "minLength": 1
                },
                "subField": {
                  "type": "string"
                },
                "direction": {
                  "type": "string",
                  "enum": ["asc", "desc"]
                }
              },
              "required": ["fieldKey", "direction"]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "type": "string"
          }
        },
        "required": [
          "_id",
          "spaceId",
          "definitionId",
          "name",
          "isDefault",
          "filterLogic",
          "fields",
          "filters",
          "sorts",
          "createdAt",
          "updatedAt",
          "createdBy"
        ]
      },
      "ObjectViewList": {
        "type": "object",
        "properties": {
          "default": {
            "$ref": "#/components/schemas/ObjectView"
          },
          "views": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ObjectView"
            }
          }
        },
        "required": ["default", "views"]
      },
      "ObjectViewEnvelope": {
        "type": "object",
        "properties": {
          "view": {
            "$ref": "#/components/schemas/ObjectView"
          }
        },
        "required": ["view"]
      },
      "OkEnvelope": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": ["ok"]
      },
      "BatchCreateObjectsResult": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "number"
                },
                "status": {
                  "type": "string",
                  "enum": ["created", "skipped", "duplicate", "invalid"]
                },
                "_id": {
                  "type": "string"
                },
                "fieldKey": {
                  "type": "string"
                },
                "issues": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "fieldKey": {
                        "type": "string"
                      },
                      "message": {
                        "type": "string"
                      }
                    },
                    "required": ["fieldKey", "message"]
                  }
                }
              },
              "required": ["index", "status"]
            }
          },
          "created": {
            "type": "number"
          },
          "skipped": {
            "type": "number"
          },
          "failed": {
            "type": "number"
          }
        },
        "required": ["results", "created", "skipped", "failed"]
      },
      "BatchDeleteObjectsResult": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "number",
            "description": "How many objects the request deleted."
          },
          "ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The ids of the deleted objects. An unknown id is not in this list."
          }
        },
        "required": ["deleted", "ids"]
      },
      "ObjectCountResult": {
        "type": "object",
        "properties": {
          "count": {
            "type": "number",
            "description": "How many live objects match."
          }
        },
        "required": ["count"]
      },
      "DeleteMatchingObjectsResult": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "number",
            "description": "How many objects the request deleted."
          },
          "more": {
            "type": "boolean",
            "description": "True when matching objects can stay. Send the same request again."
          }
        },
        "required": ["deleted", "more"]
      },
      "DataObjectEnvelope": {
        "type": "object",
        "properties": {
          "object": {
            "$ref": "#/components/schemas/DataObject"
          }
        },
        "required": ["object"]
      },
      "GraphEntity": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "example": "organization"
          },
          "name": {
            "type": "string",
            "example": "Acme Inc"
          },
          "key": {
            "description": "Normalized dedupe key.",
            "type": ["string", "null"]
          },
          "mentionCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": ["id", "type", "name", "key", "mentionCount"]
      },
      "GraphEdge": {
        "type": "object",
        "properties": {
          "sourceId": {
            "type": "string"
          },
          "targetId": {
            "type": "string"
          },
          "relation": {
            "type": "string",
            "example": "employed_by"
          },
          "fileId": {
            "type": "string",
            "description": "The file the relation was observed in."
          }
        },
        "required": ["sourceId", "targetId", "relation", "fileId"]
      },
      "OntologyGraph": {
        "type": "object",
        "properties": {
          "entities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GraphEntity"
            }
          },
          "edges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GraphEdge"
            }
          }
        },
        "required": ["entities", "edges"]
      },
      "OntologyBBox": {
        "type": "object",
        "properties": {
          "x": {
            "type": "number"
          },
          "y": {
            "type": "number"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          }
        },
        "required": ["x", "y", "width", "height"],
        "description": "Normalized 0–1, origin top-left."
      },
      "OntologyMention": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string"
          },
          "page": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "0-based page, for documents."
          },
          "bbox": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OntologyBBox"
              },
              {
                "type": "null"
              }
            ]
          },
          "text": {
            "type": "string"
          },
          "startSeconds": {
            "description": "For audio transcripts.",
            "type": ["number", "null"]
          },
          "endSeconds": {
            "type": ["number", "null"]
          },
          "speaker": {
            "type": ["string", "null"]
          }
        },
        "required": ["fileId", "page", "bbox", "text", "startSeconds", "endSeconds", "speaker"]
      },
      "OntologyEntityDetail": {
        "type": "object",
        "properties": {
          "entity": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "example": "organization"
                  },
                  "name": {
                    "type": "string"
                  },
                  "key": {
                    "type": ["string", "null"]
                  }
                },
                "required": ["id", "type", "name", "key"]
              },
              {
                "type": "null"
              }
            ],
            "description": "Null when the id is unknown in this graph."
          },
          "mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OntologyMention"
            }
          }
        },
        "required": ["entity", "mentions"]
      },
      "OntologyRelatedEntities": {
        "type": "object",
        "properties": {
          "entities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "example": "organization"
                },
                "name": {
                  "type": "string"
                },
                "distance": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Hops from the seed entity."
                }
              },
              "required": ["id", "type", "name", "distance"]
            }
          },
          "edges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GraphEdge"
            }
          }
        },
        "required": ["entities", "edges"]
      },
      "OntologyFileEntities": {
        "type": "object",
        "properties": {
          "entities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "example": "organization"
                },
                "name": {
                  "type": "string"
                },
                "mentions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "page": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "0-based page, for documents."
                      },
                      "bbox": {
                        "anyOf": [
                          {
                            "$ref": "#/components/schemas/OntologyBBox"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "text": {
                        "type": "string"
                      },
                      "startSeconds": {
                        "description": "For audio transcripts.",
                        "type": ["number", "null"]
                      },
                      "endSeconds": {
                        "type": ["number", "null"]
                      },
                      "speaker": {
                        "type": ["string", "null"]
                      }
                    },
                    "required": ["page", "bbox", "text", "startSeconds", "endSeconds", "speaker"]
                  }
                }
              },
              "required": ["id", "type", "name", "mentions"]
            }
          }
        },
        "required": ["entities"]
      },
      "OntologyRelatedFiles": {
        "type": "object",
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fileId": {
                  "type": "string"
                },
                "score": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "Count of shared entities; higher ranks first."
                },
                "shared": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "entityId": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string",
                        "example": "organization"
                      }
                    },
                    "required": ["entityId", "name", "type"]
                  }
                }
              },
              "required": ["fileId", "score", "shared"]
            }
          }
        },
        "required": ["files"]
      },
      "OntologyEntitySearchResults": {
        "type": "object",
        "properties": {
          "matches": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "example": "organization"
                },
                "name": {
                  "type": "string"
                },
                "score": {
                  "type": "number",
                  "description": "Similarity in [-1, 1]; higher is closer."
                }
              },
              "required": ["id", "type", "name", "score"]
            }
          }
        },
        "required": ["matches"]
      },
      "OntologyIngestResult": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "namespace": {
                  "type": "string",
                  "description": "The graph level written."
                },
                "status": {
                  "type": "string",
                  "enum": ["ok", "error"]
                },
                "entities": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "mentions": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "edges": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "error": {
                  "type": "string"
                }
              },
              "required": ["namespace", "status", "entities", "mentions", "edges"]
            }
          }
        },
        "required": ["fileId", "results"]
      },
      "ActionRun": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "run_01J…"
          },
          "spaceId": {
            "type": "string"
          },
          "actionSlug": {
            "type": "string",
            "example": "extract-structured"
          },
          "actionVersion": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "installedActionId": {
            "type": "string"
          },
          "configRevision": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "The revision of the saved config the run used. Null on a run created before revisions existed."
          },
          "configOverridden": {
            "type": "boolean",
            "description": "True when inline config changed the saved config for this run."
          },
          "config": {
            "description": "The exact config used by this run, including inline overrides. Returned on the run detail read only.",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "playbookRunId": {
            "type": ["string", "null"]
          },
          "apiRunId": {
            "description": "The id of the `/v1` run that started this run, for example `exr_…`. Absent when the run started another way.",
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["running", "awaiting_input", "done", "failed"]
          },
          "error": {
            "type": ["string", "null"]
          },
          "output": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "description": "The action’s JSON output, when it has one."
          },
          "artifacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "const": "link"
                },
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "open": {
                  "type": "string",
                  "enum": ["tab", "embed"]
                }
              },
              "required": ["id", "kind", "title", "url", "open"]
            },
            "description": "Rendered links. Redacted for callers without `space:contribute`."
          },
          "awaitingInput": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "resolved": {
                  "type": "boolean"
                }
              },
              "required": ["id", "title", "url", "resolved"]
            },
            "description": "Open human steps while the run is `awaiting_input`."
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fileId": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "contentType": {
                  "type": ["string", "null"]
                }
              },
              "required": ["fileId", "name", "contentType"]
            }
          },
          "outputs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fileId": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "key": {
                  "type": "string"
                },
                "size": {
                  "type": "number"
                }
              },
              "required": ["fileId", "kind", "key", "size"]
            },
            "description": "Downloadable byproducts; stream each with the run-output route."
          },
          "timeoutSeconds": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lastEventAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "createdBy": {
            "type": ["string", "null"]
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "spaceId",
          "actionSlug",
          "actionVersion",
          "installedActionId",
          "configRevision",
          "configOverridden",
          "playbookRunId",
          "status",
          "error",
          "output",
          "artifacts",
          "awaitingInput",
          "documents",
          "outputs",
          "timeoutSeconds",
          "lastEventAt",
          "createdAt",
          "createdBy",
          "finishedAt"
        ]
      },
      "ActionRunEnvelope": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/ActionRun"
          }
        },
        "required": ["data"]
      },
      "ActionRunList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActionRun"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": ["data", "has_more"]
      },
      "RunResult": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "runId": {
            "type": "string"
          },
          "actionSlug": {
            "type": "string"
          },
          "unit": {
            "type": "string",
            "enum": ["per_document", "across_documents", "rows_per_document"]
          },
          "fieldKeys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The schema's fields in the order their author set, which is the order to display them in. `data` and `schema.properties` are returned in this order too. A nested object and an array's item schema carry their own order in `x-order`."
          },
          "schema": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ],
            "description": "The applied (or inferred) extraction schema, its properties in the authored order. Each object level also carries that order in `x-order`."
          },
          "docs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "The source fileId, or `merged` for across_documents."
                },
                "name": {
                  "type": "string"
                },
                "contentType": {
                  "type": ["string", "null"]
                },
                "status": {
                  "type": "string",
                  "enum": ["done", "failed"]
                },
                "error": {
                  "type": "string"
                },
                "data": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "evidence": {
                  "description": "Field key → citations backing that value.",
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {},
                      "description": "Carries at least `fileId`, plus grounding (`page`, `bbox`, or timecodes)."
                    }
                  }
                },
                "rows": {
                  "description": "Present for a `rows_per_document` run.",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "data": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {}
                      },
                      "evidence": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {},
                            "description": "Carries at least `fileId`, plus grounding (`page`, `bbox`, or timecodes)."
                          }
                        }
                      }
                    },
                    "required": ["data"]
                  }
                },
                "edited": {
                  "description": "A human has edited this document.",
                  "type": "boolean"
                }
              },
              "required": ["id", "name", "contentType", "status"]
            }
          },
          "evidenceOmitted": {
            "description": "The size guard dropped the citations.",
            "type": "boolean",
            "const": true
          },
          "dataOmitted": {
            "description": "The size guard dropped the values too.",
            "type": "boolean",
            "const": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "version",
          "runId",
          "actionSlug",
          "unit",
          "fieldKeys",
          "schema",
          "docs",
          "createdAt",
          "finishedAt"
        ]
      },
      "PatchRunDocResult": {
        "type": "object",
        "properties": {
          "saved": {
            "type": "boolean"
          },
          "synced": {
            "type": "boolean",
            "description": "False when the durable result was not refreshed. With `changed` or `edited` true, the edit is stored but a later read still returns the old value: save again to publish it. With both false, nothing needed publishing and there is nothing to retry."
          },
          "changed": {
            "type": "boolean",
            "description": "False when nothing in the patch differed."
          },
          "edited": {
            "type": "boolean",
            "description": "The stored document carries a human edit, from this request or an earlier one. Tells a `synced: false` that is waiting to be published apart from one that had nothing to publish."
          },
          "data": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "evidence": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {},
                "description": "Carries at least `fileId`, plus grounding (`page`, `bbox`, or timecodes)."
              }
            }
          }
        },
        "required": ["saved", "synced", "changed", "edited"]
      },
      "PatchRunDocRowResult": {
        "type": "object",
        "properties": {
          "saved": {
            "type": "boolean"
          },
          "synced": {
            "type": "boolean",
            "description": "False when the durable result was not refreshed. With `changed` or `edited` true, the edit is stored but a later read still returns the old value: save again to publish it. With both false, nothing needed publishing and there is nothing to retry."
          },
          "changed": {
            "type": "boolean",
            "description": "False when nothing in the patch differed."
          },
          "edited": {
            "type": "boolean",
            "description": "The stored document carries a human edit, from this request or an earlier one. Tells a `synced: false` that is waiting to be published apart from one that had nothing to publish."
          },
          "data": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "evidence": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {},
                "description": "Carries at least `fileId`, plus grounding (`page`, `bbox`, or timecodes)."
              }
            }
          },
          "row": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Zero-based index of the edited row, echoed back."
          }
        },
        "required": ["saved", "synced", "changed", "edited", "row"]
      },
      "FillTask": {
        "type": "object",
        "properties": {
          "runId": {
            "type": "string"
          },
          "docName": {
            "type": "string"
          },
          "templateFileId": {
            "type": ["string", "null"]
          },
          "outputMode": {
            "type": "string",
            "enum": ["flattened", "editable"]
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": ["text", "checkbox", "radio", "dropdown", "listbox"]
                },
                "label": {
                  "type": ["string", "null"]
                },
                "section": {
                  "type": "string"
                },
                "hint": {
                  "type": "string"
                },
                "required": {
                  "type": "boolean"
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "maxLength": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "multiline": {
                  "type": "boolean"
                },
                "page": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "0-based page the field sits on."
                },
                "order": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "box": {
                  "description": "Widget box in points, origin top-left, measured on the review PDF.",
                  "type": "object",
                  "properties": {
                    "x": {
                      "type": "number"
                    },
                    "y": {
                      "type": "number"
                    },
                    "w": {
                      "type": "number"
                    },
                    "h": {
                      "type": "number"
                    }
                  },
                  "required": ["x", "y", "w", "h"]
                }
              },
              "required": ["name", "type", "label", "required", "page", "order"]
            },
            "description": "The curated, fillable field inventory."
          },
          "values": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "The drafted values, keyed by field name."
          },
          "pageBoxes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "width": {
                  "type": "number"
                },
                "height": {
                  "type": "number"
                }
              },
              "required": ["width", "height"]
            }
          },
          "pageCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "runId",
          "docName",
          "templateFileId",
          "outputMode",
          "fields",
          "values",
          "pageBoxes",
          "pageCount"
        ]
      },
      "SubmitFillTaskResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "const": "done"
              }
            },
            "required": ["status"]
          }
        },
        "required": ["data"]
      },
      "SignEnvelopeView": {
        "type": "object",
        "properties": {
          "envelope": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "runId": {
                "type": "string"
              },
              "docName": {
                "type": "string"
              },
              "docSha256": {
                "type": "string"
              },
              "docSize": {
                "type": "number"
              },
              "status": {
                "type": "string",
                "enum": ["pending", "finalizing", "completed", "failed", "voided"]
              },
              "signatureMode": {
                "type": "string"
              },
              "language": {
                "type": "string",
                "enum": ["en", "fr"]
              },
              "message": {
                "type": ["string", "null"]
              },
              "error": {
                "type": ["string", "null"]
              },
              "outputFileId": {
                "description": "The signed PDF, as a file in the space.",
                "type": ["string", "null"]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "completedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              }
            },
            "required": [
              "id",
              "runId",
              "docName",
              "docSha256",
              "docSize",
              "status",
              "signatureMode",
              "language",
              "message",
              "error",
              "outputFileId",
              "createdAt",
              "completedAt",
              "expiresAt"
            ]
          },
          "signers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "position": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "routingOrder": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "signingGroup": {
                  "type": ["string", "null"]
                },
                "fieldIndex": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "source": {
                  "type": "string",
                  "enum": ["install", "run"]
                },
                "status": {
                  "type": "string",
                  "enum": ["pending", "needs_input", "waiting", "signed", "skipped"]
                },
                "emailVerifiedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "signedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "typedName": {
                  "type": ["string", "null"]
                },
                "lastInvitedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "email",
                "position",
                "source",
                "status",
                "emailVerifiedAt",
                "signedAt",
                "typedName",
                "lastInvitedAt"
              ]
            },
            "description": "Ordered by signing position. Never carries a signing link."
          },
          "cc": {
            "description": "Informed-only recipients, emailed the sealed PDF on completion.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                }
              },
              "required": ["name", "email"]
            }
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "actor": {
                  "type": "string",
                  "description": "Signer name, or `system`."
                },
                "signerId": {
                  "type": ["string", "null"]
                },
                "ip": {
                  "type": ["string", "null"]
                },
                "occurredAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "data": {
                  "anyOf": [
                    {},
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": ["id", "type", "actor", "signerId", "ip", "occurredAt", "data"]
            }
          }
        },
        "required": ["envelope", "signers", "events"]
      },
      "ResendSignerResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "resent": {
                "type": "boolean",
                "const": true
              }
            },
            "required": ["resent"]
          }
        },
        "required": ["data"]
      },
      "VoidEnvelopeResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "voided": {
                "type": "boolean",
                "const": true
              }
            },
            "required": ["voided"]
          }
        },
        "required": ["data"]
      },
      "CreateProcessResponse": {
        "type": "object",
        "properties": {
          "processingId": {
            "type": "string",
            "example": "a1b2c3d4-..."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "statusUrl": {
            "type": "string",
            "example": "/process/a1b2c3d4-..."
          }
        },
        "required": ["processingId", "expiresAt", "statusUrl"]
      },
      "ProcessStatus": {
        "type": "object",
        "properties": {
          "processingId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["preprocessing", "running", "done", "failed", "expired"]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fileId": {
                  "type": "string"
                },
                "fileName": {
                  "type": "string"
                },
                "processingKind": {
                  "type": ["string", "null"]
                },
                "status": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                },
                "content": {
                  "description": "Parsed file content, inlined when `?include=content`."
                }
              },
              "required": ["fileId", "fileName", "processingKind", "status"]
            }
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "runId": {
                  "type": ["string", "null"]
                },
                "installedActionId": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                },
                "result": {
                  "description": "Action result JSON, inlined when `?include=results` once the run is `done`. An extraction action returns the grounded result (`docs[]`, `fieldKeys`, `schema`; `docs[].evidence` only with `?include=evidence`). An action that produces a file — redact, fill, sign, generate, split — returns `{ output, files }`: its own report, plus `output.documentIds` resolved to `{id, name, url}` with ~1h download links. `null` means the action produced no result; a read that FAILED sets `resultError`."
                },
                "resultError": {
                  "description": "The result could not be read (a platform hiccup, not your request). Poll again — the run itself is unaffected. Never returned together with a `result`.",
                  "type": "string"
                }
              },
              "required": ["runId", "installedActionId", "status"]
            }
          }
        },
        "required": ["processingId", "status", "expiresAt", "files", "actions"]
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Check that the API is up",
        "description": "Returns `{ \"status\": \"ok\" }` when the API is serving traffic.\n\nUnauthenticated and cheap — safe to poll from an uptime monitor. It reports reachability only; it does not tell you whether any individual capability is healthy.",
        "responses": {
          "200": {
            "description": "Liveness probe",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "ok"
                    }
                  },
                  "required": ["status"]
                }
              }
            }
          }
        }
      }
    },
    "/process/jwks.json": {
      "get": {
        "operationId": "getProcessJwksJson",
        "tags": ["Process"],
        "summary": "Webhook verification keys",
        "description": "Public JWKS for verifying `x-rk1-signature` on /process webhooks (compact ES256 JWT: claims bind processingId, eventId, type and bodySha256, with a 5-minute exp window).",
        "responses": {
          "200": {
            "description": "JSON Web Key Set (public keys only).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Jwks"
                }
              }
            }
          }
        }
      }
    },
    "/inbound/{orgSlug}/{slug}": {
      "post": {
        "operationId": "receiveTriggerWebhook",
        "tags": ["Trigger Webhooks"],
        "summary": "Receive a signed trigger webhook",
        "description": "Accepts a JSON payload up to 1 MiB, authenticated by Standard Webhooks headers.",
        "parameters": [
          {
            "name": "orgSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 63,
              "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64,
              "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
            }
          },
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The signed delivery was accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "`invalid_payload` — the body could not be read as a signed payload.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The sentence a human reads."
                    },
                    "error_code": {
                      "type": "string",
                      "description": "The stable snake_case branch key."
                    },
                    "issues": {
                      "description": "Per-field detail, present only on a validation failure.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": ["path", "code", "message"]
                      }
                    }
                  },
                  "required": ["error", "error_code"]
                }
              }
            }
          },
          "401": {
            "description": "`invalid_signature` — the signature does not match the signed bytes.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The sentence a human reads."
                    },
                    "error_code": {
                      "type": "string",
                      "description": "The stable snake_case branch key."
                    },
                    "issues": {
                      "description": "Per-field detail, present only on a validation failure.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": ["path", "code", "message"]
                      }
                    }
                  },
                  "required": ["error", "error_code"]
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such webhook address, or its trigger is disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The sentence a human reads."
                    },
                    "error_code": {
                      "type": "string",
                      "description": "The stable snake_case branch key."
                    },
                    "issues": {
                      "description": "Per-field detail, present only on a validation failure.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": ["path", "code", "message"]
                      }
                    }
                  },
                  "required": ["error", "error_code"]
                }
              }
            }
          },
          "409": {
            "description": "`trigger_conflict` — the same delivery id arrived with different bytes; `channel_migration_in_progress` — this address has no committed trigger owner yet.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The sentence a human reads."
                    },
                    "error_code": {
                      "type": "string",
                      "description": "The stable snake_case branch key."
                    },
                    "issues": {
                      "description": "Per-field detail, present only on a validation failure.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": ["path", "code", "message"]
                      }
                    }
                  },
                  "required": ["error", "error_code"]
                }
              }
            }
          },
          "413": {
            "description": "`payload_too_large` — the payload exceeds 1 MiB.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The sentence a human reads."
                    },
                    "error_code": {
                      "type": "string",
                      "description": "The stable snake_case branch key."
                    },
                    "issues": {
                      "description": "Per-field detail, present only on a validation failure.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": ["path", "code", "message"]
                      }
                    }
                  },
                  "required": ["error", "error_code"]
                }
              }
            }
          },
          "503": {
            "description": "`intake_unavailable` — webhook intake is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The sentence a human reads."
                    },
                    "error_code": {
                      "type": "string",
                      "description": "The stable snake_case branch key."
                    },
                    "issues": {
                      "description": "Per-field detail, present only on a validation failure.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": ["path", "code", "message"]
                      }
                    }
                  },
                  "required": ["error", "error_code"]
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/inspect/document/{id}": {
      "get": {
        "operationId": "signingGetInspectDocumentById",
        "tags": ["RakeSign"],
        "summary": "Get inspect document by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "pageCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Pages in the document."
                    },
                    "pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "width": {
                            "type": "number",
                            "description": "Page width in points."
                          },
                          "height": {
                            "type": "number",
                            "description": "Page height in points."
                          }
                        },
                        "required": ["width", "height"]
                      },
                      "description": "Each page in order, for laying out a page you have not rendered yet. Pages in one document can differ in size."
                    },
                    "fields": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": ["signature", "initials", "date"],
                            "description": "The marker this came from: `[Signature N]`, `[Initials N]` or `[Date N]`, or their short forms."
                          },
                          "slot": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "description": "The `N` in the marker. `signers[0]` signs slot 1, `signers[1]` slot 2, matched by position."
                          },
                          "page": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "description": "The page holding the marker, counting from 1."
                          },
                          "marker": {
                            "type": "object",
                            "properties": {
                              "x": {
                                "type": "number",
                                "description": "Distance from the left page edge, 0 to 1."
                              },
                              "y": {
                                "type": "number",
                                "description": "Distance from the top page edge, 0 to 1."
                              },
                              "width": {
                                "type": "number",
                                "description": "Fraction of the page width, 0 to 1."
                              },
                              "height": {
                                "type": "number",
                                "description": "Fraction of the page height, 0 to 1."
                              },
                              "text": {
                                "type": "string",
                                "description": "The marker exactly as it is written in the document, for example `[Signature 1]` or `[S1]`. Name this, not a short form you build yourself, when telling a sender which marker to move: it is the only spelling a search of their PDF will find.",
                                "example": "[Signature 1]"
                              }
                            },
                            "required": ["x", "y", "width", "height", "text"],
                            "description": "The marker itself: how it is written, and where that text sits in the document."
                          },
                          "box": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number",
                                    "description": "Distance from the left page edge, 0 to 1."
                                  },
                                  "y": {
                                    "type": "number",
                                    "description": "Distance from the top page edge, 0 to 1."
                                  },
                                  "width": {
                                    "type": "number",
                                    "description": "Fraction of the page width, 0 to 1."
                                  },
                                  "height": {
                                    "type": "number",
                                    "description": "Fraction of the page height, 0 to 1."
                                  }
                                },
                                "required": ["x", "y", "width", "height"],
                                "description": "A rectangle as a fraction of its page, with the origin at the top-left corner."
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Where the output prints: the seal for a signature, the written text for initials and a date. `null` only when `status` is `off_page`."
                          },
                          "status": {
                            "type": "string",
                            "enum": ["ok", "shrunk", "overlaps_text", "overlaps_field", "off_page"],
                            "description": "How this marker will print.\n\n- `ok`: prints at full size, clear of everything.\n- `shrunk`: prints smaller, either to clear nearby content or to match the other signatures in the document.\n- `overlaps_text`: nothing clears at any corner, so it prints at its smallest over the text beneath. The sender decides whether that is acceptable.\n- `overlaps_field`: it prints over another marker's output, because the two sit close enough that both claim the same space. A date is written in full, so it reaches well past its own marker. A slight clip is not reported, only an overlap taking at least a tenth of the smaller box. This is a warning. Only `overlapsSignature` stops a send.\n- `off_page`: no room on the page at any corner. This status stops a send."
                          },
                          "overlapsSignature": {
                            "type": "boolean",
                            "description": "True when this signature prints over the signature of another marker. Placement has tried every size and corner for both, so no layout keeps them apart. This stops a send: move one of the two markers to its own line. Always false for initials and a date."
                          }
                        },
                        "required": [
                          "kind",
                          "slot",
                          "page",
                          "marker",
                          "box",
                          "status",
                          "overlapsSignature"
                        ]
                      },
                      "description": "Every placeholder marker found in the document, in no particular order. A document with no markers returns an empty array."
                    }
                  },
                  "required": ["pageCount", "pages", "fields"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/inspect": {
      "post": {
        "operationId": "signingPostInspect",
        "tags": ["RakeSign"],
        "summary": "Post inspect",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["file"],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "pageCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Pages in the document."
                    },
                    "pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "width": {
                            "type": "number",
                            "description": "Page width in points."
                          },
                          "height": {
                            "type": "number",
                            "description": "Page height in points."
                          }
                        },
                        "required": ["width", "height"]
                      },
                      "description": "Each page in order, for laying out a page you have not rendered yet. Pages in one document can differ in size."
                    },
                    "fields": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": ["signature", "initials", "date"],
                            "description": "The marker this came from: `[Signature N]`, `[Initials N]` or `[Date N]`, or their short forms."
                          },
                          "slot": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "description": "The `N` in the marker. `signers[0]` signs slot 1, `signers[1]` slot 2, matched by position."
                          },
                          "page": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "description": "The page holding the marker, counting from 1."
                          },
                          "marker": {
                            "type": "object",
                            "properties": {
                              "x": {
                                "type": "number",
                                "description": "Distance from the left page edge, 0 to 1."
                              },
                              "y": {
                                "type": "number",
                                "description": "Distance from the top page edge, 0 to 1."
                              },
                              "width": {
                                "type": "number",
                                "description": "Fraction of the page width, 0 to 1."
                              },
                              "height": {
                                "type": "number",
                                "description": "Fraction of the page height, 0 to 1."
                              },
                              "text": {
                                "type": "string",
                                "description": "The marker exactly as it is written in the document, for example `[Signature 1]` or `[S1]`. Name this, not a short form you build yourself, when telling a sender which marker to move: it is the only spelling a search of their PDF will find.",
                                "example": "[Signature 1]"
                              }
                            },
                            "required": ["x", "y", "width", "height", "text"],
                            "description": "The marker itself: how it is written, and where that text sits in the document."
                          },
                          "box": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number",
                                    "description": "Distance from the left page edge, 0 to 1."
                                  },
                                  "y": {
                                    "type": "number",
                                    "description": "Distance from the top page edge, 0 to 1."
                                  },
                                  "width": {
                                    "type": "number",
                                    "description": "Fraction of the page width, 0 to 1."
                                  },
                                  "height": {
                                    "type": "number",
                                    "description": "Fraction of the page height, 0 to 1."
                                  }
                                },
                                "required": ["x", "y", "width", "height"],
                                "description": "A rectangle as a fraction of its page, with the origin at the top-left corner."
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Where the output prints: the seal for a signature, the written text for initials and a date. `null` only when `status` is `off_page`."
                          },
                          "status": {
                            "type": "string",
                            "enum": ["ok", "shrunk", "overlaps_text", "overlaps_field", "off_page"],
                            "description": "How this marker will print.\n\n- `ok`: prints at full size, clear of everything.\n- `shrunk`: prints smaller, either to clear nearby content or to match the other signatures in the document.\n- `overlaps_text`: nothing clears at any corner, so it prints at its smallest over the text beneath. The sender decides whether that is acceptable.\n- `overlaps_field`: it prints over another marker's output, because the two sit close enough that both claim the same space. A date is written in full, so it reaches well past its own marker. A slight clip is not reported, only an overlap taking at least a tenth of the smaller box. This is a warning. Only `overlapsSignature` stops a send.\n- `off_page`: no room on the page at any corner. This status stops a send."
                          },
                          "overlapsSignature": {
                            "type": "boolean",
                            "description": "True when this signature prints over the signature of another marker. Placement has tried every size and corner for both, so no layout keeps them apart. This stops a send: move one of the two markers to its own line. Always false for initials and a date."
                          }
                        },
                        "required": [
                          "kind",
                          "slot",
                          "page",
                          "marker",
                          "box",
                          "status",
                          "overlapsSignature"
                        ]
                      },
                      "description": "Every placeholder marker found in the document, in no particular order. A document with no markers returns an empty array."
                    }
                  },
                  "required": ["pageCount", "pages", "fields"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents": {
      "get": {
        "operationId": "signingGetDocuments",
        "tags": ["RakeSign"],
        "summary": "Get documents",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "pageSize",
            "description": "Documents per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "description": "Cursor from the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "description": "Filter documents.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "teamId",
            "description": "Filter documents.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "search",
            "description": "Filter documents.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RakeSignDocument"
                      }
                    },
                    "nextCursor": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["items", "nextCursor"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "signingPostDocuments",
        "tags": ["RakeSign"],
        "summary": "Post documents",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "description": "Reuse a key for a retry with the same request body.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "generatedText": {
                    "type": "string",
                    "maxLength": 50000
                  },
                  "generation": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": ["rich", "compose", "docx"]
                      },
                      "markdown": {
                        "type": "string",
                        "maxLength": 50000
                      },
                      "templateId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "styleProfileId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "rendererOptions": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string",
                            "maxLength": 300
                          },
                          "author": {
                            "type": "string",
                            "maxLength": 300
                          },
                          "subject": {
                            "type": "string",
                            "maxLength": 1000
                          },
                          "pageSize": {
                            "type": "string",
                            "enum": ["a4", "us-letter", "a5", "us-legal"]
                          },
                          "fontSize": {
                            "type": "string",
                            "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                          },
                          "logo": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string",
                                "maxLength": 2048,
                                "format": "uri"
                              },
                              "svg": {
                                "type": "string",
                                "maxLength": 262144
                              },
                              "height": {
                                "type": "string",
                                "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                              },
                              "allPages": {
                                "type": "boolean"
                              },
                              "position": {
                                "type": "string",
                                "enum": ["left", "center", "right"]
                              }
                            },
                            "additionalProperties": false
                          },
                          "margins": {
                            "type": "object",
                            "properties": {
                              "otherPages": {
                                "type": "object",
                                "properties": {
                                  "top": {
                                    "type": "string",
                                    "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                                  },
                                  "right": {
                                    "type": "string",
                                    "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                                  },
                                  "bottom": {
                                    "type": "string",
                                    "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                                  },
                                  "left": {
                                    "type": "string",
                                    "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                                  }
                                },
                                "additionalProperties": false
                              },
                              "firstPage": {
                                "type": "object",
                                "properties": {
                                  "top": {
                                    "type": "string",
                                    "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "additionalProperties": false
                          },
                          "header": {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "firstPage": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "lastPage": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "position": {
                                "type": "string",
                                "enum": ["left", "center", "right"]
                              }
                            },
                            "additionalProperties": false
                          },
                          "pageNumbers": {
                            "type": "object",
                            "properties": {
                              "firstPage": {
                                "type": "boolean"
                              },
                              "lastPage": {
                                "type": "boolean"
                              },
                              "format": {
                                "type": "string",
                                "maxLength": 60
                              },
                              "style": {
                                "type": "string",
                                "enum": ["1", "i", "I", "a", "A"]
                              },
                              "position": {
                                "type": "string",
                                "enum": ["left", "center", "right"]
                              }
                            },
                            "additionalProperties": false
                          },
                          "colors": {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "link": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "codeBackground": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "tableHeaderBackground": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "tableHeaderText": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "tableBorder": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "tableStripe": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              }
                            },
                            "additionalProperties": false
                          },
                          "fonts": {
                            "type": "object",
                            "properties": {
                              "body": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "h1": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "h2": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "h3": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "h4": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "tableHeader": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "code": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "additionalProperties": false
                      },
                      "values": {
                        "type": "object",
                        "additionalProperties": {
                          "$ref": "#/components/schemas/SigningJsonValue"
                        }
                      },
                      "schema": {
                        "type": "object",
                        "additionalProperties": {
                          "$ref": "#/components/schemas/SigningJsonValue"
                        }
                      }
                    },
                    "required": ["kind"],
                    "additionalProperties": false
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "teamId": {
                    "nullable": true,
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "privacy": {
                    "type": "string",
                    "enum": ["team", "participants"]
                  },
                  "message": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "signingMode": {
                    "type": "string",
                    "enum": ["manual", "delegated"]
                  },
                  "verification": {
                    "minItems": 1,
                    "maxItems": 2,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string",
                          "enum": ["email", "sms"],
                          "description": "The verification method. email: sends a code by email. sms: sends a code by SMS to the recipient phone number."
                        }
                      },
                      "required": ["method"],
                      "additionalProperties": false
                    },
                    "description": "The checks that each signer and approver must complete. Defaults to email when omitted."
                  },
                  "delegation": {
                    "nullable": true,
                    "type": "object",
                    "properties": {
                      "templateId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "templateVersion": {
                        "type": "integer",
                        "minimum": 0,
                        "exclusiveMinimum": true,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": ["templateId", "templateVersion"],
                    "additionalProperties": false
                  },
                  "placement": {
                    "type": "string",
                    "enum": ["page", "tags", "fields"]
                  },
                  "fields": {
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "signature",
                            "initials",
                            "date",
                            "text",
                            "checkbox",
                            "dropdown",
                            "dateInput",
                            "name",
                            "email"
                          ]
                        },
                        "slot": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 50
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000
                        },
                        "x": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "y": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "width": {
                          "type": "number",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "maximum": 1
                        },
                        "height": {
                          "type": "number",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "maximum": 1
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "options": {
                          "minItems": 1,
                          "maxItems": 50,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          }
                        },
                        "maxLength": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 5000
                        },
                        "defaultValue": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 5000
                            },
                            {
                              "type": "boolean"
                            }
                          ]
                        },
                        "attachmentId": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "localPage": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "maximum": 9007199254740991
                        },
                        "fontSize": {
                          "description": "The text size in points, from 6 to 72. Applies to fields that print text. When absent, the text is 12 points or less, to fit the field height. A value that does not fit the field shrinks to fit.",
                          "type": "number",
                          "minimum": 6,
                          "maximum": 72
                        }
                      },
                      "required": ["id", "kind", "slot", "page", "x", "y", "width", "height"],
                      "additionalProperties": false
                    }
                  },
                  "preparationReviewed": {
                    "type": "boolean"
                  },
                  "cc": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        }
                      },
                      "required": ["name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "language": {
                    "type": "string",
                    "enum": ["en", "fr"]
                  },
                  "expiresInDays": {
                    "type": "number"
                  },
                  "reminders": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "firstAfterDays": {
                        "type": "number"
                      },
                      "repeatEveryDays": {
                        "type": "number"
                      },
                      "expiresBeforeDays": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 30
                      }
                    },
                    "required": ["enabled", "firstAfterDays", "repeatEveryDays"],
                    "additionalProperties": false
                  },
                  "allowReassignment": {
                    "type": "boolean"
                  },
                  "notifications": {
                    "type": "object",
                    "properties": {
                      "sender": {
                        "description": "An email goes to this address when a recipient signs or declines, and when the document is completed. `null` removes it. When absent on a document made in the app, the owner gets the emails.",
                        "nullable": true,
                        "type": "object",
                        "properties": {
                          "email": {
                            "description": "The address that gets the progress emails.",
                            "type": "string",
                            "maxLength": 254,
                            "format": "email",
                            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                          },
                          "language": {
                            "description": "The language of the progress emails. When absent, the document language.",
                            "type": "string",
                            "enum": ["en", "fr"]
                          }
                        },
                        "required": ["email"],
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  },
                  "branding": {
                    "nullable": true,
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "accentColor": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$"
                      }
                    },
                    "required": ["name", "accentColor"],
                    "additionalProperties": false
                  },
                  "brandingId": {
                    "nullable": true,
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "variables": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/SigningJsonValue"
                    }
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "stages": {
                    "maxItems": 25,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "mode": {
                          "type": "string",
                          "enum": ["all", "any"]
                        },
                        "role": {
                          "type": "string",
                          "enum": ["signer", "approver"]
                        },
                        "delayHours": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 2160
                        },
                        "condition": {
                          "type": "object",
                          "properties": {
                            "variable": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100
                            },
                            "operator": {
                              "type": "string",
                              "enum": ["equals", "notEquals"]
                            },
                            "value": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 5000
                                },
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "boolean"
                                },
                                {
                                  "type": "string",
                                  "nullable": true,
                                  "enum": [null]
                                }
                              ]
                            }
                          },
                          "required": ["variable", "operator", "value"],
                          "additionalProperties": false
                        },
                        "recipients": {
                          "minItems": 1,
                          "maxItems": 50,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "name": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "phone": {
                                "description": "The recipient phone number. Drafts can keep an incomplete number. SMS verification requires an E.164 number before sending.",
                                "type": "string",
                                "maxLength": 32
                              },
                              "email": {
                                "type": "string",
                                "maxLength": 254
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "pending",
                                  "awaiting_consent",
                                  "signed",
                                  "approved",
                                  "declined",
                                  "skipped"
                                ]
                              },
                              "signedAt": {
                                "type": "string"
                              },
                              "typedName": {
                                "type": "string"
                              },
                              "locked": {
                                "description": "True when the template of this document sets this recipient. The server ignores this value on input: only the template can set or change a locked recipient.",
                                "type": "boolean"
                              },
                              "phoneLocked": {
                                "description": "True when the template also sets the phone number of a locked recipient. The server ignores this value on input. When false, the sender can add or change the phone number.",
                                "type": "boolean"
                              }
                            },
                            "required": ["id", "name", "email"],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": ["id", "mode", "recipients"],
                      "additionalProperties": false
                    }
                  },
                  "purpose": {
                    "type": "string",
                    "enum": ["template"]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "An existing document for this idempotency key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}": {
      "get": {
        "operationId": "signingGetDocumentsById",
        "tags": ["RakeSign"],
        "summary": "Get documents by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "signingPatchDocumentsById",
        "tags": ["RakeSign"],
        "summary": "Patch documents by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "generatedText": {
                    "type": "string",
                    "maxLength": 50000
                  },
                  "generation": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": ["rich", "compose", "docx"]
                      },
                      "markdown": {
                        "type": "string",
                        "maxLength": 50000
                      },
                      "templateId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "styleProfileId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "rendererOptions": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string",
                            "maxLength": 300
                          },
                          "author": {
                            "type": "string",
                            "maxLength": 300
                          },
                          "subject": {
                            "type": "string",
                            "maxLength": 1000
                          },
                          "pageSize": {
                            "type": "string",
                            "enum": ["a4", "us-letter", "a5", "us-legal"]
                          },
                          "fontSize": {
                            "type": "string",
                            "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                          },
                          "logo": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string",
                                "maxLength": 2048,
                                "format": "uri"
                              },
                              "svg": {
                                "type": "string",
                                "maxLength": 262144
                              },
                              "height": {
                                "type": "string",
                                "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                              },
                              "allPages": {
                                "type": "boolean"
                              },
                              "position": {
                                "type": "string",
                                "enum": ["left", "center", "right"]
                              }
                            },
                            "additionalProperties": false
                          },
                          "margins": {
                            "type": "object",
                            "properties": {
                              "otherPages": {
                                "type": "object",
                                "properties": {
                                  "top": {
                                    "type": "string",
                                    "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                                  },
                                  "right": {
                                    "type": "string",
                                    "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                                  },
                                  "bottom": {
                                    "type": "string",
                                    "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                                  },
                                  "left": {
                                    "type": "string",
                                    "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                                  }
                                },
                                "additionalProperties": false
                              },
                              "firstPage": {
                                "type": "object",
                                "properties": {
                                  "top": {
                                    "type": "string",
                                    "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "additionalProperties": false
                          },
                          "header": {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "firstPage": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "lastPage": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "position": {
                                "type": "string",
                                "enum": ["left", "center", "right"]
                              }
                            },
                            "additionalProperties": false
                          },
                          "pageNumbers": {
                            "type": "object",
                            "properties": {
                              "firstPage": {
                                "type": "boolean"
                              },
                              "lastPage": {
                                "type": "boolean"
                              },
                              "format": {
                                "type": "string",
                                "maxLength": 60
                              },
                              "style": {
                                "type": "string",
                                "enum": ["1", "i", "I", "a", "A"]
                              },
                              "position": {
                                "type": "string",
                                "enum": ["left", "center", "right"]
                              }
                            },
                            "additionalProperties": false
                          },
                          "colors": {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "link": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "codeBackground": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "tableHeaderBackground": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "tableHeaderText": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "tableBorder": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              },
                              "tableStripe": {
                                "nullable": true,
                                "type": "string",
                                "pattern": "^#[0-9a-fA-F]{6}$"
                              }
                            },
                            "additionalProperties": false
                          },
                          "fonts": {
                            "type": "object",
                            "properties": {
                              "body": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "h1": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "h2": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "h3": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "h4": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "tableHeader": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              },
                              "code": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9 ]{2,60}$"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "additionalProperties": false
                      },
                      "values": {
                        "type": "object",
                        "additionalProperties": {
                          "$ref": "#/components/schemas/SigningJsonValue"
                        }
                      },
                      "schema": {
                        "type": "object",
                        "additionalProperties": {
                          "$ref": "#/components/schemas/SigningJsonValue"
                        }
                      }
                    },
                    "required": ["kind"],
                    "additionalProperties": false
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "teamId": {
                    "nullable": true,
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "privacy": {
                    "type": "string",
                    "enum": ["team", "participants"]
                  },
                  "message": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "signingMode": {
                    "type": "string",
                    "enum": ["manual", "delegated"]
                  },
                  "verification": {
                    "minItems": 1,
                    "maxItems": 2,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string",
                          "enum": ["email", "sms"],
                          "description": "The verification method. email: sends a code by email. sms: sends a code by SMS to the recipient phone number."
                        }
                      },
                      "required": ["method"],
                      "additionalProperties": false
                    },
                    "description": "The checks that each signer and approver must complete. Defaults to email when omitted."
                  },
                  "delegation": {
                    "nullable": true,
                    "type": "object",
                    "properties": {
                      "templateId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "templateVersion": {
                        "type": "integer",
                        "minimum": 0,
                        "exclusiveMinimum": true,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": ["templateId", "templateVersion"],
                    "additionalProperties": false
                  },
                  "placement": {
                    "type": "string",
                    "enum": ["page", "tags", "fields"]
                  },
                  "fields": {
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "signature",
                            "initials",
                            "date",
                            "text",
                            "checkbox",
                            "dropdown",
                            "dateInput",
                            "name",
                            "email"
                          ]
                        },
                        "slot": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 50
                        },
                        "page": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 1000
                        },
                        "x": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "y": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "width": {
                          "type": "number",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "maximum": 1
                        },
                        "height": {
                          "type": "number",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "maximum": 1
                        },
                        "label": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "options": {
                          "minItems": 1,
                          "maxItems": 50,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          }
                        },
                        "maxLength": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 5000
                        },
                        "defaultValue": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 5000
                            },
                            {
                              "type": "boolean"
                            }
                          ]
                        },
                        "attachmentId": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "localPage": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "maximum": 9007199254740991
                        },
                        "fontSize": {
                          "description": "The text size in points, from 6 to 72. Applies to fields that print text. When absent, the text is 12 points or less, to fit the field height. A value that does not fit the field shrinks to fit.",
                          "type": "number",
                          "minimum": 6,
                          "maximum": 72
                        }
                      },
                      "required": ["id", "kind", "slot", "page", "x", "y", "width", "height"],
                      "additionalProperties": false
                    }
                  },
                  "preparationReviewed": {
                    "type": "boolean"
                  },
                  "cc": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        }
                      },
                      "required": ["name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "language": {
                    "type": "string",
                    "enum": ["en", "fr"]
                  },
                  "expiresInDays": {
                    "type": "number"
                  },
                  "reminders": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      },
                      "firstAfterDays": {
                        "type": "number"
                      },
                      "repeatEveryDays": {
                        "type": "number"
                      },
                      "expiresBeforeDays": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 30
                      }
                    },
                    "required": ["enabled", "firstAfterDays", "repeatEveryDays"],
                    "additionalProperties": false
                  },
                  "allowReassignment": {
                    "type": "boolean"
                  },
                  "notifications": {
                    "type": "object",
                    "properties": {
                      "sender": {
                        "description": "An email goes to this address when a recipient signs or declines, and when the document is completed. `null` removes it. When absent on a document made in the app, the owner gets the emails.",
                        "nullable": true,
                        "type": "object",
                        "properties": {
                          "email": {
                            "description": "The address that gets the progress emails.",
                            "type": "string",
                            "maxLength": 254,
                            "format": "email",
                            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                          },
                          "language": {
                            "description": "The language of the progress emails. When absent, the document language.",
                            "type": "string",
                            "enum": ["en", "fr"]
                          }
                        },
                        "required": ["email"],
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  },
                  "branding": {
                    "nullable": true,
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "accentColor": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$"
                      }
                    },
                    "required": ["name", "accentColor"],
                    "additionalProperties": false
                  },
                  "brandingId": {
                    "nullable": true,
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "variables": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/SigningJsonValue"
                    }
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "stages": {
                    "maxItems": 25,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "mode": {
                          "type": "string",
                          "enum": ["all", "any"]
                        },
                        "role": {
                          "type": "string",
                          "enum": ["signer", "approver"]
                        },
                        "delayHours": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 2160
                        },
                        "condition": {
                          "type": "object",
                          "properties": {
                            "variable": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 100
                            },
                            "operator": {
                              "type": "string",
                              "enum": ["equals", "notEquals"]
                            },
                            "value": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 5000
                                },
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "boolean"
                                },
                                {
                                  "type": "string",
                                  "nullable": true,
                                  "enum": [null]
                                }
                              ]
                            }
                          },
                          "required": ["variable", "operator", "value"],
                          "additionalProperties": false
                        },
                        "recipients": {
                          "minItems": 1,
                          "maxItems": 50,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              },
                              "name": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "phone": {
                                "description": "The recipient phone number. Drafts can keep an incomplete number. SMS verification requires an E.164 number before sending.",
                                "type": "string",
                                "maxLength": 32
                              },
                              "email": {
                                "type": "string",
                                "maxLength": 254
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "pending",
                                  "awaiting_consent",
                                  "signed",
                                  "approved",
                                  "declined",
                                  "skipped"
                                ]
                              },
                              "signedAt": {
                                "type": "string"
                              },
                              "typedName": {
                                "type": "string"
                              },
                              "locked": {
                                "description": "True when the template of this document sets this recipient. The server ignores this value on input: only the template can set or change a locked recipient.",
                                "type": "boolean"
                              },
                              "phoneLocked": {
                                "description": "True when the template also sets the phone number of a locked recipient. The server ignores this value on input. When false, the sender can add or change the phone number.",
                                "type": "boolean"
                              }
                            },
                            "required": ["id", "name", "email"],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": ["id", "mode", "recipients"],
                      "additionalProperties": false
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "signingDeleteDocumentsById",
        "tags": ["RakeSign"],
        "summary": "Delete documents by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "version",
            "description": "Current document version.",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Draft deleted."
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/upload": {
      "post": {
        "operationId": "signingPostDocumentsByIdUpload",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID upload",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["file"],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "version": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/attachments": {
      "post": {
        "operationId": "signingPostDocumentsByIdAttachments",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID attachments",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["file"],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "version": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "signingPatchDocumentsByIdAttachments",
        "tags": ["RakeSign"],
        "summary": "Patch documents by ID attachments",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  },
                  "ids": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": ["version", "ids"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/prepare": {
      "post": {
        "operationId": "signingPostDocumentsByIdPrepare",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID prepare",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/generate": {
      "post": {
        "operationId": "signingPostDocumentsByIdGenerate",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID generate",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50000
                  }
                },
                "required": ["text"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/send": {
      "post": {
        "operationId": "signingPostDocumentsByIdSend",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID send",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:send.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/remind": {
      "post": {
        "operationId": "signingPostDocumentsByIdRemind",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID remind",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:send.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipientId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/cancel": {
      "post": {
        "operationId": "signingPostDocumentsByIdCancel",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID cancel",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:send.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/duplicate": {
      "post": {
        "operationId": "signingPostDocumentsByIdDuplicate",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID duplicate",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/pdf": {
      "get": {
        "operationId": "signingGetDocumentsByIdPdf",
        "tags": ["RakeSign"],
        "summary": "Get documents by ID pdf",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "signingPages",
            "description": "With `true`, a document that is not completed includes the signing pages that `page` placement adds, as signers see them.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document bytes.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/audit": {
      "get": {
        "operationId": "signingGetDocumentsByIdAudit",
        "tags": ["RakeSign"],
        "summary": "Get documents by ID audit",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "activity": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "at": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": ["id", "at", "text"]
                      }
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "$ref": "#/components/schemas/__schema0"
                        }
                      }
                    },
                    "envelopeId": {
                      "type": "string"
                    }
                  },
                  "required": ["status"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/recipients/{recipientId}/correct": {
      "post": {
        "operationId": "signingPostDocumentsByIdRecipientsByIdCorrect",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID recipients by ID correct",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:send.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "recipientId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 254,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": ["version", "name", "email"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/reports": {
      "get": {
        "operationId": "signingGetReports",
        "tags": ["RakeSign"],
        "summary": "Get reports",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: reports:read, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "teamId",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            }
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignReport"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/reports.csv": {
      "get": {
        "operationId": "signingGetReportsCsv",
        "tags": ["RakeSign"],
        "summary": "Get reports.csv",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: reports:read, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "teamId",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            }
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document bytes.",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/reports/send": {
      "post": {
        "operationId": "signingPostReportsSend",
        "tags": ["RakeSign"],
        "summary": "Post reports send",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: reports:write, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "teamId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "from": {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  "recipientIds": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": ["recipientIds"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sent": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "error": {
                      "type": "string"
                    },
                    "failedRecipients": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          }
                        },
                        "required": ["id", "name", "email"]
                      }
                    }
                  },
                  "required": ["sent"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/templates": {
      "get": {
        "operationId": "signingGetTemplates",
        "tags": ["RakeSign"],
        "summary": "Get templates",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RakeSignTemplate"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "signingPostTemplates",
        "tags": ["RakeSign"],
        "summary": "Post templates",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:write, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "default": "",
                    "type": "string",
                    "maxLength": 2000
                  },
                  "roles": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "locked": {
                          "description": "True: the current recipient of this role always signs it, and documents from the template lock that person. False: the sender chooses the person for each document. When absent, a new template makes the role open, and an update keeps the role as it is. An update from a document keeps a locked role only when its recipient has the same email as the locked person.",
                          "type": "boolean"
                        }
                      },
                      "required": ["id", "label"],
                      "additionalProperties": false
                    }
                  },
                  "cc": {
                    "description": "The emails of the copy recipients that the template keeps. Each document from the template sends a copy to them. When absent, a new template keeps no copy recipient, and an update keeps the copy recipients that the template has now. Each email must be a copy recipient of the document, or of the template when the update has no document.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 254,
                      "format": "email",
                      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                    }
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["documentId", "name"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignTemplate"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/templates/{id}": {
      "get": {
        "operationId": "signingGetTemplatesById",
        "tags": ["RakeSign"],
        "summary": "Get templates by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignTemplate"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "signingPatchTemplatesById",
        "tags": ["RakeSign"],
        "summary": "Patch templates by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:write, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "default": "",
                    "type": "string",
                    "maxLength": 2000
                  },
                  "roles": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "locked": {
                          "description": "True: the current recipient of this role always signs it, and documents from the template lock that person. False: the sender chooses the person for each document. When absent, a new template makes the role open, and an update keeps the role as it is. An update from a document keeps a locked role only when its recipient has the same email as the locked person.",
                          "type": "boolean"
                        }
                      },
                      "required": ["id", "label"],
                      "additionalProperties": false
                    }
                  },
                  "cc": {
                    "description": "The emails of the copy recipients that the template keeps. Each document from the template sends a copy to them. When absent, a new template keeps no copy recipient, and an update keeps the copy recipients that the template has now. Each email must be a copy recipient of the document, or of the template when the update has no document.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 254,
                      "format": "email",
                      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                    }
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignTemplate"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "signingDeleteTemplatesById",
        "tags": ["RakeSign"],
        "summary": "Delete templates by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignTemplate"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/templates/{id}/pdf": {
      "get": {
        "operationId": "signingGetTemplatesByIdPdf",
        "tags": ["RakeSign"],
        "summary": "Get templates by ID pdf",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document bytes.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/templates/{id}/duplicate": {
      "post": {
        "operationId": "signingPostTemplatesByIdDuplicate",
        "tags": ["RakeSign"],
        "summary": "Post templates by ID duplicate",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignTemplate"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/templates/{id}/instantiate": {
      "post": {
        "operationId": "signingPostTemplatesByIdInstantiate",
        "tags": ["RakeSign"],
        "summary": "Post templates by ID instantiate",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:read, documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "description": "Reuse a key for a retry with the same request body.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "preview": {
                    "type": "boolean"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "recipients": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "roleId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "slot": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 50
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        },
                        "phone": {
                          "type": "string",
                          "pattern": "^\\+[1-9]\\d{1,14}$",
                          "description": "The recipient phone number in E.164 format, including the country code and leading plus sign."
                        }
                      },
                      "required": ["name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "variables": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "maxLength": 100
                    },
                    "additionalProperties": {
                      "$ref": "#/components/schemas/__schema0"
                    }
                  },
                  "purpose": {
                    "type": "string",
                    "const": "template"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/contacts": {
      "get": {
        "operationId": "signingGetContacts",
        "tags": ["RakeSign"],
        "summary": "Get contacts",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: contacts:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RakeSignContact"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "signingPostContacts",
        "tags": ["RakeSign"],
        "summary": "Post contacts",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: contacts:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 254,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["name", "email"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignContact"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/signing-groups": {
      "get": {
        "operationId": "signingGetSigningGroups",
        "tags": ["RakeSign"],
        "summary": "Get signing-groups",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: groups:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RakeSignGroup"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "signingPostSigningGroups",
        "tags": ["RakeSign"],
        "summary": "Post signing-groups",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: groups:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "mode": {
                    "default": "all",
                    "type": "string",
                    "enum": ["all", "any"]
                  },
                  "recipients": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        }
                      },
                      "required": ["name", "email"],
                      "additionalProperties": false
                    }
                  }
                },
                "required": ["name", "recipients"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignGroup"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/contacts/{id}": {
      "patch": {
        "operationId": "signingPatchContactsById",
        "tags": ["RakeSign"],
        "summary": "Patch contacts by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: contacts:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 254,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignContact"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "signingDeleteContactsById",
        "tags": ["RakeSign"],
        "summary": "Delete contacts by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: contacts:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignContact"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/signing-groups/{id}": {
      "patch": {
        "operationId": "signingPatchSigningGroupsById",
        "tags": ["RakeSign"],
        "summary": "Patch signing-groups by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: groups:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "mode": {
                    "default": "all",
                    "type": "string",
                    "enum": ["all", "any"]
                  },
                  "recipients": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        }
                      },
                      "required": ["name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignGroup"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "signingDeleteSigningGroupsById",
        "tags": ["RakeSign"],
        "summary": "Delete signing-groups by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: groups:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignGroup"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/people/suggestions": {
      "get": {
        "operationId": "signingGetPeopleSuggestions",
        "tags": ["RakeSign"],
        "summary": "Get people suggestions",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: contacts:read, groups:read, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "contacts": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RakeSignContact"
                      }
                    },
                    "groups": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RakeSignGroup"
                      }
                    },
                    "recent": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          }
                        },
                        "required": ["name", "email"]
                      }
                    },
                    "people": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string"
                          }
                        },
                        "required": ["id", "name", "email", "role"]
                      }
                    },
                    "teams": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "recipients": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "email": {
                                  "type": "string"
                                }
                              },
                              "required": ["name", "email"]
                            }
                          }
                        },
                        "required": ["id", "name", "recipients"]
                      }
                    }
                  },
                  "required": ["contacts", "groups", "recent", "people", "teams"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/comments": {
      "get": {
        "operationId": "signingGetDocumentsByIdComments",
        "tags": ["RakeSign"],
        "summary": "Get documents by ID comments",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RakeSignComment"
                      }
                    },
                    "canComment": {
                      "type": "boolean"
                    }
                  },
                  "required": ["items", "canComment"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "signingPostDocumentsByIdComments",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID comments",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "audience": {
                    "type": "string",
                    "enum": ["internal", "participants"]
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                },
                "required": ["audience", "text"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignComment"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/branding": {
      "get": {
        "operationId": "signingGetBranding",
        "tags": ["RakeSign"],
        "summary": "Get branding",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: branding:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RakeSignBranding"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "signingPostBranding",
        "tags": ["RakeSign"],
        "summary": "Post branding",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: branding:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "accentColor": {
                    "type": "string",
                    "pattern": "^#[0-9a-fA-F]{6}$"
                  },
                  "logoDataUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 44000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "privacy": {
                    "type": "string",
                    "enum": ["participants", "team"]
                  }
                },
                "required": ["name", "accentColor"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignBranding"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/branding/{id}": {
      "patch": {
        "operationId": "signingPatchBrandingById",
        "tags": ["RakeSign"],
        "summary": "Patch branding by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: branding:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "accentColor": {
                    "type": "string",
                    "pattern": "^#[0-9a-fA-F]{6}$"
                  },
                  "logoDataUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 44000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "privacy": {
                    "type": "string",
                    "enum": ["participants", "team"]
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignBranding"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "signingDeleteBrandingById",
        "tags": ["RakeSign"],
        "summary": "Delete branding by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: branding:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignBranding"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/generate-rich": {
      "post": {
        "operationId": "signingPostDocumentsByIdGenerateRich",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID generate-rich",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  },
                  "kind": {
                    "type": "string",
                    "enum": ["rich", "compose", "docx"]
                  },
                  "markdown": {
                    "type": "string",
                    "maxLength": 50000
                  },
                  "templateId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "styleProfileId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "rendererOptions": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "author": {
                        "type": "string",
                        "maxLength": 300
                      },
                      "subject": {
                        "type": "string",
                        "maxLength": 1000
                      },
                      "pageSize": {
                        "type": "string",
                        "enum": ["a4", "us-letter", "a5", "us-legal"]
                      },
                      "fontSize": {
                        "type": "string",
                        "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                      },
                      "logo": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "format": "uri"
                          },
                          "svg": {
                            "type": "string",
                            "maxLength": 262144
                          },
                          "height": {
                            "type": "string",
                            "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                          },
                          "allPages": {
                            "type": "boolean"
                          },
                          "position": {
                            "type": "string",
                            "enum": ["left", "center", "right"]
                          }
                        },
                        "additionalProperties": false
                      },
                      "margins": {
                        "type": "object",
                        "properties": {
                          "otherPages": {
                            "type": "object",
                            "properties": {
                              "top": {
                                "type": "string",
                                "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                              },
                              "right": {
                                "type": "string",
                                "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                              },
                              "bottom": {
                                "type": "string",
                                "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                              },
                              "left": {
                                "type": "string",
                                "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                              }
                            },
                            "additionalProperties": false
                          },
                          "firstPage": {
                            "type": "object",
                            "properties": {
                              "top": {
                                "type": "string",
                                "pattern": "^\\d{1,3}(\\.\\d{1,3})?(pt|mm|cm|in)$"
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "additionalProperties": false
                      },
                      "header": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "firstPage": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "lastPage": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "position": {
                            "type": "string",
                            "enum": ["left", "center", "right"]
                          }
                        },
                        "additionalProperties": false
                      },
                      "pageNumbers": {
                        "type": "object",
                        "properties": {
                          "firstPage": {
                            "type": "boolean"
                          },
                          "lastPage": {
                            "type": "boolean"
                          },
                          "format": {
                            "type": "string",
                            "maxLength": 60
                          },
                          "style": {
                            "type": "string",
                            "enum": ["1", "i", "I", "a", "A"]
                          },
                          "position": {
                            "type": "string",
                            "enum": ["left", "center", "right"]
                          }
                        },
                        "additionalProperties": false
                      },
                      "colors": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "link": {
                            "nullable": true,
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "codeBackground": {
                            "nullable": true,
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "tableHeaderBackground": {
                            "nullable": true,
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "tableHeaderText": {
                            "nullable": true,
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "tableBorder": {
                            "nullable": true,
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          },
                          "tableStripe": {
                            "nullable": true,
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$"
                          }
                        },
                        "additionalProperties": false
                      },
                      "fonts": {
                        "type": "object",
                        "properties": {
                          "body": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9 ]{2,60}$"
                          },
                          "h1": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9 ]{2,60}$"
                          },
                          "h2": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9 ]{2,60}$"
                          },
                          "h3": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9 ]{2,60}$"
                          },
                          "h4": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9 ]{2,60}$"
                          },
                          "tableHeader": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9 ]{2,60}$"
                          },
                          "code": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9 ]{2,60}$"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  },
                  "preview": {
                    "type": "boolean"
                  },
                  "values": {
                    "default": {},
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "schema": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": ["kind"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/generation/templates": {
      "get": {
        "operationId": "signingGetGenerationTemplates",
        "tags": ["RakeSign"],
        "summary": "Get generation templates",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "templates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "schema": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "$ref": "#/components/schemas/__schema0"
                            }
                          },
                          "examples": {
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/__schema1"
                            }
                          }
                        },
                        "required": ["id", "name", "slug", "schema", "examples"]
                      }
                    },
                    "nextCursor": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["templates", "nextCursor"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/generation/styles": {
      "get": {
        "operationId": "signingGetGenerationStyles",
        "tags": ["RakeSign"],
        "summary": "Get generation styles",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "styles": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "isDefault": {
                            "type": "boolean"
                          }
                        },
                        "required": ["id", "name", "isDefault"]
                      }
                    }
                  },
                  "required": ["styles"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/generation/spaces": {
      "get": {
        "operationId": "signingGetGenerationSpaces",
        "tags": ["RakeSign"],
        "summary": "Get generation spaces",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "spaces": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": ["id", "title"]
                      }
                    }
                  },
                  "required": ["spaces"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/generation/definitions": {
      "get": {
        "operationId": "signingGetGenerationDefinitions",
        "tags": ["RakeSign"],
        "summary": "Get generation definitions",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "definitions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "nameSingular": {
                            "type": "string"
                          },
                          "namePlural": {
                            "type": "string"
                          },
                          "labelSingular": {
                            "type": "string"
                          },
                          "labelPlural": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "icon": {
                            "type": "string"
                          },
                          "color": {
                            "type": ["string", "null"]
                          },
                          "labelFieldKey": {
                            "type": "string"
                          },
                          "fields": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "$ref": "#/components/schemas/__schema0"
                              }
                            }
                          },
                          "fieldGroups": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "$ref": "#/components/schemas/__schema0"
                              }
                            }
                          },
                          "version": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "archivedAt": {
                            "type": ["string", "null"]
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "type": "string"
                          },
                          "createdBy": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "_id",
                          "nameSingular",
                          "namePlural",
                          "labelSingular",
                          "labelPlural",
                          "description",
                          "icon",
                          "color",
                          "labelFieldKey",
                          "fields",
                          "fieldGroups",
                          "version",
                          "archivedAt",
                          "createdAt",
                          "updatedAt",
                          "createdBy"
                        ]
                      }
                    }
                  },
                  "required": ["definitions"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/generation/records": {
      "get": {
        "operationId": "signingGetGenerationRecords",
        "tags": ["RakeSign"],
        "summary": "Get generation records",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "objects": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "spaceId": {
                            "type": "string"
                          },
                          "definitionId": {
                            "type": "string"
                          },
                          "definitionVersion": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "data": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "$ref": "#/components/schemas/__schema0"
                            }
                          },
                          "fieldMeta": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "$ref": "#/components/schemas/__schema0"
                            }
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "type": "string"
                          },
                          "createdBy": {
                            "type": "string"
                          },
                          "updatedBy": {
                            "type": "string"
                          },
                          "deletedAt": {
                            "type": ["string", "null"]
                          },
                          "provenance": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "$ref": "#/components/schemas/__schema0"
                            }
                          },
                          "review": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "$ref": "#/components/schemas/__schema0"
                            }
                          },
                          "origin": {
                            "type": "object",
                            "properties": {
                              "actionRunId": {
                                "type": "string"
                              },
                              "playbookRunId": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "required": [
                          "_id",
                          "spaceId",
                          "definitionId",
                          "definitionVersion",
                          "data",
                          "fieldMeta",
                          "createdAt",
                          "updatedAt",
                          "createdBy",
                          "updatedBy",
                          "deletedAt"
                        ]
                      }
                    },
                    "nextOffset": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "guarded": {
                      "type": "boolean"
                    }
                  },
                  "required": ["objects", "nextOffset"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/map-record": {
      "post": {
        "operationId": "signingPostDocumentsByIdMapRecord",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID map-record",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  },
                  "spaceId": {
                    "type": "string"
                  },
                  "definitionId": {
                    "type": "string"
                  },
                  "objectId": {
                    "type": "string"
                  },
                  "mappings": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "string"
                        },
                        "to": {
                          "type": "string"
                        }
                      },
                      "required": ["from", "to"]
                    }
                  }
                },
                "required": ["version", "spaceId", "definitionId", "objectId", "mappings"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "values": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "$ref": "#/components/schemas/__schema0"
                      }
                    },
                    "source": {
                      "type": "object",
                      "properties": {
                        "spaceId": {
                          "type": "string"
                        },
                        "definitionId": {
                          "type": "string"
                        },
                        "objectId": {
                          "type": "string"
                        }
                      },
                      "required": ["spaceId", "definitionId", "objectId"]
                    }
                  },
                  "required": ["values", "source"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/word": {
      "get": {
        "operationId": "signingGetDocumentsByIdWord",
        "tags": ["RakeSign"],
        "summary": "Get documents by ID word",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document bytes.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "signingPostDocumentsByIdWord",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID word",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["file", "version"],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "version": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/supporting-document": {
      "post": {
        "operationId": "signingPostDocumentsByIdSupportingDocument",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID supporting-document",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["file", "version"],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "version": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "signingGetDocumentsByIdSupportingDocument",
        "tags": ["RakeSign"],
        "summary": "Get documents by ID supporting-document",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document bytes.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/extraction": {
      "get": {
        "operationId": "signingGetDocumentsByIdExtraction",
        "tags": ["RakeSign"],
        "summary": "Get documents by ID extraction",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["processing", "ready", "extracting", "review", "accepted", "failed"]
                    },
                    "fileId": {
                      "type": "string"
                    },
                    "fileName": {
                      "type": "string"
                    },
                    "runId": {
                      "type": "string"
                    },
                    "values": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "$ref": "#/components/schemas/__schema0"
                      }
                    },
                    "evidence": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "$ref": "#/components/schemas/__schema0"
                      }
                    },
                    "error": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": ["version"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "signingPostDocumentsByIdExtraction",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID extraction",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/extraction/accept": {
      "post": {
        "operationId": "signingPostDocumentsByIdExtractionAccept",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID extraction accept",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: documents:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  },
                  "values": {
                    "type": "object",
                    "additionalProperties": {
                      "$ref": "#/components/schemas/SigningJsonValue"
                    }
                  }
                },
                "required": ["version", "values"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignDocument"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/archive-destinations": {
      "get": {
        "operationId": "signingGetArchiveDestinations",
        "tags": ["RakeSign"],
        "summary": "Get archive-destinations",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: archive:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": ["id", "title"]
                      }
                    }
                  },
                  "required": ["items"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/archives": {
      "get": {
        "operationId": "signingGetDocumentsByIdArchives",
        "tags": ["RakeSign"],
        "summary": "Get documents by ID archives",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: archive:read, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RakeSignArchive"
                      }
                    }
                  },
                  "required": ["items"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/archive": {
      "post": {
        "operationId": "signingPostDocumentsByIdArchive",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID archive",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: archive:write, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "destinationSpaceId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "confirmDisclosure": {
                    "type": "boolean",
                    "enum": [true]
                  }
                },
                "required": ["destinationSpaceId", "confirmDisclosure"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignArchive"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/documents/{id}/archive-settings": {
      "post": {
        "operationId": "signingPostDocumentsByIdArchiveSettings",
        "tags": ["RakeSign"],
        "summary": "Post documents by ID archive-settings",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: archive:write, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "destinationSpaceId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "confirmDisclosure": {
                    "type": "boolean",
                    "enum": [true]
                  }
                },
                "required": ["version", "enabled"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "document": {
                      "$ref": "#/components/schemas/RakeSignDocument"
                    }
                  },
                  "required": ["document"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/jobs": {
      "get": {
        "operationId": "signingGetJobs",
        "tags": ["RakeSign"],
        "summary": "Get jobs",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: jobs:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string",
              "enum": ["report", "bulk", "archive", "form"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RakeSignJob"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/jobs/{id}": {
      "get": {
        "operationId": "signingGetJobsById",
        "tags": ["RakeSign"],
        "summary": "Get jobs by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: jobs:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignJob"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/jobs/{id}/pause": {
      "post": {
        "operationId": "signingPostJobsByIdPause",
        "tags": ["RakeSign"],
        "summary": "Post jobs by ID pause",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: jobs:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignJob"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/jobs/{id}/resume": {
      "post": {
        "operationId": "signingPostJobsByIdResume",
        "tags": ["RakeSign"],
        "summary": "Post jobs by ID resume",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: jobs:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignJob"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/jobs/{id}/retry": {
      "post": {
        "operationId": "signingPostJobsByIdRetry",
        "tags": ["RakeSign"],
        "summary": "Post jobs by ID retry",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: jobs:write.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignJob"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/bulk/preview": {
      "post": {
        "operationId": "signingPostBulkPreview",
        "tags": ["RakeSign"],
        "summary": "Post bulk preview",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: templates:read, jobs:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "templateId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "templateVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "csv": {
                    "type": "string",
                    "maxLength": 256000
                  },
                  "mapping": {
                    "type": "object",
                    "properties": {
                      "nameColumn": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "emailColumn": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "requesterSlot": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 50
                      },
                      "requesterRoleId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "variables": {
                        "default": {},
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      }
                    },
                    "required": ["nameColumn", "emailColumn", "requesterSlot"],
                    "additionalProperties": false
                  }
                },
                "required": ["templateId", "csv", "mapping"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "name": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "variables": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "$ref": "#/components/schemas/__schema0"
                            }
                          },
                          "errors": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": ["index", "name", "email", "variables", "errors"]
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "valid": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "invalid": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "template": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": ["id", "title", "version"]
                    }
                  },
                  "required": ["rows", "total", "valid", "invalid", "template"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/bulk/jobs": {
      "post": {
        "operationId": "signingPostBulkJobs",
        "tags": ["RakeSign"],
        "summary": "Post bulk jobs",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: jobs:write, templates:read, documents:write, documents:send.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "templateId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "templateVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "requesterSlot": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  },
                  "requesterRoleId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "rows": {
                    "minItems": 1,
                    "maxItems": 250,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        },
                        "variables": {
                          "default": {},
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "additionalProperties": {
                            "$ref": "#/components/schemas/__schema0"
                          }
                        }
                      },
                      "required": ["name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "fixedRecipients": {
                    "default": [],
                    "maxItems": 49,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "roleId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "slot": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 50
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        }
                      },
                      "required": ["slot", "name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "confirmCount": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200
                  }
                },
                "required": [
                  "templateId",
                  "templateVersion",
                  "requesterSlot",
                  "rows",
                  "confirmCount",
                  "idempotencyKey"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignJob"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/forms": {
      "get": {
        "operationId": "signingGetForms",
        "tags": ["RakeSign"],
        "summary": "Get forms",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: forms:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RakeSignForm"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "signingPostForms",
        "tags": ["RakeSign"],
        "summary": "Post forms",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: forms:write, templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "default": "",
                    "type": "string",
                    "maxLength": 2000
                  },
                  "templateId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^[\\w-]+$"
                  },
                  "requesterRoleId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^[\\w-]+$"
                  },
                  "fixedRecipients": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "roleId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100,
                          "pattern": "^[\\w-]+$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        }
                      },
                      "required": ["roleId", "name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "inputs": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100,
                          "pattern": "^[a-zA-Z][\\w.-]*$"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "type": {
                          "type": "string",
                          "enum": ["text", "number", "boolean", "date", "table"]
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "columns": {
                          "maxItems": 20,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100,
                            "pattern": "^[a-zA-Z][\\w.-]*$"
                          }
                        }
                      },
                      "required": ["key", "label", "type", "required"],
                      "additionalProperties": false
                    }
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["name", "templateId", "requesterRoleId", "fixedRecipients", "inputs"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignForm"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/forms/{id}": {
      "get": {
        "operationId": "signingGetFormsById",
        "tags": ["RakeSign"],
        "summary": "Get forms by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: forms:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignForm"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "signingPutFormsById",
        "tags": ["RakeSign"],
        "summary": "Put forms by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: forms:write, templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "default": "",
                    "type": "string",
                    "maxLength": 2000
                  },
                  "templateId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^[\\w-]+$"
                  },
                  "requesterRoleId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^[\\w-]+$"
                  },
                  "fixedRecipients": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "roleId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100,
                          "pattern": "^[\\w-]+$"
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        }
                      },
                      "required": ["roleId", "name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "inputs": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100,
                          "pattern": "^[a-zA-Z][\\w.-]*$"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "type": {
                          "type": "string",
                          "enum": ["text", "number", "boolean", "date", "table"]
                        },
                        "required": {
                          "type": "boolean"
                        },
                        "columns": {
                          "maxItems": 20,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100,
                            "pattern": "^[a-zA-Z][\\w.-]*$"
                          }
                        }
                      },
                      "required": ["key", "label", "type", "required"],
                      "additionalProperties": false
                    }
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["name", "templateId", "requesterRoleId", "fixedRecipients", "inputs"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignForm"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/forms/{id}/publish": {
      "post": {
        "operationId": "signingPostFormsByIdPublish",
        "tags": ["RakeSign"],
        "summary": "Post forms by ID publish",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: forms:write, documents:write, documents:send, templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignForm"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/forms/{id}/revoke": {
      "post": {
        "operationId": "signingPostFormsByIdRevoke",
        "tags": ["RakeSign"],
        "summary": "Post forms by ID revoke",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: forms:write, templates:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignForm"
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/report-schedules": {
      "get": {
        "operationId": "signingGetReportSchedules",
        "tags": ["RakeSign"],
        "summary": "Get report-schedules",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: reports:read, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schedules": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RakeSignJob"
                      }
                    }
                  },
                  "required": ["schedules"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "signingPostReportSchedules",
        "tags": ["RakeSign"],
        "summary": "Post report-schedules",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: reports:write, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cadence": {
                    "type": "string",
                    "enum": ["daily", "weekly"]
                  },
                  "time": {
                    "type": "string",
                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                  },
                  "timeZone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "weekday": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 6
                  },
                  "recipientIds": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "filters": {
                    "default": {},
                    "type": "object",
                    "properties": {
                      "teamId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "from": {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                      },
                      "to": {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 128
                  }
                },
                "required": [
                  "cadence",
                  "time",
                  "timeZone",
                  "recipientIds",
                  "name",
                  "idempotencyKey"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schedule": {
                      "$ref": "#/components/schemas/RakeSignJob"
                    }
                  },
                  "required": ["schedule"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/report-schedules/{id}": {
      "patch": {
        "operationId": "signingPatchReportSchedulesById",
        "tags": ["RakeSign"],
        "summary": "Patch report-schedules by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: reports:write, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cadence": {
                    "type": "string",
                    "enum": ["daily", "weekly"]
                  },
                  "time": {
                    "type": "string",
                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                  },
                  "timeZone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "weekday": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 6
                  },
                  "recipientIds": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "filters": {
                    "type": "object",
                    "properties": {
                      "teamId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "from": {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                      },
                      "to": {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "status": {
                    "type": "string",
                    "enum": ["scheduled", "paused"]
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schedule": {
                      "$ref": "#/components/schemas/RakeSignJob"
                    }
                  },
                  "required": ["schedule"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "signingDeleteReportSchedulesById",
        "tags": ["RakeSign"],
        "summary": "Delete report-schedules by ID",
        "description": "Uses the same resource permissions and lifecycle as the RakeSign application. Integration access is limited to its shared team. Required scopes: reports:write, documents:read.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authorized signing resource.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    }
                  },
                  "required": ["deleted"]
                }
              }
            }
          },
          "400": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "401": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "403": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "404": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "409": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The request could not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RakeSignApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/signing/delegations": {
      "get": {
        "operationId": "listSigningDelegations",
        "tags": ["Signing delegations"],
        "summary": "List signing delegations",
        "responses": {
          "200": {
            "description": "Delegation grants available to the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SigningDelegation"
                      }
                    },
                    "nextCursor": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["items", "nextCursor"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "templateId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "teamId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": ["pending", "active", "declined", "revoked"]
            }
          }
        ]
      },
      "post": {
        "operationId": "requestSigningDelegation",
        "tags": ["Signing delegations"],
        "summary": "Request standing consent for a saved template revision",
        "responses": {
          "201": {
            "description": "The grant. A human must accept before it becomes active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningDelegation"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestSigningDelegation"
              }
            }
          }
        }
      }
    },
    "/v1/signing/delegations/{id}": {
      "get": {
        "operationId": "getSigningDelegation",
        "tags": ["Signing delegations"],
        "summary": "Read consent evidence and signature history",
        "responses": {
          "200": {
            "description": "The grant and the document history available to the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningDelegationDetail"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/signing/delegations/{id}/resend": {
      "post": {
        "operationId": "resendSigningDelegation",
        "tags": ["Signing delegations"],
        "summary": "Resend a signing delegation",
        "responses": {
          "200": {
            "description": "The current grant. Renewal requires a new human consent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningDelegation"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/signing/delegations/{id}/revoke": {
      "post": {
        "operationId": "revokeSigningDelegation",
        "tags": ["Signing delegations"],
        "summary": "Revoke a signing delegation",
        "responses": {
          "200": {
            "description": "The current grant. Renewal requires a new human consent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningDelegation"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/signing/delegations/{id}/renew": {
      "post": {
        "operationId": "renewSigningDelegation",
        "tags": ["Signing delegations"],
        "summary": "Renew a signing delegation",
        "requestBody": {
          "required": true,
          "description": "Explain why the signer receives a new consent request.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 1000
                  }
                },
                "required": ["reason"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The current grant. Renewal requires a new human consent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningDelegation"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/signing/webhooks": {
      "get": {
        "operationId": "listSigningWebhooks",
        "tags": ["Signing webhooks"],
        "summary": "List team signing webhooks",
        "responses": {
          "200": {
            "description": "Accessible webhooks.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri"
                          },
                          "teamId": {
                            "type": "string"
                          },
                          "events": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "document.sent",
                                "document.completed",
                                "document.declined",
                                "document.expired",
                                "document.cancelled",
                                "document.failed",
                                "recipient.viewed",
                                "recipient.signed",
                                "recipient.approved",
                                "recipient.declined",
                                "delegation.requested",
                                "delegation.granted",
                                "delegation.declined",
                                "delegation.revoked",
                                "delegation.contested"
                              ]
                            }
                          },
                          "disabled": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "url",
                          "teamId",
                          "events",
                          "disabled",
                          "createdAt",
                          "updatedAt"
                        ]
                      }
                    }
                  },
                  "required": ["items"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createSigningWebhook",
        "tags": ["Signing webhooks"],
        "summary": "Subscribe to team signing events",
        "responses": {
          "201": {
            "description": "Webhook created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "teamId": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "document.sent",
                          "document.completed",
                          "document.declined",
                          "document.expired",
                          "document.cancelled",
                          "document.failed",
                          "recipient.viewed",
                          "recipient.signed",
                          "recipient.approved",
                          "recipient.declined",
                          "delegation.requested",
                          "delegation.granted",
                          "delegation.declined",
                          "delegation.revoked",
                          "delegation.contested"
                        ]
                      }
                    },
                    "disabled": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "url",
                    "teamId",
                    "events",
                    "disabled",
                    "createdAt",
                    "updatedAt"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  },
                  "teamId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "events": {
                    "minItems": 1,
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "document.sent",
                        "document.completed",
                        "document.declined",
                        "document.expired",
                        "document.cancelled",
                        "document.failed",
                        "recipient.viewed",
                        "recipient.signed",
                        "recipient.approved",
                        "recipient.declined",
                        "delegation.requested",
                        "delegation.granted",
                        "delegation.declined",
                        "delegation.revoked",
                        "delegation.contested"
                      ]
                    }
                  },
                  "disabled": {
                    "type": "boolean"
                  }
                },
                "required": ["url", "teamId", "events"],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/v1/signing/webhooks/{id}": {
      "patch": {
        "operationId": "updateSigningWebhook",
        "tags": ["Signing webhooks"],
        "summary": "Update or pause a signing webhook",
        "responses": {
          "200": {
            "description": "Updated webhook.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "teamId": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "document.sent",
                          "document.completed",
                          "document.declined",
                          "document.expired",
                          "document.cancelled",
                          "document.failed",
                          "recipient.viewed",
                          "recipient.signed",
                          "recipient.approved",
                          "recipient.declined",
                          "delegation.requested",
                          "delegation.granted",
                          "delegation.declined",
                          "delegation.revoked",
                          "delegation.contested"
                        ]
                      }
                    },
                    "disabled": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "url",
                    "teamId",
                    "events",
                    "disabled",
                    "createdAt",
                    "updatedAt"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  },
                  "events": {
                    "minItems": 1,
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "document.sent",
                        "document.completed",
                        "document.declined",
                        "document.expired",
                        "document.cancelled",
                        "document.failed",
                        "recipient.viewed",
                        "recipient.signed",
                        "recipient.approved",
                        "recipient.declined",
                        "delegation.requested",
                        "delegation.granted",
                        "delegation.declined",
                        "delegation.revoked",
                        "delegation.contested"
                      ]
                    }
                  },
                  "disabled": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteSigningWebhook",
        "tags": ["Signing webhooks"],
        "summary": "Delete a signing webhook",
        "responses": {
          "204": {
            "description": "Webhook deleted."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/signing/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "listSigningWebhookDeliveries",
        "tags": ["Signing webhooks"],
        "summary": "List signing webhook delivery attempts",
        "responses": {
          "200": {
            "description": "Recent attempts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "endpointId": {
                            "type": "string"
                          },
                          "eventId": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "document.sent",
                              "document.completed",
                              "document.declined",
                              "document.expired",
                              "document.cancelled",
                              "document.failed",
                              "recipient.viewed",
                              "recipient.signed",
                              "recipient.approved",
                              "recipient.declined",
                              "delegation.requested",
                              "delegation.granted",
                              "delegation.declined",
                              "delegation.revoked",
                              "delegation.contested"
                            ]
                          },
                          "attempt": {
                            "type": "number"
                          },
                          "responseStatus": {
                            "type": ["number", "null"]
                          },
                          "ok": {
                            "type": "boolean"
                          },
                          "at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "endpointId",
                          "eventId",
                          "type",
                          "attempt",
                          "responseStatus",
                          "ok",
                          "at"
                        ]
                      }
                    },
                    "nextCursor": {
                      "type": "null"
                    }
                  },
                  "required": ["items", "nextCursor"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/signing/webhooks/{id}/deliveries/{eventId}/replay": {
      "post": {
        "operationId": "replaySigningWebhook",
        "tags": ["Signing webhooks"],
        "summary": "Replay a signing webhook event",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "description": "Reuse this key when retrying the same replay request.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "eventId",
            "required": true
          }
        ],
        "responses": {
          "202": {
            "description": "Replay scheduled.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "boolean",
                      "const": true
                    },
                    "eventId": {
                      "type": "string"
                    }
                  },
                  "required": ["accepted", "eventId"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/jwks.json": {
      "get": {
        "operationId": "webhookJwks",
        "tags": ["Webhooks"],
        "summary": "Webhook verification keys",
        "description": "Serves the public keys you verify webhook delivery signatures against.\n\nEvery delivery carries an `x-rk1-signature` header: a compact ES256 JWT whose claims bind the run id, `eventId`, event `type` and a `bodySha256` of the payload, inside a 5-minute `exp` window. Verify the signature with these keys and compare `bodySha256` to the body you received.\n\nThis route needs no authentication — key material is public by definition. It is the stable alias, serving the same keys as the older `/process/jwks.json`.\n\n**Learn more:** [Webhooks guide](https://docs.cloudraker.com/developers/webhooks)",
        "responses": {
          "200": {
            "description": "JSON Web Key Set (public keys only).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Jwks"
                }
              }
            }
          }
        }
      }
    },
    "/v1/automations/{ref}/trigger": {
      "post": {
        "operationId": "triggerAutomation",
        "tags": ["Automations"],
        "summary": "Fire an automation with a signed request",
        "description": "Fires an automation from your own stack (Zapier, GitHub Actions, an internal cron). The agent answers in a real thread your team can join, with the same approval gate as any other run — a proposed action still waits for a human.\n\nAuthentication is a per-automation HMAC, not an API key: send `x-rk1-trigger-signature: t=<unix-seconds>,v1=<hex hmac-sha256(\"<t>.<raw body>\", secret)>`. The secret is shown once when the automation is created and can be rotated. Requests more than 5 minutes old are rejected. Body: `{}` or `{ \"input\": <json ≤ 8 KiB> }`, which is rendered into the message the agent receives.\n\nA run already live in the automation’s thread answers `busy` (the slot is skipped, never duplicated); one parked on an approval answers `needs_input`.\n\nAn automation that has moved to the trigger surface keeps answering this URL, in this same envelope. Its fire is accepted and queued, so it answers `started` with `runId: null`; where `runId` is present it names the work session (`ws_…`) the fire opened, not a thread run.",
        "responses": {
          "200": {
            "description": "The fire outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationFire"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request` — body over 8 KiB or not JSON."
          },
          "401": {
            "description": "`unauthorized` — missing, bad or replayed signature."
          },
          "404": {
            "description": "`not_found` — unknown reference, or the automation or its trigger is off."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "ref",
            "required": true
          }
        ]
      }
    },
    "/v1/triggers/{ref}/fire": {
      "post": {
        "operationId": "fireSignedTrigger",
        "tags": ["Triggers"],
        "summary": "Run a trigger with a signed request",
        "description": "Send x-rk1-trigger-signature with t=<unix-seconds>,v1=<HMAC-SHA256 of t.rawBody>. The reference is tenantSlug.organizationId.triggerId. The signature expires after five minutes. Identical signed requests share one delivery. Use the secret shown when the trigger was created or rotated.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The existing delivery outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["queued", "opened", "busy", "needs_input", "blocked", "error"]
                        },
                        "sessionId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        },
                        "message": {
                          "type": "string",
                          "maxLength": 1000
                        },
                        "deliveryId": {
                          "type": "string"
                        }
                      },
                      "required": ["status", "deliveryId"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "202": {
            "description": "The queued delivery.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["queued", "opened", "busy", "needs_input", "blocked", "error"]
                        },
                        "sessionId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        },
                        "message": {
                          "type": "string",
                          "maxLength": 1000
                        },
                        "deliveryId": {
                          "type": "string"
                        }
                      },
                      "required": ["status", "deliveryId"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "401": {
            "description": "The signature is missing, invalid, or expired."
          },
          "404": {
            "description": "The trigger is unavailable."
          },
          "413": {
            "description": "The request exceeds 16 KiB."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "ref",
            "required": true
          }
        ]
      }
    },
    "/v1/extract": {
      "post": {
        "operationId": "extract",
        "summary": "Extract structured data from documents",
        "description": "Runs JSON-Schema extraction with per-field citations over one or more files.\n\nSend exactly one of `file` or `files`, and at most one output shape:\n\n- **`schema`** — an inline JSON Schema object, written in the [extraction schema dialect](https://docs.cloudraker.com/capabilities/extract/schema).\n- **`action`** — a [saved action](https://docs.cloudraker.com/api/cloud-raker-api/actions/get-action) by id or slug. Inline config fields (`instructions`, `unit`, `judge`, …) are merged over the saved action's, so one saved action can be refined per call.\n- **neither** — the shape is inferred from the documents themselves. Add `hints` to steer it in prose. The finished run reports what was inferred as `config.schema`, ready to save as an action for the next run.\n\n**What you get back.** `output.value` holds the extracted object for a single-document run, `output.documents[]` one entry per file. Send `citations: true` to ground the result: `output.citations` then maps each extracted field to where it came from — `fileId` plus page and bounding box, or `timecodeStart`/`timecodeEnd` for audio, or `notFound: true` for a value the documents do not contain.\n\nAdd `?output=inline` to include each source file's parsed `markdown` and `json` alongside the extracted value. Signed `markdownUrl` / `jsonUrl` fields remain available; when the combined parsed source exceeds 1 MiB, the response falls back to those URLs only.\n\n```json\n{\n  \"file\": { \"url\": \"https://www.irs.gov/pub/irs-pdf/fw9.pdf\" },\n  \"schema\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"business_name\": { \"type\": [\"string\", \"null\"] },\n      \"tax_classification\": { \"type\": [\"string\", \"null\"] }\n    }\n  }\n}\n```\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Extraction guide](https://docs.cloudraker.com/capabilities/extract) · [Schema dialect](https://docs.cloudraker.com/capabilities/extract/schema)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ExtractRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ExtractBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          },
          {
            "in": "query",
            "name": "output",
            "schema": {
              "default": "urls",
              "type": "string",
              "enum": ["urls", "inline"]
            },
            "description": "How parsed source content is returned.\n\n`urls` returns signed download URLs. `inline` also returns markdown and parsed JSON when their combined payload is at most 1 MiB; larger content falls back to the URLs only."
          }
        ]
      }
    },
    "/v1/extract/batch": {
      "post": {
        "operationId": "extractBatch",
        "summary": "Extract from many files in one call",
        "description": "Runs one saved extraction action over up to 100 files, creating one ordinary run per file.\n\nA batch is fan-out sugar, not a new object: there is no batch id and nothing to poll for the batch as a whole. You get back a run id per file — read each one with [GET /v1/runs/{id}](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run), or list them together with [GET /v1/runs](https://docs.cloudraker.com/api/cloud-raker-api/runs/list-runs) using the `metadata` you attached.\n\n**A saved `action` is required.** Inline `schema` and `hints` are accepted on [POST /v1/extract](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/extract) only — running the same shape over a hundred files is exactly when that shape should be a reviewed, saved asset.\n\n`metadata`, `webhook`, `ttl` and `citations` are copied onto every run, so one webhook endpoint receives all of them and one flag grounds the whole batch.\n\n```json\n{\n  \"action\": \"invoice-fields\",\n  \"files\": [{ \"id\": \"a04d6597-…\" }, { \"url\": \"https://example.com/invoice-2.pdf\" }],\n  \"metadata\": { \"batch\": \"2026-07-25-invoices\" }\n}\n```\n\n**Always asynchronous.** The response is `202` right away. `runs[]` has one entry per file, in the order you sent them: `{id, statusUrl, file}` when the run was created, or `{file, error}` when that one file could not start — the other runs still stand, and `count` reports how many were created.\n\n<Note>\nThe whole batch costs a single request against your rate limit, however many files it fans out to.\n</Note>\n\n**Learn more:** [Extraction guide](https://docs.cloudraker.com/capabilities/extract)",
        "responses": {
          "202": {
            "description": "Accepted — one run per file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ExtractBatchAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request`)."
          },
          "422": {
            "description": "Unusable webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ExtractBatchBody"
              }
            }
          }
        }
      }
    },
    "/v1/parse": {
      "post": {
        "operationId": "parse",
        "summary": "Parse a document or audio file",
        "description": "Turns any document or audio file into clean markdown plus structured JSON — audio becomes a transcript.\n\nNothing else runs: parsing is the whole job, and `output` carries `markdownUrl` and `jsonUrl` (signed, ~1 hour). Add `?output=inline` for a one-call response that also carries `markdown` and parsed `json`. Inline source is capped at 1 MiB across both artifacts; larger output keeps the URLs only. Point `file` at a URL, or at a file you already registered with [POST /v1/files](https://docs.cloudraker.com/api/cloud-raker-api/files/create-file).\n\n**Choosing an engine** with `file.processing`:\n\n| Value | Use it for |\n| --- | --- |\n| `auto` | The default — self-upgrades to OCR when the page is a scan |\n| `ocr` | Force optical character recognition |\n| `simple` | Text-layer only, fastest |\n| `transcribe` | Audio and video |\n| `transcribe_diarize` | Audio and video, with speaker labels |\n\n```json\n{ \"file\": { \"url\": \"https://www.irs.gov/pub/irs-pdf/fw9.pdf\" } }\n```\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Parsing guide](https://docs.cloudraker.com/capabilities/parse)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ParseRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ParseBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          },
          {
            "in": "query",
            "name": "output",
            "schema": {
              "default": "urls",
              "type": "string",
              "enum": ["urls", "inline"]
            },
            "description": "How parsed source content is returned.\n\n`urls` returns signed download URLs. `inline` also returns markdown and parsed JSON when their combined payload is at most 1 MiB; larger content falls back to the URLs only."
          }
        ]
      }
    },
    "/v1/redact": {
      "post": {
        "operationId": "redact",
        "summary": "Permanently redact personal information",
        "description": "Destructively removes personal information from a document or an audio file and returns a new file.\n\nThe removal is real, not cosmetic: text is stripped out of the PDF content stream rather than covered with a black box, and audio is beeped or silenced with its transcript rewritten to match.\n\n**Routing is by the input's media type**, and the parameters are not interchangeable:\n\n- **Documents** — `mode`: `targeted` (default, per-entity boxes) or `lines` (whole lines).\n- **Audio and video** — `style`: `beep` or `silence`.\n\nSending the other medium's parameter is a `400`.\n\n**Choosing what to remove.** `categories` lists what counts as sensitive. A list you send **replaces** the [defaults](https://docs.cloudraker.com/capabilities/redact#what-counts-as-sensitive); it never adds to them, so narrowing the list leaves everything else in the file. `instructions` adds free-form guidance on top.\n\n**Reading the result.** `output.entities` counts what was removed, per category. Its keys are open, not a closed set: a finding your categories do not cover reports under its own label, such as `Passport number` or `MRN`. Iterate the map; never switch on a fixed set of keys. `output.skipped` counts the inputs that held nothing to redact. A skipped input produces no new file, so there is nothing to download for it.\n\n**One file per call.** `file` is singular, and `{ \"files\": […] }` is a `400`. To redact a set in one call, send a [pipeline](https://docs.cloudraker.com/capabilities/pipeline) with a single `{ \"redact\": … }` step.\n\n```json\n{\n  \"file\": { \"id\": \"a04d6597-4e34-4a99-94ea-964c289a4c68\" },\n  \"categories\": [\"ssn\", \"ein\"],\n  \"mode\": \"targeted\"\n}\n```\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Redaction guide](https://docs.cloudraker.com/capabilities/redact)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedactRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RedactBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          }
        ]
      }
    },
    "/v1/fill": {
      "post": {
        "operationId": "fill",
        "summary": "Fill a form from values or source documents",
        "description": "Fills a form PDF and returns the completed file. Send exactly one of `values` or `files`:\n\n- `values` — the field values to write, keyed by field name. Deterministic: no drafting pass, no model call.\n- `files` — source documents the field values are drafted from.\n\n**Pick the form** with `template`, either shape:\n\n- `{ \"id\": \"…\" }` — a saved [template](https://docs.cloudraker.com/api/cloud-raker-api/templates/get-template), or any file you own.\n- `{ \"url\": \"…\" }` — fetched fresh for this run and purged with it.\n\n`template` is optional when `action` names a saved config that carries one; sending it inline still wins.\n\n**Shape the output** with `output`: `flattened` (default) bakes the values in, `editable` leaves the form fillable.\n\n```json\n{\n  \"files\": [{ \"id\": \"a04d6597-4e34-4a99-94ea-964c289a4c68\" }],\n  \"template\": { \"id\": \"23e0a865-0be9-45b1-a491-f1b6bd58a31a\" }\n}\n```\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Form filling guide](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1FillRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1FillBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          }
        ]
      }
    },
    "/v1/sign": {
      "post": {
        "operationId": "sign",
        "summary": "Collect e-signatures on a document",
        "description": "Sends a PDF out for signature and tracks the envelope until every required signing slot is complete.\n\nEach signer verifies their email with a one-time code and signs by typing their name. The completed document gets a signature certificate and a tamper-evident cryptographic seal, and comes back as a new file alongside `output.auditUrl`.\n\n**Where the signatures land** — `placement`:\n\n- `page` (default) — a signature certificate page is appended to the document.\n- `tags` — each required signing slot replaces a `[Signature N]` placeholder. Optional initials and date tags use the same slot number.\n\n**Signing steps** — `routingOrder` defaults to 1 (parallel signing). Later steps wait. People with the same `signingGroup` share one `fieldIndex` slot; the first to sign completes it.\n\n**Keeping others in the loop** — `cc`: informed-only recipients who do not sign. They receive no OTP or signature tag, and are emailed the sealed document when the envelope completes.\n\n**Language** — `language`: `en` (default) or `fr`. Sets the language of every recipient-facing asset — invitation and code emails, the signing page, and the audit certificate — for all signers and CC parties.\n\n**Always asynchronous.** The call returns `202` with `status: \"needs_input\"` as soon as the envelope exists, and stays there until every required signing slot completes.\n\n**Managing the envelope** — every sign response, both the `202` and [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run), carries `envelopeUrl`:\n\n- [GET /v1/runs/{id}/envelope](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run-envelope) — roster and per-signer state.\n- [POST /v1/runs/{id}/signers/{signerId}/resend](https://docs.cloudraker.com/api/cloud-raker-api/runs/resend-run-signer) — issue a fresh link.\n- [POST /v1/runs/{id}/void](https://docs.cloudraker.com/api/cloud-raker-api/runs/void-run-envelope) — kill every pending link.\n\n```json\n{\n  \"file\": { \"id\": \"a04d6597-4e34-4a99-94ea-964c289a4c68\" },\n  \"signers\": [{ \"name\": \"Ada Lovelace\", \"email\": \"ada@example.com\" }],\n  \"cc\": [{ \"name\": \"Charles Babbage\", \"email\": \"charles@example.com\" }],\n  \"message\": \"Please countersign by Friday.\",\n  \"placement\": \"page\",\n  \"language\": \"en\"\n}\n```\n\n<Note>\nSign runs are exempt from the run TTL, so an envelope outlives the 7-day maximum and waits for its signers. Signing links are signer-held secrets and never appear on the sender's API.\n</Note>\n\n**Learn more:** [E-signature guide](https://docs.cloudraker.com/capabilities/sign)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1SignRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1SignBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          }
        ]
      }
    },
    "/v1/classify": {
      "post": {
        "operationId": "classify",
        "summary": "Label documents, or find where each one starts",
        "description": "Classify decides what a file is. [Split](https://docs.cloudraker.com/capabilities/split) cuts it — they are two calls, and this is the only one that runs a model.\n\nSend `classes`: at least two, each an `{id, description}`. The description is the accuracy lever — there is no training data — and the `id` is your branch key, returned untouched. One class is the catch-all; supply `{\"id\": \"other\", …}` or one is injected and echoed back in `config`.\n\n**Two granularities:**\n\n| `granularity` | Answer | Billed |\n| --- | --- | --- |\n| `document` (default) | one label for the whole file | the first and last window only |\n| `page` | one label per page, plus derived `segments[]` | every page |\n\nPage mode is what feeds split: the model marks the first page of each document, and contiguous, non-overlapping `segments[]` are derived from that in code — so two invoices back to back come back as two segments, not one. Pass the run id to [POST /v1/split](https://docs.cloudraker.com/capabilities/split) as `classifyRunId`.\n\n`confidence` is 0–5. A low score never rewrites the label: threshold it yourself, and re-run with a sharper `description` when the model is unsure.\n\n```json\n{\n  \"file\": { \"url\": \"https://acme.example/scans/mail.pdf\" },\n  \"classes\": [\n    { \"id\": \"invoice\", \"description\": \"A bill from a supplier with line items and a total due.\" },\n    { \"id\": \"contract\", \"description\": \"A signed agreement with clauses and signature blocks.\" }\n  ],\n  \"granularity\": \"page\"\n}\n```\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Classification guide](https://docs.cloudraker.com/capabilities/classify)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ClassifyRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`classes_required`, `duplicate_class_id`, `too_many_classes`, `config_too_large`, `page_limit_exceeded`, `capability_mismatch`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ClassifyBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          }
        ]
      }
    },
    "/v1/split": {
      "post": {
        "operationId": "split",
        "summary": "Cut a PDF into child files by page range",
        "description": "[Classify](https://docs.cloudraker.com/capabilities/classify) decides. Split cuts — it runs no model, has no classes and no configuration.\n\n**PDF only.** Office, image, audio and video inputs fail the run with `unsupported_split_source`.\n\nSend exactly one of:\n\n- `segments` — your own ranges, 1-based inclusive, ascending, non-overlapping, at most 100. Gaps are allowed. This path costs no model call at all.\n- `classifyRunId` — a page-mode classify run on the same file. Its `segments[]` are used as-is, with `classId` and `confidence` echoed onto each child.\n\nEach child is a real file with its own `fileId`, ready for [POST /v1/extract](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/extract); `output.documentIds` is the same list flattened. Children inherit the parent's `metadata`, gain `metadata.parentRunId`, land in the parent's space and share the run's TTL — call [keep](https://docs.cloudraker.com/api/cloud-raker-api/runs/keep-run) to move parent and children together.\n\nSend `materialize: false` to get the ranges back without creating anything: the safe first call on a large packet.\n\n```json\n{\n  \"file\": { \"id\": \"file_01K3F…\" },\n  \"classifyRunId\": \"clr_01K3F…\"\n}\n```\n\n<Note>\nChildren are parsed right after the split, so they are immediately usable by any verb. Each child's parse is billed as a normal parse. `usage` itemizes it.\n</Note>\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Split guide](https://docs.cloudraker.com/capabilities/split)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1SplitRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`segments_required`, `segments_conflict`, `invalid_segments`, `classify_run_mismatch`, `classify_run_not_paged`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1SplitBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          }
        ]
      }
    },
    "/v1/pipeline": {
      "post": {
        "operationId": "pipeline",
        "summary": "Run several capabilities over one set of files",
        "description": "Runs several capabilities over one set of files in a single call.\n\nEvery file is parsed once, then each step runs over the parsed set — **in parallel, not chained**. A step never consumes another step's output.\n\n**A step is one of:**\n\n- `{ \"extract\": {…} }`, `{ \"redact\": {…} }`, `{ \"fill\": {…} }`, `{ \"sign\": {…} }` — the same inline config the matching verb takes.\n- `{ \"action\": \"act_… | slug\", \"params\": {…} }` — a [saved action](https://docs.cloudraker.com/api/cloud-raker-api/actions/get-action).\n\nThere is no `parse` step: parsing is automatic.\n\n**Always asynchronous.** The response is `202` carrying the run id and one `{id, capability}` per step. Poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) — its `steps[]` reports each step's status and result under the id you were handed at create.\n\n```json\n{\n  \"files\": [{ \"id\": \"a04d6597-4e34-4a99-94ea-964c289a4c68\" }],\n  \"steps\": [\n    { \"extract\": { \"schema\": { \"type\": \"object\", \"properties\": { \"business_name\": { \"type\": [\"string\", \"null\"] } } } } },\n    { \"redact\": { \"mode\": \"targeted\" } }\n  ]\n}\n```\n\n**Learn more:** [Pipeline guide](https://docs.cloudraker.com/capabilities/pipeline)",
        "responses": {
          "202": {
            "description": "Accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1PipelineAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1PipelineBody"
              }
            }
          }
        }
      }
    },
    "/v1/runs": {
      "get": {
        "operationId": "listRuns",
        "tags": ["Runs"],
        "summary": "List runs",
        "description": "Lists your organization's runs, newest first.\n\nEvery run created through `/v1` appears here — extractions, parses, redactions, fills, signatures and pipelines alike — so this is the answer to \"what has my integration been doing?\".\n\n**Filtering:**\n\n| Parameter | Effect |\n| --- | --- |\n| `object` | One kind of run, e.g. `extract_run` |\n| `status` | One state, e.g. `needs_input` |\n| `metadata.<key>=<value>` | Exact match on the `metadata` you attached at create — up to 3 pairs, combined with AND |\n\n```\nGET /v1/runs?object=extract_run&status=processed&metadata.customerId=cus_42&limit=50\n```\n\n**Paging.** Up to 50 rows per page. When `has_more` is true, pass the returned `cursor` back as `?cursor=` for the next page; treat it as opaque.\n\n<Note>\nThis listing is eventually consistent — a row can lag a second or two behind the run itself. [GET /v1/runs/{id}](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) reads the run directly and is always authoritative.\n</Note>",
        "responses": {
          "200": {
            "description": "The runs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid filter, `limit` or `cursor` (`invalid_request`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "object",
            "schema": {
              "type": "string",
              "enum": [
                "extract_run",
                "parse_run",
                "redact_run",
                "fill_run",
                "sign_run",
                "classify_run",
                "split_run",
                "pipeline_run"
              ]
            },
            "description": "Only runs of this kind — `extract_run`, `parse_run`, `redact_run`, `fill_run`, `sign_run`, `classify_run`, `split_run` or `pipeline_run`."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": ["processing", "processed", "failed", "cancelled", "expired", "needs_input"]
            },
            "description": "Only runs in this state."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "description": "How many runs to return, 1–50."
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "description": "The `cursor` from the previous page. Opaque — pass it back unchanged."
          }
        ]
      }
    },
    "/v1/runs/{id}": {
      "get": {
        "operationId": "getRun",
        "tags": ["Runs"],
        "summary": "Get a run",
        "description": "Returns a run's status and, once it is `processed`, its result.\n\nOne route reads every kind of run. The response shape follows the id prefix:\n\n| Prefix | Run | Created by |\n| --- | --- | --- |\n| `exr_` | Extraction | [POST /v1/extract](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/extract) |\n| `par_` | Parse | [POST /v1/parse](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/parse) |\n| `rdr_` | Redaction | [POST /v1/redact](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/redact) |\n| `flr_` | Form fill | [POST /v1/fill](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/fill) |\n| `sgr_` | E-signature | [POST /v1/sign](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/sign) |\n| `clr_` | Classification | [POST /v1/classify](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/classify) |\n| `spr_` | Split | [POST /v1/split](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/split) |\n| `plr_` | Pipeline | [POST /v1/pipeline](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/pipeline) |\n\nA `plr_` run additionally carries `steps[]` — a per-step status and result, keyed by the step id you were handed at create.\n\n**Long-polling.** `?wait=<seconds>` (0–120) holds the request until the run reaches a terminal state or needs external input. `?include=evidence` is accepted and does nothing: citations are always present when the run was grounded.\n\n**Parsed source.** Add `?output=inline` when reading a parse or extraction run to include parsed markdown and JSON. The 1 MiB combined cap and URL-only fallback are identical to the create verbs.\n\n<Note>\nAn expired run answers `410 run_expired` during its grace window and `404` afterwards. Call [POST /v1/runs/{id}/keep](https://docs.cloudraker.com/api/cloud-raker-api/runs/keep-run) before expiry to hold onto the files for good.\n</Note>",
        "responses": {
          "200": {
            "description": "The run.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/V1ExtractRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1ParseRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1RedactRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1FillRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1SignRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1PipelineRun"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id (or a run belonging to another organization)."
          },
          "410": {
            "description": "The run expired and its data was purged."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "output",
            "schema": {
              "default": "urls",
              "type": "string",
              "enum": ["urls", "inline"]
            },
            "description": "Return parsed source inline for parse/extract runs when the combined source is at most 1 MiB; otherwise retain signed URLs only."
          },
          {
            "in": "query",
            "name": "include",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            }
          }
        ]
      },
      "delete": {
        "operationId": "deleteRun",
        "tags": ["Runs"],
        "summary": "Purge a run now",
        "description": "Deletes a run's files and outputs immediately, ahead of its TTL.\n\nAnything still in flight is cancelled first. Idempotent: purging an already-purged run still answers `204`.\n\nTo keep the results instead of destroying them, call [POST /v1/runs/{id}/keep](https://docs.cloudraker.com/api/cloud-raker-api/runs/keep-run). To stop the work but leave the files until expiry, use [POST /v1/runs/{id}/cancel](https://docs.cloudraker.com/api/cloud-raker-api/runs/cancel-run).",
        "responses": {
          "204": {
            "description": "Purged."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/runs/{id}/cancel": {
      "post": {
        "operationId": "cancelRun",
        "tags": ["Runs"],
        "summary": "Cancel a run",
        "description": "Stops a run's in-flight work and returns the run in its cancelled state.\n\n- **Files and the TTL are untouched** — the run still purges at `expiresAt`. To delete everything now, use [DELETE /v1/runs/{id}](https://docs.cloudraker.com/api/cloud-raker-api/runs/delete-run).\n- **Idempotent** — cancelling an already-terminal run changes nothing and returns the current run body.",
        "responses": {
          "200": {
            "description": "The run after cancellation.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/V1ExtractRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1ParseRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1RedactRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1FillRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1SignRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1PipelineRun"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id."
          },
          "410": {
            "description": "The run expired."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/runs/{id}/keep": {
      "post": {
        "operationId": "keepRun",
        "tags": ["Runs"],
        "summary": "Keep a run in the product",
        "description": "Promotes a temporary run into your workspace so it stops being temporary.\n\nKeeping a run moves its files and outputs into a real space, re-indexes them for search, imports definition-bound extraction results as records, and clears the TTL — `expiresAt` becomes `null`.\n\n**Two ways to name the destination:**\n\n```json\n{ \"spaceId\": \"spc_01JQ8ZKMRT4V6WXYZ0ABCDEFGH\" }\n```\n\n```json\n{ \"space\": { \"name\": \"Q3 invoices\" } }\n```\n\nThe response carries `dashboardUrl` — the space as a person would open it.\n\n<Note>\nKeeping is idempotent for the same space, but keeping into a *different* space answers `409 already_kept`. A run that is still going answers `409 pipeline_running` — wait for [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) to finish first.\n</Note>",
        "responses": {
          "200": {
            "description": "Kept.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1KeepResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id, or an unknown `spaceId`."
          },
          "409": {
            "description": "The run is still running (`pipeline_running`) or already kept."
          },
          "410": {
            "description": "The run expired."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1KeepBody"
              }
            }
          }
        }
      }
    },
    "/v1/runs/{id}/output/{name}": {
      "get": {
        "operationId": "getRunOutput",
        "tags": ["Runs"],
        "summary": "Download a produced file",
        "description": "Redirects to a signed, time-limited URL for one of the files a run produced — the redacted PDF, the filled form, the sealed document.\n\n`{name}` is the file name exactly as it appears in `output.files[].name` on [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run), or the file id. The same signed URL is already inline on the run body; this route exists as the stable, guessable alias you can hard-code.\n\n<Note>\nA `409 output_not_ready` means the file is registered but its bytes are still settling. It is retryable — wait a moment and ask again.\n</Note>",
        "responses": {
          "302": {
            "description": "Redirect to the signed download URL."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id, or the run produced no file by that name."
          },
          "409": {
            "description": "The output file exists but its bytes are still settling (`output_not_ready`, retryable) — retry shortly."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/runs/{id}/envelope": {
      "get": {
        "operationId": "getRunEnvelope",
        "tags": ["Runs"],
        "summary": "Get the e-signature envelope",
        "description": "The sender's view of a `sign` run — envelope status, the signer roster with per-signer state, any `cc` recipients, and the event trail.\n\nEvery sign response points here through `envelopeUrl`. Use it to answer \"who still has to sign?\": each `signers[]` entry carries its own `status`, `emailVerifiedAt` and `signedAt`.\n\n<Note>\nThis never contains signing links. Those are bearer capabilities held only by the signers themselves — to get one to a signer, use [POST /v1/runs/{id}/signers/{signerId}/resend](https://docs.cloudraker.com/api/cloud-raker-api/runs/resend-run-signer).\n</Note>\n\n**Learn more:** [E-signature guide](https://docs.cloudraker.com/capabilities/sign)",
        "responses": {
          "200": {
            "description": "Get the e-signature envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunSignEnvelopeView"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/runs/{id}/audit": {
      "get": {
        "operationId": "getRunAuditTrail",
        "tags": ["Runs"],
        "summary": "Download the signature audit trail",
        "description": "Downloads the machine-readable audit trail for a `sign` run as `application/json`.\n\nThis is the same document the sealed PDF carries as an attachment, and it is available before the envelope completes — so you can archive the trail as it accumulates rather than only at the end. The run body links it as `output.auditUrl`.\n\n**Learn more:** [E-signature guide](https://docs.cloudraker.com/capabilities/sign)",
        "responses": {
          "200": {
            "description": "Download the signature audit trail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignAuditTrail"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/runs/{id}/void": {
      "post": {
        "operationId": "voidRunEnvelope",
        "tags": ["Runs"],
        "summary": "Void an e-signature envelope",
        "description": "Cancels a pending signature envelope for good.\n\nEvery outstanding signing link stops working immediately and the run terminates as failed. Pass an optional `{ \"reason\": \"…\" }` to record why in the [audit trail](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run-audit-trail).\n\nAnswers `409` once the envelope is finalizing or already completed — a signed document cannot be un-signed.\n\n**Learn more:** [E-signature guide](https://docs.cloudraker.com/capabilities/sign)",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "description": "Recorded on the audit trail.",
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Void an e-signature envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoidRunEnvelopeResult"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/runs/{id}/signers/{signerId}/resend": {
      "post": {
        "operationId": "resendRunSigner",
        "tags": ["Runs"],
        "summary": "Re-send a signer their invitation",
        "description": "Emails a pending signer a fresh invitation with a **new** signing link.\n\nThe signer's previous link stops working the moment the new one is issued — this is the fix for a lost or expired invitation, not a reminder nudge. Take `{signerId}` from `signers[].id` on [the envelope](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run-envelope).\n\nAnswers `409` if that signer already signed, or if the envelope is no longer pending.\n\n**Learn more:** [E-signature guide](https://docs.cloudraker.com/capabilities/sign)",
        "responses": {
          "200": {
            "description": "Re-send a signer their invitation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResendRunSignerResult"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "signerId",
            "required": true
          }
        ]
      }
    },
    "/v1/files": {
      "post": {
        "operationId": "createFile",
        "tags": ["Files"],
        "summary": "Register a file by URL, or get a presigned upload URL",
        "description": "Adds a file to your reusable corpus, either by URL or by uploading the bytes yourself.\n\nTwo request shapes, both pure JSON — send one or the other, never both.\n\n**By URL.** `{ url, name?, processing? }` registers the file and fetches it over http(s). The media type is sniffed from the response, so any `mimeType` you send is ignored. You get the file back with `status: \"processing\"`.\n\n```json\n{ \"url\": \"https://www.irs.gov/pub/irs-pdf/fw9.pdf\", \"name\": \"fw9.pdf\" }\n```\n\n**By upload.** `{ name, mimeType, processing? }` reserves the record and returns `uploadUrl` plus `uploadExpiresAt` (15 minutes). `PUT` the bytes to that URL with a `Content-Type` header exactly equal to the `mimeType` you sent; parsing starts the moment they land.\n\n```json\n{ \"name\": \"recording.mp3\", \"mimeType\": \"audio/mpeg\" }\n```\n\n**Parsing engine** — `processing` accepts `auto` (the default, self-upgrades to OCR on scans), `ocr`, `simple`, `transcribe` and `transcribe_diarize`. Audio and video default to `transcribe_diarize`.\n\n<Note>\nFiles registered here are persistent — no TTL — and reusable across any number of runs as `file: { \"id\": \"…\" }`. That is what makes parse-once-run-many work: pass the same id to [extract](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/extract), [redact](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/redact) and [pipeline](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/pipeline) without re-parsing.\n</Note>\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "201": {
            "description": "The registered file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1File"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "422": {
            "description": "The URL could not be fetched (`file_fetch_failed`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The fetched bytes could not be stored (`file_upload_failed`)."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateFileBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listFiles",
        "tags": ["Files"],
        "summary": "List files",
        "description": "Lists the files your organization has registered, newest first.\n\n`?limit` caps the page (1–200, default 50). There is no cursor today — paging is by `limit` only.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "200": {
            "description": "The files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1FileList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ]
      }
    },
    "/v1/files/{id}": {
      "get": {
        "operationId": "getFile",
        "tags": ["Files"],
        "summary": "Get a file",
        "description": "Returns a file's metadata and where it is in the pipeline.\n\n`{id}` accepts the file id or the file name. A name has to match exactly one file here, otherwise the call answers `409 ambiguous_file_name`.\n\n`status` walks `uploading` → `processing` → `ready`, or lands on `failed` with an `error`. Poll this route after [registering a file](https://docs.cloudraker.com/api/cloud-raker-api/files/create-file) until it reads `ready`.\n\nOnce `ready`, `urls` carries signed links valid for about an hour:\n\n- `content` — the original bytes.\n- `markdown` and `json` — the parsed forms, present when the file was parsed.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1File"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file id (or a file outside the API workspace)."
          },
          "409": {
            "description": "The name matches more than one file (`ambiguous_file_name`), or there are too many files to resolve a name safely (`file_listing_truncated`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteFile",
        "tags": ["Files"],
        "summary": "Delete a file",
        "description": "Deletes a file and everything parsed out of it.\n\n`{id}` accepts the file id or the file name, exactly as `GET` does.\n\nRuns that already referenced the file keep their results — deleting the source does not retroactively empty a finished run.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file id."
          },
          "409": {
            "description": "The name matches more than one file (`ambiguous_file_name`), or there are too many files to resolve a name safely (`file_listing_truncated`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/templates": {
      "post": {
        "operationId": "createTemplate",
        "tags": ["Templates"],
        "summary": "Add a template by URL, or get a presigned upload URL",
        "description": "Adds a blank form to your organization's template library.\n\nThe two request shapes match [POST /v1/files](https://docs.cloudraker.com/api/cloud-raker-api/files/create-file):\n\n- `{ url, name? }` — fetched over http(s) for you.\n- `{ name, mimeType }` — returns `uploadUrl` plus `uploadExpiresAt` (15 minutes); `PUT` the bytes with a `Content-Type` equal to the `mimeType` you sent.\n\n```json\n{ \"url\": \"https://www.irs.gov/pub/irs-pdf/fw9.pdf\", \"name\": \"w9.pdf\" }\n```\n\n<Note>\nTemplates are deliberately never parsed or indexed — they are documents to be filled, not read. That is why a template reaches `ready` as soon as its bytes land, with no `processing` stage. Pass one to [fill](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/fill) as `template: { \"id\": \"…\" }`.\n</Note>\n\n**Learn more:** [Form filling guide](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "201": {
            "description": "The template.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Template"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "422": {
            "description": "The URL could not be fetched (`file_fetch_failed`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateTemplateBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listTemplates",
        "tags": ["Templates"],
        "summary": "List templates",
        "description": "Lists your organization's templates, newest first.\n\nThese are picker rows: no download URLs. Fetch [a single template](https://docs.cloudraker.com/api/cloud-raker-api/templates/get-template) when you need its signed `downloadUrl`.\n\n`?limit` caps the page (1–200, default 50); there is no cursor.\n\n**Learn more:** [Form filling guide](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "200": {
            "description": "The templates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1TemplateList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ]
      }
    },
    "/v1/templates/{id}": {
      "get": {
        "operationId": "getTemplate",
        "tags": ["Templates"],
        "summary": "Get a template",
        "description": "Returns a template's metadata plus a signed `downloadUrl` for the stored bytes, valid for about an hour.\n\nPDFs report `kind: \"pdf-form\"` — those are the ones [inspect](https://docs.cloudraker.com/api/cloud-raker-api/templates/inspect-template) can enumerate fields for.\n\n**Learn more:** [Form filling guide](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "200": {
            "description": "The template.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Template"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown template id."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteTemplate",
        "tags": ["Templates"],
        "summary": "Delete a template",
        "description": "Removes a template from your organization's library.\n\nRuns that already filled it keep their output files.\n\n**Learn more:** [Form filling guide](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown template id."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/templates/{id}/inspect": {
      "post": {
        "operationId": "inspectTemplate",
        "tags": ["Templates"],
        "summary": "Detect a template’s fillable fields",
        "description": "Enumerates the fillable fields in a `pdf-form` template, with the page geometry to draw them on.\n\nThe response is `{ fields, pageBoxes, pageCount, detected }`. Each field carries its name, type, label, page and bounding box — plus `maxLength`, `multiline` and `options` where the widget declares them. The names you see here are exactly the keys `values` takes on [POST /v1/fill](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/fill). Save the curated `fields` onto a fill config to fix the schema for every run.\n\nIf the PDF carries no form fields of its own, they are detected from the page instead and `detected` says so.\n\nAny PDF you can reach works here, not only a saved template — a file in one of your spaces is inspected the same way.\n\n<Note>\nIdempotent, but the first call on a template can be slow while the document is analyzed. Later calls reuse that result and return promptly.\n</Note>\n\n**Learn more:** [Form filling guide](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "200": {
            "description": "Field inventory, values schema and page geometry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1TemplateInspection"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "409": {
            "description": "The template is still uploading (`file_not_ready`)."
          },
          "413": {
            "description": "The template exceeds the 32 MB inspect cap (`template_too_large`)."
          },
          "422": {
            "description": "The template is not a PDF (`template_not_inspectable`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/webhooks": {
      "post": {
        "operationId": "createWebhookEndpoint",
        "tags": ["Webhooks"],
        "summary": "Create a webhook endpoint",
        "description": "Saves a delivery target you can point any run at.\n\nReference it from a run as `webhook: { \"id\": \"whe_…\" }` — on [extract](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/extract), [fill](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/fill), [pipeline](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/pipeline), any of them. Runs keep the *reference*, never a URL snapshot, so pausing or re-pointing an endpoint takes effect on runs already in flight.\n\n```json\n{\n  \"url\": \"https://example.com/hooks/cloudraker\",\n  \"events\": [\"run.completed\", \"run.failed\"]\n}\n```\n\n**Event types** — omit `events` to receive all of them:\n\n- `processing.started`\n- `file.processed`\n- `file.failed`\n- `run.completed`\n- `run.failed`\n- `processing.completed`\n- `processing.expired`\n- `space.expired`\n- `agent_run.waiting`\n- `agent_run.needs_input`\n- `agent_run.approval_requested`\n- `agent_run.task_ready`\n- `agent_run.completed`\n- `agent_run.failed`\n- `work_session.opened`\n- `work_session.waiting`\n- `work_session.done`\n- `turn.started`\n- `turn.finished`\n- `turn.failed`\n- `approval.requested`\n- `approval.decided`\n- `artifact.created`\n- `artifact.committed`\n- `embed.document_saved`\n- `embed.document_approved`\n\n**Delivery guarantees.** At-least-once, so dedupe on `eventId` — a retry re-sends the whole event to every target. Up to 6 attempts, at least ten seconds apart, then the event is dropped. Each attempt is signed ES256 — verify against [the public keys](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/webhook-jwks), and check what actually landed with [the delivery log](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/list-webhook-deliveries).\n\n**Learn more:** [Webhooks guide](https://docs.cloudraker.com/developers/webhooks)",
        "responses": {
          "201": {
            "description": "The endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1WebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "description": "Invalid url or event type (`invalid_request`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateWebhookBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listWebhookEndpoints",
        "tags": ["Webhooks"],
        "summary": "List webhook endpoints",
        "description": "Lists your organization's saved webhook endpoints, newest first.\n\nEach row reports its `url`, the `events` it filters on (absent means every type) and whether it is `disabled`.\n\n**Learn more:** [Webhooks guide](https://docs.cloudraker.com/developers/webhooks)",
        "responses": {
          "200": {
            "description": "The endpoints.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1WebhookList"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "get": {
        "operationId": "getWebhookEndpoint",
        "tags": ["Webhooks"],
        "summary": "Get a webhook endpoint",
        "description": "Returns one saved endpoint — its `url`, event filter and `disabled` state.\n\nTo see whether deliveries are actually arriving, read [the delivery log](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/list-webhook-deliveries).\n\n**Learn more:** [Webhooks guide](https://docs.cloudraker.com/developers/webhooks)",
        "responses": {
          "200": {
            "description": "The endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1WebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown endpoint id."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateWebhookEndpoint",
        "tags": ["Webhooks"],
        "summary": "Update a webhook endpoint",
        "description": "Changes a saved endpoint in place, keeping its id.\n\n- `url` — re-point it somewhere else.\n- `events` — re-filter which types it receives.\n- `disabled: true` — pause deliveries without losing the endpoint.\n\n```json\n{ \"disabled\": true }\n```\n\n<Note>\nRuns already in flight pick the change up immediately: they hold the `whe_` reference, not a URL snapshot. Rotating an endpoint mid-run reroutes the rest of that run's deliveries.\n</Note>\n\n**Learn more:** [Webhooks guide](https://docs.cloudraker.com/developers/webhooks)",
        "responses": {
          "200": {
            "description": "The updated endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1WebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown endpoint id."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1UpdateWebhookBody"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhookEndpoint",
        "tags": ["Webhooks"],
        "summary": "Delete a webhook endpoint",
        "description": "Removes a saved endpoint permanently.\n\nRuns still referencing it simply stop delivering — nothing fails and nothing queues up. To stop deliveries temporarily instead, [pause it](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/update-webhook-endpoint) with `disabled: true`.\n\n**Learn more:** [Webhooks guide](https://docs.cloudraker.com/developers/webhooks)",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown endpoint id."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "listWebhookDeliveries",
        "tags": ["Webhooks"],
        "summary": "Recent delivery attempts",
        "description": "Answers \"did it actually arrive?\" for a saved endpoint.\n\nThe 50 most recent attempts, newest first, one row per attempt — not per event, so a retried event appears several times with a rising `attempt`. Each row carries the event `type`, the run it belongs to, the `responseStatus` your server returned and whether it counted as `ok`.\n\n**Learn more:** [Webhooks guide](https://docs.cloudraker.com/developers/webhooks)",
        "responses": {
          "200": {
            "description": "The attempts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1WebhookDeliveryList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown endpoint id."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/actions/catalog": {
      "get": {
        "operationId": "listCapabilities",
        "deprecated": true,
        "tags": ["Actions"],
        "summary": "List the capabilities and their config schemas",
        "description": "Discovery: every capability you can save an action for, and exactly what its config accepts.\n\nEach entry lists the slugs behind a capability and the JSON Schema of each slug's `config` — enough to build a form, validate input, or decide what to send to [POST /v1/actions](https://docs.cloudraker.com/api/cloud-raker-api/actions/create-action).\n\n<Note>\n`redact` covers two variants, documents and audio, with different config shapes. Pass `mimeType` when saving a redaction action so the right one is chosen.\n</Note>\n\n**Learn more:** [Pipeline guide](https://docs.cloudraker.com/capabilities/pipeline)\n\n**Deprecated:** saved actions are becoming per-capability configs — use `POST/GET/PATCH/DELETE /v1/{capability}/configs` instead (`/v1/extract/configs`, `/v1/redact/configs`, `/v1/fill/configs`). Signing keeps using `POST /v1/sign`.",
        "responses": {
          "200": {
            "description": "The capabilities.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1CapabilityCatalog"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/actions": {
      "post": {
        "operationId": "createAction",
        "deprecated": true,
        "tags": ["Actions"],
        "summary": "Save an action",
        "description": "Saves a reusable, named configuration for a capability so calls stop repeating themselves.\n\nPass a saved action to any run as `action: \"<id or slug>\"`. Inline config on the call is deep-merged over the saved config (an inline `schema` replaces the saved one whole), and inline wins — so one saved action can be nudged per call without being redefined.\n\n```json\n{\n  \"capability\": \"extract\",\n  \"name\": \"W-9 basics\",\n  \"config\": {\n    \"schema\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"business_name\": { \"type\": [\"string\", \"null\"] },\n        \"tax_classification\": { \"type\": [\"string\", \"null\"] }\n      }\n    }\n  }\n}\n```\n\nSaved actions are also what governance, record-type binding and stable configuration under [keep](https://docs.cloudraker.com/api/cloud-raker-api/runs/keep-run) hang off. Check [the catalog](https://docs.cloudraker.com/api/cloud-raker-api/actions/list-capabilities) for the config schema of the capability you are saving.\n\n**Learn more:** [Pipeline guide](https://docs.cloudraker.com/capabilities/pipeline)\n\n**Deprecated:** saved actions are becoming per-capability configs — use `POST/GET/PATCH/DELETE /v1/{capability}/configs` instead (`/v1/extract/configs`, `/v1/redact/configs`, `/v1/fill/configs`). Signing keeps using `POST /v1/sign`.",
        "responses": {
          "201": {
            "description": "The saved action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Action"
                }
              }
            }
          },
          "400": {
            "description": "Ambiguous redaction target (`ambiguous_capability`), or a `config.schema` outside the extraction schema dialect (`invalid_schema`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateActionBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listActions",
        "deprecated": true,
        "tags": ["Actions"],
        "summary": "List saved actions",
        "description": "Lists your organization's saved actions.\n\nPage with `?limit` (1–100) and `?starting_after=<id>`.\n\n<Note>\nKeep paging while `has_more` is true, not while the page is full — a page can come back shorter than `limit` and still have more behind it.\n</Note>\n\n**Learn more:** [Pipeline guide](https://docs.cloudraker.com/capabilities/pipeline)\n\n**Deprecated:** saved actions are becoming per-capability configs — use `POST/GET/PATCH/DELETE /v1/{capability}/configs` instead (`/v1/extract/configs`, `/v1/redact/configs`, `/v1/fill/configs`). Signing keeps using `POST /v1/sign`.",
        "responses": {
          "200": {
            "description": "The saved actions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ActionList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "starting_after",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ]
      }
    },
    "/v1/actions/{idOrSlug}": {
      "get": {
        "operationId": "getAction",
        "deprecated": true,
        "tags": ["Actions"],
        "summary": "Get a saved action",
        "description": "Returns one saved action with its resolved `capability` and stored `config`.\n\nThe id and the slug are interchangeable here and everywhere else an action is referenced — including `action: \"…\"` on [extract](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/extract), [redact](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/redact) and [fill](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/fill).\n\n**Deprecated:** saved actions are becoming per-capability configs — use `POST/GET/PATCH/DELETE /v1/{capability}/configs` instead (`/v1/extract/configs`, `/v1/redact/configs`, `/v1/fill/configs`). Signing keeps using `POST /v1/sign`.",
        "responses": {
          "200": {
            "description": "The saved action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Action"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown action id or slug."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteAction",
        "deprecated": true,
        "tags": ["Actions"],
        "summary": "Delete a saved action",
        "description": "Removes a saved action from your organization.\n\nRuns that already referenced it keep the configuration they were created with — the config is snapshotted onto each run, so deleting the action never rewrites history.\n\n**Deprecated:** saved actions are becoming per-capability configs — use `POST/GET/PATCH/DELETE /v1/{capability}/configs` instead (`/v1/extract/configs`, `/v1/redact/configs`, `/v1/fill/configs`). Signing keeps using `POST /v1/sign`.",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown action id or slug."
          },
          "409": {
            "description": "The action is a default install and cannot be deleted (relayed from the action library)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/extract/configs": {
      "post": {
        "operationId": "createExtractConfig",
        "tags": ["Configs"],
        "summary": "Save a extract config",
        "description": "Saves a reusable, named extract configuration so calls stop repeating themselves.\n\nPass it to any run as `action: \"<id or slug>\"`. Inline config on the call is deep-merged over the saved config (an inline `schema` replaces the saved one whole), and inline wins — so one saved config can be nudged per call without being redefined.\n\n**Learn more:** [Extract capability](https://docs.cloudraker.com/capabilities/extract)",
        "responses": {
          "201": {
            "description": "The saved config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Ambiguous redaction target (`ambiguous_capability`), or a `config.schema` outside the extraction schema dialect (`invalid_schema`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateConfigBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listExtractConfigs",
        "tags": ["Configs"],
        "summary": "List saved extract configs",
        "description": "Lists your organization's saved extract configs.\n\nPage with `?limit` (1–100) and `?starting_after=<id>`.\n\n<Note>\nKeep paging while `has_more` is true, not while the page is full — a page can come back shorter than `limit` and still have more behind it.\n</Note>\n\n**Learn more:** [Extract capability](https://docs.cloudraker.com/capabilities/extract)",
        "responses": {
          "200": {
            "description": "The saved extract configs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ConfigList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "starting_after",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ]
      }
    },
    "/v1/extract/configs/{idOrSlug}": {
      "get": {
        "operationId": "getExtractConfig",
        "tags": ["Configs"],
        "summary": "Get a saved extract config",
        "description": "Returns one saved extract config with its stored `config`.\n\nThe id and the slug are interchangeable here and everywhere a config is referenced.\n\n**Learn more:** [Extract capability](https://docs.cloudraker.com/capabilities/extract)",
        "responses": {
          "200": {
            "description": "The saved config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateExtractConfig",
        "tags": ["Configs"],
        "summary": "Update a saved extract config",
        "description": "Renames a saved extract config, updates its `config`, or both. Send at least one field.\n\nA `config` patch deep-merges over the saved config: objects merge key by key, arrays and scalars replace. Keys you leave out keep their saved values. `schema` is the exception: it replaces the saved schema whole, so send the whole schema.\n\nRuns that already referenced it keep the configuration they were created with — the config is snapshotted onto each run.\n\n**Learn more:** [Extract capability](https://docs.cloudraker.com/capabilities/extract)",
        "responses": {
          "200": {
            "description": "The updated config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Empty body, or a `config.schema` outside the schema dialect."
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1UpdateConfigBody"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteExtractConfig",
        "tags": ["Configs"],
        "summary": "Delete a saved extract config",
        "description": "Removes a saved extract config from your organization.\n\nRuns that already referenced it keep the configuration they were created with — deleting a config never rewrites history.\n\n**Learn more:** [Extract capability](https://docs.cloudraker.com/capabilities/extract)",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "409": {
            "description": "The config is a default install and cannot be deleted (relayed from the action library)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/redact/configs": {
      "post": {
        "operationId": "createRedactConfig",
        "tags": ["Configs"],
        "summary": "Save a redact config",
        "description": "Saves a reusable, named redact configuration so calls stop repeating themselves.\n\nPass it to any run as `action: \"<id or slug>\"`. Inline config on the call is deep-merged over the saved config (an inline `schema` replaces the saved one whole), and inline wins — so one saved config can be nudged per call without being redefined.\n\n**Learn more:** [Redact capability](https://docs.cloudraker.com/capabilities/redact)",
        "responses": {
          "201": {
            "description": "The saved config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Ambiguous redaction target (`ambiguous_capability`), or a `config.schema` outside the extraction schema dialect (`invalid_schema`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateRedactConfigBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listRedactConfigs",
        "tags": ["Configs"],
        "summary": "List saved redact configs",
        "description": "Lists your organization's saved redact configs.\n\nPage with `?limit` (1–100) and `?starting_after=<id>`.\n\n<Note>\nKeep paging while `has_more` is true, not while the page is full — a page can come back shorter than `limit` and still have more behind it.\n</Note>\n\n**Learn more:** [Redact capability](https://docs.cloudraker.com/capabilities/redact)",
        "responses": {
          "200": {
            "description": "The saved redact configs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ConfigList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "starting_after",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ]
      }
    },
    "/v1/redact/configs/{idOrSlug}": {
      "get": {
        "operationId": "getRedactConfig",
        "tags": ["Configs"],
        "summary": "Get a saved redact config",
        "description": "Returns one saved redact config with its stored `config`.\n\nThe id and the slug are interchangeable here and everywhere a config is referenced.\n\n**Learn more:** [Redact capability](https://docs.cloudraker.com/capabilities/redact)",
        "responses": {
          "200": {
            "description": "The saved config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateRedactConfig",
        "tags": ["Configs"],
        "summary": "Update a saved redact config",
        "description": "Renames a saved redact config, updates its `config`, or both. Send at least one field.\n\nA `config` patch deep-merges over the saved config: objects merge key by key, arrays and scalars replace. Keys you leave out keep their saved values. `schema` is the exception: it replaces the saved schema whole, so send the whole schema.\n\nRuns that already referenced it keep the configuration they were created with — the config is snapshotted onto each run.\n\n**Learn more:** [Redact capability](https://docs.cloudraker.com/capabilities/redact)",
        "responses": {
          "200": {
            "description": "The updated config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Empty body, or a `config.schema` outside the schema dialect."
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1UpdateConfigBody"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteRedactConfig",
        "tags": ["Configs"],
        "summary": "Delete a saved redact config",
        "description": "Removes a saved redact config from your organization.\n\nRuns that already referenced it keep the configuration they were created with — deleting a config never rewrites history.\n\n**Learn more:** [Redact capability](https://docs.cloudraker.com/capabilities/redact)",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "409": {
            "description": "The config is a default install and cannot be deleted (relayed from the action library)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/fill/configs": {
      "post": {
        "operationId": "createFillConfig",
        "tags": ["Configs"],
        "summary": "Save a fill config",
        "description": "Saves a reusable, named fill configuration so calls stop repeating themselves.\n\nPass it to any run as `action: \"<id or slug>\"`. Inline config on the call is deep-merged over the saved config (an inline `schema` replaces the saved one whole), and inline wins — so one saved config can be nudged per call without being redefined.\n\n**Learn more:** [Fill capability](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "201": {
            "description": "The saved config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1FillConfig"
                }
              }
            }
          },
          "400": {
            "description": "Ambiguous redaction target (`ambiguous_capability`), or a `config.schema` outside the extraction schema dialect (`invalid_schema`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateFillConfigBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listFillConfigs",
        "tags": ["Configs"],
        "summary": "List saved fill configs",
        "description": "Lists your organization's saved fill configs.\n\nPage with `?limit` (1–100) and `?starting_after=<id>`.\n\n<Note>\nKeep paging while `has_more` is true, not while the page is full — a page can come back shorter than `limit` and still have more behind it.\n</Note>\n\n**Learn more:** [Fill capability](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "200": {
            "description": "The saved fill configs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1FillConfigList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "starting_after",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ]
      }
    },
    "/v1/fill/configs/{idOrSlug}": {
      "get": {
        "operationId": "getFillConfig",
        "tags": ["Configs"],
        "summary": "Get a saved fill config",
        "description": "Returns one saved fill config with its stored `config`.\n\nThe id and the slug are interchangeable here and everywhere a config is referenced.\n\n**Learn more:** [Fill capability](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "200": {
            "description": "The saved config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1FillConfig"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateFillConfig",
        "tags": ["Configs"],
        "summary": "Update a saved fill config",
        "description": "Renames a saved fill config, updates its `config`, or both. Send at least one field.\n\nA `config` patch deep-merges over the saved config: objects merge key by key, arrays and scalars replace. Keys you leave out keep their saved values. `schema` is the exception: it replaces the saved schema whole, so send the whole schema.\n\nRuns that already referenced it keep the configuration they were created with — the config is snapshotted onto each run.\n\n**Learn more:** [Fill capability](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "200": {
            "description": "The updated config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1FillConfig"
                }
              }
            }
          },
          "400": {
            "description": "Empty body, or a `config.schema` outside the schema dialect."
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1UpdateFillConfigBody"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteFillConfig",
        "tags": ["Configs"],
        "summary": "Delete a saved fill config",
        "description": "Removes a saved fill config from your organization.\n\nRuns that already referenced it keep the configuration they were created with — deleting a config never rewrites history.\n\n**Learn more:** [Fill capability](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "409": {
            "description": "The config is a default install and cannot be deleted (relayed from the action library)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/classify/configs": {
      "post": {
        "operationId": "createClassifyConfig",
        "tags": ["Configs"],
        "summary": "Save a classify config",
        "description": "Saves a reusable, named classify configuration so calls stop repeating themselves.\n\nPass it to any run as `action: \"<id or slug>\"`. Inline config on the call is deep-merged over the saved config (an inline `schema` replaces the saved one whole), and inline wins — so one saved config can be nudged per call without being redefined.\n\n**Learn more:** [Classify capability](https://docs.cloudraker.com/capabilities/classify)",
        "responses": {
          "201": {
            "description": "The saved config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Ambiguous redaction target (`ambiguous_capability`), or a `config.schema` outside the extraction schema dialect (`invalid_schema`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateConfigBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listClassifyConfigs",
        "tags": ["Configs"],
        "summary": "List saved classify configs",
        "description": "Lists your organization's saved classify configs.\n\nPage with `?limit` (1–100) and `?starting_after=<id>`.\n\n<Note>\nKeep paging while `has_more` is true, not while the page is full — a page can come back shorter than `limit` and still have more behind it.\n</Note>\n\n**Learn more:** [Classify capability](https://docs.cloudraker.com/capabilities/classify)",
        "responses": {
          "200": {
            "description": "The saved classify configs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ConfigList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "starting_after",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ]
      }
    },
    "/v1/classify/configs/{idOrSlug}": {
      "get": {
        "operationId": "getClassifyConfig",
        "tags": ["Configs"],
        "summary": "Get a saved classify config",
        "description": "Returns one saved classify config with its stored `config`.\n\nThe id and the slug are interchangeable here and everywhere a config is referenced.\n\n**Learn more:** [Classify capability](https://docs.cloudraker.com/capabilities/classify)",
        "responses": {
          "200": {
            "description": "The saved config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateClassifyConfig",
        "tags": ["Configs"],
        "summary": "Update a saved classify config",
        "description": "Renames a saved classify config, updates its `config`, or both. Send at least one field.\n\nA `config` patch deep-merges over the saved config: objects merge key by key, arrays and scalars replace. Keys you leave out keep their saved values. `schema` is the exception: it replaces the saved schema whole, so send the whole schema.\n\nRuns that already referenced it keep the configuration they were created with — the config is snapshotted onto each run.\n\n**Learn more:** [Classify capability](https://docs.cloudraker.com/capabilities/classify)",
        "responses": {
          "200": {
            "description": "The updated config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Empty body, or a `config.schema` outside the schema dialect."
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1UpdateConfigBody"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteClassifyConfig",
        "tags": ["Configs"],
        "summary": "Delete a saved classify config",
        "description": "Removes a saved classify config from your organization.\n\nRuns that already referenced it keep the configuration they were created with — deleting a config never rewrites history.\n\n**Learn more:** [Classify capability](https://docs.cloudraker.com/capabilities/classify)",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "409": {
            "description": "The config is a default install and cannot be deleted (relayed from the action library)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/compose/configs": {
      "post": {
        "operationId": "createComposeConfig",
        "tags": ["Configs"],
        "summary": "Save a compose config",
        "description": "Saves a reusable, named compose configuration so calls stop repeating themselves.\n\nPass it to [POST /v1/compose](https://docs.cloudraker.com/capabilities/compose) as `template: \"<id or slug>\"`. Its `config` holds the JSON Schema your data is checked against, the bundle files, the `main` entry point and named examples.\n\n**Learn more:** [Compose capability](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "201": {
            "description": "The saved config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Ambiguous redaction target (`ambiguous_capability`), or a `config.schema` outside the extraction schema dialect (`invalid_schema`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateConfigBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listComposeConfigs",
        "tags": ["Configs"],
        "summary": "List saved compose configs",
        "description": "Lists your organization's saved compose configs.\n\nPage with `?limit` (1–100) and `?starting_after=<id>`.\n\n<Note>\nKeep paging while `has_more` is true, not while the page is full — a page can come back shorter than `limit` and still have more behind it.\n</Note>\n\n**Learn more:** [Compose capability](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "200": {
            "description": "The saved compose configs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ConfigList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "starting_after",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ]
      }
    },
    "/v1/compose/configs/{idOrSlug}": {
      "get": {
        "operationId": "getComposeConfig",
        "tags": ["Configs"],
        "summary": "Get a saved compose config",
        "description": "Returns one saved compose config with its stored `config`.\n\nThe id and the slug are interchangeable here and everywhere a config is referenced.\n\n**Learn more:** [Compose capability](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "200": {
            "description": "The saved config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateComposeConfig",
        "tags": ["Configs"],
        "summary": "Update a saved compose config",
        "description": "Renames a saved compose config, updates its `config`, or both. Send at least one field.\n\nA `config` patch deep-merges over the saved config: objects merge key by key, arrays and scalars replace. Keys you leave out keep their saved values. `schema` is the exception: it replaces the saved schema whole, so send the whole schema.\n\nRuns that already referenced it keep the configuration they were created with — the config is snapshotted onto each run.\n\n**Learn more:** [Compose capability](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "200": {
            "description": "The updated config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Config"
                }
              }
            }
          },
          "400": {
            "description": "Empty body, or a `config.schema` outside the schema dialect."
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1UpdateConfigBody"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteComposeConfig",
        "tags": ["Configs"],
        "summary": "Delete a saved compose config",
        "description": "Removes a saved compose config from your organization.\n\nRuns that already referenced it keep the configuration they were created with — deleting a config never rewrites history.\n\n**Learn more:** [Compose capability](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown id or slug, or a config of another capability."
          },
          "409": {
            "description": "The config is a default install and cannot be deleted (relayed from the action library)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/files/{ref}/convert/markdown": {
      "post": {
        "operationId": "convertFileToMarkdown",
        "tags": ["Tools"],
        "summary": "Convert a file to Markdown",
        "description": "Returns the file as Markdown text.\n\n`{ref}` is the file id or the file name.\n\nWhen the file was already parsed, this serves the Markdown that parsing produced and costs nothing extra. Otherwise the bytes are converted on the spot — the answer is the same either way.\n\nThe result is text, not a new file: nothing is stored, and nothing is charged to your corpus.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "200": {
            "description": "The Markdown.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Conversion"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file."
          },
          "409": {
            "description": "Ambiguous name, or the bytes have not landed yet."
          },
          "422": {
            "description": "The file could not be converted."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/files/{ref}/convert/pdf": {
      "post": {
        "operationId": "convertFileToPdf",
        "tags": ["Tools"],
        "summary": "Convert a file to PDF",
        "description": "Turns a Word document, a spreadsheet, a presentation, an image or a plain-text file into a PDF, and stores the result as a new file next to the original.\n\n`{ref}` is the file id or the file name. A file that is already a PDF answers `400` — there is nothing to convert.\n\nThe new file carries `parentFileId` pointing back at the original, and is never indexed for search: the original is the thing that gets indexed.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "201": {
            "description": "The converted file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1File"
                }
              }
            }
          },
          "400": {
            "description": "The file is already a PDF (`invalid_request`)."
          },
          "404": {
            "description": "Unknown file."
          },
          "422": {
            "description": "The file type cannot be converted (`unsupported_file_type`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/files/{ref}/convert/image": {
      "post": {
        "operationId": "renderFilePage",
        "tags": ["Tools"],
        "summary": "Render a PDF page to an image",
        "description": "Renders one page of a PDF as a PNG and stores it as a new file.\n\n```json\n{ \"page\": 1, \"scale\": 2 }\n```\n\n`page` is 1-based and defaults to the first page. `scale` runs from 0.1 to 6 and defaults to 2; the long edge is capped at 4000 pixels whatever you ask for.\n\nOnly a PDF can be rendered — convert first with [convert/pdf](https://docs.cloudraker.com/api/cloud-raker-api/tools/convert-file-to-pdf).\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "201": {
            "description": "The rendered image.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1File"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file."
          },
          "422": {
            "description": "The file is not a PDF, or the page does not exist."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RenderPageBody"
              }
            }
          }
        }
      }
    },
    "/v1/files/{ref}/split/pages": {
      "post": {
        "operationId": "splitFilePages",
        "tags": ["Tools"],
        "summary": "Split a PDF into one file per page",
        "description": "Splits a PDF into single-page PDFs, one new file per page, named `<original>.p<n>.pdf`.\n\nEach page carries `parentFileId` pointing back at the source, so the set stays traceable to one document.\n\nA PDF longer than 100 pages answers `413 too_many_pages` — extract the pages you need one at a time instead. A PDF larger than 15 MB answers `413 too_large`.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "201": {
            "description": "One file per page, in page order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1FileList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file."
          },
          "413": {
            "description": "More than 100 pages (`too_many_pages`), or larger than 15 MB (`too_large`)."
          },
          "422": {
            "description": "The file is not a PDF."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/files/stitch": {
      "post": {
        "operationId": "stitchFiles",
        "tags": ["Tools"],
        "summary": "Join files into one",
        "description": "Joins 2 to 20 files, in the order you list them, into a single new file.\n\n```json\n{ \"files\": [\"call-part1.mp3\", \"call-part2.mp3\"] }\n```\n\nEach entry is a file id or a file name. Every file must be the same kind:\n\n- **Audio** — the recordings are concatenated. `format` (`mp3`, `m4a` or `wav`) forces the output container; without it the inputs' own container is kept. The result is named `<first>.joined.<ext>`.\n- **PDF** — the documents are merged into one. The result is named `<first>.merged.pdf`.\n\nMixing audio with PDFs answers `400`. The files must be under 40 MB in total, otherwise the call answers `413 too_large`.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "201": {
            "description": "The joined file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1File"
                }
              }
            }
          },
          "400": {
            "description": "Mixed or unsupported file types (`invalid_request`)."
          },
          "404": {
            "description": "Unknown file."
          },
          "409": {
            "description": "Ambiguous name (`ambiguous_file_name`)."
          },
          "413": {
            "description": "More than 40 MB in total (`too_large`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1StitchBody"
              }
            }
          }
        }
      }
    },
    "/v1/files/{ref}/redline": {
      "post": {
        "operationId": "redlineFile",
        "tags": ["Tools"],
        "summary": "Open a redlining session on a Word document",
        "description": "Opens an editing session on a `.docx` file so you can rewrite it with tracked changes.\n\n```json\n{ \"ttl\": 86400 }\n```\n\n`ttl` is seconds until the session expires, from 60 to 604800 (one week); it defaults to the redlining service's own default. Nothing is stored back into your corpus until you call [flush](https://docs.cloudraker.com/api/cloud-raker-api/redline/flush-redline-session).\n\nOnly a Word document can be redlined. Everything else answers `422`.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "201": {
            "description": "The open session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineSession"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file."
          },
          "422": {
            "description": "The file is not a Word document."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RedlineBody"
              }
            }
          }
        }
      }
    },
    "/v1/redline/{sessionId}": {
      "get": {
        "operationId": "getRedlineSession",
        "tags": ["Redline"],
        "summary": "Get a redlining session",
        "description": "Returns an open session: when it expires, which revision it is at, and how many paragraphs, comments and tracked changes it holds.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "200": {
            "description": "The session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineSessionState"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown or expired session."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/redline/{sessionId}/content": {
      "get": {
        "operationId": "getRedlineContent",
        "tags": ["Redline"],
        "summary": "Read a session’s text",
        "description": "Returns the document as a list of blocks, each with the `blockId` an edit can anchor to.\n\n`?view` picks which text you get: `accepted` (tracked changes applied, the default), `baseline` (the text before any change), or `current` (insertions and deletions both shown).\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "200": {
            "description": "The blocks.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineContent"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown or expired session."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "view",
            "schema": {
              "type": "string",
              "enum": ["accepted", "current", "baseline"]
            }
          }
        ]
      }
    },
    "/v1/redline/{sessionId}/edits": {
      "post": {
        "operationId": "applyRedlineEdits",
        "tags": ["Redline"],
        "summary": "Edit a session",
        "description": "Applies one edit to the document, as a tracked change by default.\n\n```json\n{ \"op\": \"replace\", \"anchorText\": \"thirty (30) days\", \"replacement\": \"sixty (60) days\" }\n```\n\nFour operations: `replace` and `deleteText` act on anchor text, `fill` applies a list of replacements in one pass, and `insertMarkdown` adds new paragraphs before or after an anchor (or at the end). Set `tracked: false` to write the change silently instead.\n\nThe response carries the new `revision` and the ids of the tracked changes the edit produced. Those ids are positional and only valid at that revision.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "200": {
            "description": "The edit outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineMutation"
                }
              }
            }
          },
          "400": {
            "description": "The edit is malformed, or its anchor matched nothing."
          },
          "404": {
            "description": "Unknown or expired session."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RedlineEdit"
              }
            }
          }
        }
      }
    },
    "/v1/redline/{sessionId}/suggestions": {
      "get": {
        "operationId": "listRedlineSuggestions",
        "tags": ["Redline"],
        "summary": "List the tracked changes",
        "description": "Lists every tracked change in the session — who made it, where it sits, and a snippet of what it says.\n\nRead this immediately before accepting or rejecting: the ids are positional, so any edit in between renumbers them.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "200": {
            "description": "The tracked changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineSuggestionList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown or expired session."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/redline/{sessionId}/suggestions/apply": {
      "post": {
        "operationId": "applyRedlineSuggestions",
        "tags": ["Redline"],
        "summary": "Accept or reject tracked changes in bulk",
        "description": "Accepts and rejects several tracked changes in one call.\n\n```json\n{ \"accept\": [\"tc1\", \"tc2\"], \"reject\": [\"tc5\"] }\n```\n\n`?revision` is the session revision you read the `tc` ids at. Suggestion ids are POSITIONAL — any edit renumbers them — so passing it turns a stale id into a `409 revision_conflict` instead of a silent hit on the wrong change.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "200": {
            "description": "The new revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineMutation"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown or expired session."
          },
          "409": {
            "description": "The ids were read at an older revision (`revision_conflict`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "revision",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ApplySuggestionsBody"
              }
            }
          }
        }
      }
    },
    "/v1/redline/{sessionId}/suggestions/{tcId}/accept": {
      "post": {
        "operationId": "acceptRedlineSuggestion",
        "tags": ["Redline"],
        "summary": "Accept one tracked change",
        "description": "Accepts a single tracked change, by its `tc` id.\n\n`?revision` is the session revision you read the `tc` ids at. Suggestion ids are POSITIONAL — any edit renumbers them — so passing it turns a stale id into a `409 revision_conflict` instead of a silent hit on the wrong change.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "200": {
            "description": "The new revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineMutation"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown session or tracked change."
          },
          "409": {
            "description": "The id was read at an older revision (`revision_conflict`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "tcId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "revision",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ]
      }
    },
    "/v1/redline/{sessionId}/suggestions/{tcId}/reject": {
      "post": {
        "operationId": "rejectRedlineSuggestion",
        "tags": ["Redline"],
        "summary": "Reject one tracked change",
        "description": "Rejects a single tracked change, by its `tc` id.\n\n`?revision` is the session revision you read the `tc` ids at. Suggestion ids are POSITIONAL — any edit renumbers them — so passing it turns a stale id into a `409 revision_conflict` instead of a silent hit on the wrong change.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "200": {
            "description": "The new revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineMutation"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown session or tracked change."
          },
          "409": {
            "description": "The id was read at an older revision (`revision_conflict`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "tcId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "revision",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          }
        ]
      }
    },
    "/v1/redline/{sessionId}/revisions": {
      "get": {
        "operationId": "listRedlineRevisions",
        "tags": ["Redline"],
        "summary": "List a session’s revisions",
        "description": "Lists every revision of the session, oldest first: what was done, by whom, and when.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "200": {
            "description": "The revisions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineRevisionList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown or expired session."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/redline/{sessionId}/comments": {
      "get": {
        "operationId": "listRedlineComments",
        "tags": ["Redline"],
        "summary": "List the comments",
        "description": "Lists every comment in the document — author, date, body, the block it anchors to, and whether its thread is resolved. Replies carry a `parentId` pointing at the comment they answer.\n\n`?openOnly=true` returns only unresolved threads.\n\nComment ids (`cN`) are stable across edits — unlike `tc` suggestion ids, they never renumber.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "200": {
            "description": "The comments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineCommentList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown or expired session."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "openOnly",
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "post": {
        "operationId": "addRedlineComment",
        "tags": ["Redline"],
        "summary": "Comment on the text an anchor resolves to",
        "description": "Adds a comment anchored to the text `anchorText` matches.\n\n```json\n{ \"anchorText\": \"thirty (30) days\", \"body\": \"Sixty days is the market standard here.\" }\n```\n\n`occurrence` (1-based) picks a match when the anchor is ambiguous. `author` names the comment's author in Word's review pane; it defaults to `CloudRaker`.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "201": {
            "description": "The new comment id and revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineCommentMutation"
                }
              }
            }
          },
          "400": {
            "description": "The anchor matched nothing."
          },
          "404": {
            "description": "Unknown or expired session."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1AddRedlineCommentBody"
              }
            }
          }
        }
      }
    },
    "/v1/redline/{sessionId}/comments/{commentId}/reply": {
      "post": {
        "operationId": "replyRedlineComment",
        "tags": ["Redline"],
        "summary": "Reply in a comment thread",
        "description": "Adds a reply under an existing comment, by its `c` id.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "201": {
            "description": "The reply id and revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineCommentMutation"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown session or comment."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "commentId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RedlineCommentReplyBody"
              }
            }
          }
        }
      }
    },
    "/v1/redline/{sessionId}/comments/{commentId}/resolve": {
      "post": {
        "operationId": "resolveRedlineComment",
        "tags": ["Redline"],
        "summary": "Resolve or reopen a comment thread",
        "description": "Marks a whole thread resolved (`resolved` defaults to `true`) or reopens it (`\"resolved\": false`). Resolving a comment resolves its replies too.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "200": {
            "description": "The new revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineCommentMutation"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown session or comment."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "commentId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RedlineCommentResolveBody"
              }
            }
          }
        }
      }
    },
    "/v1/redline/{sessionId}/comments/{commentId}": {
      "delete": {
        "operationId": "deleteRedlineComment",
        "tags": ["Redline"],
        "summary": "Delete a comment and its replies",
        "description": "Removes a comment thread from the document entirely. To keep it but mark it handled, [resolve](https://docs.cloudraker.com/api/cloud-raker-api/redline/resolve-redline-comment) it instead.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "200": {
            "description": "The new revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineCommentMutation"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown session or comment."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "commentId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/redline/{sessionId}/flush": {
      "post": {
        "operationId": "flushRedlineSession",
        "tags": ["Redline"],
        "summary": "Save a session back as a file",
        "description": "Exports the session as a `.docx` — tracked changes and all — and stores it as a new file next to the document it came from.\n\n```json\n{ \"fileId\": \"msa.docx\" }\n```\n\n`fileId` is the file the session was opened on, by id or by name. It must BE that file: a session that was opened on a different document answers `409 redline_file_mismatch`. The new file is named `<original>.redlined.docx` and carries `parentFileId` pointing back at it.\n\nA NAME is resolved in the org API workspace only — there is no cross-space name index. A file that lives in an explicit space must be flushed by its id.\n\nThe session stays open: flush as often as you like, then let it expire or delete it.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "201": {
            "description": "The saved file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1File"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown session or file."
          },
          "409": {
            "description": "The session was opened on another file (`redline_file_mismatch`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sessionId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1FlushRedlineBody"
              }
            }
          }
        }
      }
    },
    "/v1/compose": {
      "post": {
        "operationId": "compose",
        "tags": ["Compose"],
        "summary": "Compose a document from a template and data",
        "description": "Renders one of your saved compose templates with the data you pass, and gives you back a PDF.\n\n`template` is the config id or slug from [POST /v1/compose/configs](https://docs.cloudraker.com/capabilities/compose). `data` is validated against that template's JSON Schema BEFORE anything renders, so a missing field costs you a `422` with the exact instance paths, not a broken document.\n\n```json\n{ \"template\": \"invoice\", \"data\": { \"customer\": \"Acme\", \"total\": 1240 } }\n```\n\n`output` decides what comes back:\n\n- `file` (the default) stores the PDF in your corpus and returns the file object, with the `templateHash` of the exact bundle that produced it.\n- `raw` streams the PDF bytes straight back and stores nothing.\n\n**Learn more:** [Compose](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "200": {
            "description": "The PDF bytes (`output: \"raw\"` only — nothing was stored).",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "The composed file (`output: \"file\"`, the default).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ComposedFile"
                }
              }
            }
          },
          "400": {
            "description": "The reference is not a compose template (`capability_mismatch`)."
          },
          "404": {
            "description": "Unknown template."
          },
          "422": {
            "description": "The data does not satisfy the template schema (`invalid_data`, with `errors[]`), the template has no `main`/files (`config_incomplete`), or it failed to compile (`template_render_failed`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ComposeBody"
              }
            }
          }
        }
      }
    },
    "/v1/compose/batch": {
      "post": {
        "operationId": "composeBatch",
        "tags": ["Compose"],
        "summary": "Compose many documents from one template",
        "description": "Renders the same template once per item — a run of invoices, contracts or letters from one call.\n\nEvery item's `data` is validated first. If ANY item fails, nothing renders and the call answers `422` with an `errors[]` naming the failing item indexes and instance paths: a half-finished batch is worse than none.\n\n```json\n{\n  \"template\": \"invoice\",\n  \"items\": [\n    { \"name\": \"acme-0042\", \"data\": { \"customer\": \"Acme\", \"total\": 1240 } },\n    { \"name\": \"globex-0043\", \"data\": { \"customer\": \"Globex\", \"total\": 990 } }\n  ]\n}\n```\n\n`output` decides what comes back:\n\n- `files` (the default) stores each PDF and returns the list. An item's `name` names its file (`<name>.pdf`); without one the files are numbered from the template slug.\n- `zip` stores ONE archive holding every PDF and returns that single file.\n\nA `name` must be a bare file name — no `/`, no `\\`, no `..`, no leading dot — and two items may not end up with the same file name.\n\n**Learn more:** [Compose](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "201": {
            "description": "The composed files, or the single zip file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ComposedFileList"
                }
              }
            }
          },
          "400": {
            "description": "The reference is not a compose template (`capability_mismatch`)."
          },
          "404": {
            "description": "Unknown template."
          },
          "413": {
            "description": "The rendered documents exceed the per-call output limit (`output_too_large`) — split the batch."
          },
          "422": {
            "description": "At least one item fails the template schema (`invalid_data`, with `errors[]` carrying `index`), two items share a file name (`duplicate_item_names`), an item `name` is not a bare file name (`invalid_item_name`), or the template is incomplete or failed to compile."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ComposeBatchBody"
              }
            }
          }
        }
      }
    },
    "/v1/compose/configs/{idOrSlug}/files": {
      "get": {
        "operationId": "listComposeTemplateFiles",
        "tags": ["Compose"],
        "summary": "List a template’s source files",
        "description": "Lists the files in this template's bundle, in manifest order — the editor's file pane.\n\nDownload one with [GET /v1/compose/configs/{id}/files/{fileId}/content](https://docs.cloudraker.com/capabilities/compose).\n\n<Note>\nA file removed from your template library is dropped from this list instead of failing it, so a template with a stale entry stays repairable.\n</Note>\n\n**Learn more:** [Compose](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "200": {
            "description": "The bundle files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ComposeBundleFileList"
                }
              }
            }
          },
          "400": {
            "description": "Not a compose template (`capability_mismatch`)."
          },
          "404": {
            "description": "Unknown template."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      },
      "put": {
        "operationId": "putComposeTemplateFile",
        "tags": ["Compose"],
        "summary": "Add or replace a file in a template’s bundle",
        "description": "Registers a new file in your organization's template library and puts it in this template's bundle under `name`. A file already in the bundle under that name is swapped out.\n\nTwo request shapes:\n\n- `{ name, content }` — the text of a source file, stored for you (up to 2 MB).\n- `{ name, mimeType }` — for binary assets: the file is registered and the response carries `uploadUrl`; `PUT` the bytes there with a `Content-Type` exactly equal to the `mimeType` you sent.\n\nThe replaced file is detached, never deleted — anything that already rendered with it keeps working.\n\n**Learn more:** [Compose](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "200": {
            "description": "The created file, now in the bundle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ComposeBundleFile"
                }
              }
            }
          },
          "400": {
            "description": "Not a compose template (`capability_mismatch`)."
          },
          "404": {
            "description": "Unknown template."
          },
          "422": {
            "description": "The bundle is full (`too_many_files`), or the file is a font format the renderer cannot read (`unsupported_file_type`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ComposeAddFileBody"
              }
            }
          }
        }
      }
    },
    "/v1/compose/configs/{idOrSlug}/files/{fileId}/content": {
      "get": {
        "operationId": "getComposeTemplateFile",
        "tags": ["Compose"],
        "summary": "Download one of a template’s source files",
        "description": "Returns the bytes of a file in this template's bundle — the `.typ` source an editor loads, or an asset it previews.\n\nOnly files in THIS template's bundle are reachable; any other id answers `404`.\n\n**Learn more:** [Compose](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "200": {
            "description": "The file bytes."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown template, or a file outside this template’s bundle."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "fileId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/compose/configs/{idOrSlug}/files/{fileId}": {
      "delete": {
        "operationId": "deleteComposeTemplateFile",
        "tags": ["Compose"],
        "summary": "Remove a file from a template’s bundle",
        "description": "Takes a file out of this template's bundle. The file itself stays in your template library — this only unlinks it.\n\nRemoving the file that `main` names would leave the template unrenderable, so that answers `422` unless the same call names the new entry point with `?main=`.\n\n**Learn more:** [Compose](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "200": {
            "description": "The updated template config.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ComposeConfigObject"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown template, or a file outside this template’s bundle."
          },
          "422": {
            "description": "The file is the template’s `main` (`main_not_in_files`), or the new `main` is not a `.typ` source (`main_not_typst`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "fileId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "main",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ]
      }
    },
    "/v1/compose/configs/{idOrSlug}/preview": {
      "post": {
        "operationId": "previewComposeTemplate",
        "tags": ["Compose"],
        "summary": "Render a template’s example",
        "description": "Renders the template with one of its saved examples and returns the PDF bytes — the editor's preview button.\n\n`example` names the example to use; without it the first one is rendered. A template with no examples at all still previews — it renders with empty data `{}`, which is what a fresh template's static content needs.\n\nA template with no files or no `main` answers `422 config_incomplete`; a name that matches no saved example answers `404 example_not_found`.\n\n**Learn more:** [Compose](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "200": {
            "description": "The rendered PDF.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown template, or no example by that name (`example_not_found`)."
          },
          "422": {
            "description": "The template has no files or no `main` (`config_incomplete`), or it failed to compile."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ComposePreviewBody"
              }
            }
          }
        }
      }
    },
    "/v1/compose/configs/{idOrSlug}/lint": {
      "post": {
        "operationId": "lintComposeTemplate",
        "tags": ["Compose"],
        "summary": "Check a template for problems",
        "description": "Compiles the template for diagnostics only — nothing is rendered or stored.\n\nThe answer carries `diagnostics` (compile errors and warnings, with file and line), the assets the sources reference and which of them are `missing`, and the fonts they use and which are `unresolved`. An empty `diagnostics` with nothing missing means the template renders.\n\n**Learn more:** [Compose](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "200": {
            "description": "The diagnostics."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown template."
          },
          "422": {
            "description": "The template has no files or no `main` (`config_incomplete`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "idOrSlug",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/agents": {
      "get": {
        "operationId": "listAgents",
        "tags": ["Agents"],
        "summary": "List agents",
        "description": "Lists the agents your organization can run.\n\nAn agent is a reviewed, versioned automation: a list of steps, some done by the agent itself and some by a person, plus the saved actions it may take and where a human sign-off is required. Only active agents appear here.\n\nEach entry carries:\n\n| Field | What it tells you |\n| --- | --- |\n| `tasks[]` | The step ledger — `executor: \"human\"` marks the ones a person completes |\n| `actions[]` | What the agent may do, and its `approval` gate |\n| `version` | The revision a new run will snapshot |\n\nStart one with [POST /v1/agent-runs](https://docs.cloudraker.com/api/cloud-raker-api/agents/create-agent-run).\n\n<Note>\nAn agent's `id` is opaque — treat it as a string and do not parse it.\n</Note>\n\n    **Learn more:** [Agents guide](https://docs.cloudraker.com/capabilities/agents)",
        "responses": {
          "200": {
            "description": "The agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentList"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/{id}": {
      "get": {
        "operationId": "getAgent",
        "tags": ["Agents"],
        "summary": "Get an agent",
        "description": "Returns one agent: its steps, the actions it may take, their approval gates, and the `version` a new run will snapshot.\n\nRead this before starting a run to know which steps will come back to you as human work, and which actions will ask for a sign-off.\n\n<Note>\nAn agent's `id` is opaque — treat it as a string and do not parse it.\n</Note>\n\n    **Learn more:** [Agents guide](https://docs.cloudraker.com/capabilities/agents)",
        "responses": {
          "200": {
            "description": "The agent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Agent"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown agent id, or an agent that is not active."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/agent-runs": {
      "post": {
        "operationId": "createAgentRun",
        "tags": ["Agents"],
        "summary": "Start an agent run",
        "description": "Starts an [agent](https://docs.cloudraker.com/api/cloud-raker-api/agents/get-agent) on a set of files and returns the run.\n\n```json\n{\n  \"agent\": \"01JQ8ZKMRT4V6WXYZ0ABCDEFGH\",\n  \"files\": [{ \"url\": \"https://example.com/intake.pdf\" }],\n  \"metadata\": { \"caseId\": \"42\" }\n}\n```\n\n**Files** take the usual two shapes: `{ \"url\": \"…\" }` registers the file and fetches it, `{ \"id\": \"…\" }` reuses one you already registered with [POST /v1/files](https://docs.cloudraker.com/api/cloud-raker-api/files/create-file). Files you pass by URL join your reusable corpus, so a long-running agent never loses its inputs.\n\n**Waiting for the result.** The call holds open up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately) and releases early the moment the run either finishes or blocks on a person.\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Files still being prepared | `202` with `status: \"queued\"` |\n| Still working at the cap | `202` with `{object, id, status, statusUrl}` |\n| Blocked on a person | `202` right away, `status: \"waiting\"` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/agents/get-agent-run); the run id is yours from this response on either way.\n\nA `queued` run is not working yet: its files are still being prepared, which for scanned documents or long audio can take minutes, and **reading the run is what picks it up** once they are ready. So a `queued` run has to be polled — waiting on a webhook instead leaves it queued, because a run that has not started has nothing to report. Once it is running, its events are delivered as they happen.\n\nAgent runs are long-lived: one blocked on a person waits days, up to the `expiresAt` on the run (about seven days), after which an unfinished run parks itself for good. Its files, and anything it already filed, are never taken back. Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Agents guide](https://docs.cloudraker.com/capabilities/agents)",
        "parameters": [
          {
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "description": "Retries with the same key replay the first applied mutation.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately."
          }
        ],
        "responses": {
          "200": {
            "description": "The finished run.",
            "headers": {
              "idempotent-replay": {
                "description": "`true` when this response replays an earlier request.",
                "schema": {
                  "type": "string",
                  "enum": ["true"]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — queued on its files, still working, or blocked on a person.",
            "headers": {
              "idempotent-replay": {
                "description": "`true` when this response replays an earlier request.",
                "schema": {
                  "type": "string",
                  "enum": ["true"]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request`)."
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown agent id (`agent_not_found`)."
          },
          "422": {
            "description": "The agent cannot start (`agent_inactive`, `agent_unavailable`), or an input file is unusable (`file_not_found`, `file_fetch_failed`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateAgentRunBody"
              }
            }
          }
        }
      }
    },
    "/v1/agents/{id}/invoke": {
      "post": {
        "operationId": "invokeAgent",
        "tags": ["Agents"],
        "summary": "Invoke an agent",
        "description": "Runs an agent on an instruction — the prompt-shaped door. Give it `input` in plain words and, optionally, `files`; the agent plans and executes from there. This is the same runtime as `POST /v1/agent-runs`, minus the requirement to lead with files.\n\n**Sync by default.** `?wait=<seconds>` (default 60, max 120) holds the request; a run that outlives the window answers `202` with a `statusUrl` to poll. Steering, approvals, tasks, timeline and result all use the existing `/v1/agent-runs/{id}` surface.\n\n**Learn more:** [Agents guide](https://docs.cloudraker.com/capabilities/agents)",
        "responses": {
          "200": {
            "description": "The run finished (or blocked on a person) inside the wait window.",
            "headers": {
              "idempotent-replay": {
                "description": "`true` when this response replays an earlier request.",
                "schema": {
                  "type": "string",
                  "enum": ["true"]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still working.",
            "headers": {
              "idempotent-replay": {
                "description": "`true` when this response replays an earlier request.",
                "schema": {
                  "type": "string",
                  "enum": ["true"]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request`)."
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown agent id (`agent_not_found`)."
          },
          "422": {
            "description": "The agent cannot start (`agent_inactive`, `agent_unavailable`), or an input file is unusable (`file_not_found`, `file_fetch_failed`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1InvokeAgentBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/agent-runs/{id}": {
      "get": {
        "operationId": "getAgentRun",
        "tags": ["Agents"],
        "summary": "Get an agent run",
        "description": "Returns an agent run: where it is, the state of every step, what it is waiting on, and what it produced.\n\n- **`tasks[]`** is the step ledger. `executor: \"human\"` steps are yours to complete; `summary` is what the agent recorded when a step closed.\n- **`approvals[]`** lists the sign-offs the run is blocked on, each with the proposed `params` and `files`.\n- **`waiting`** counts both at a glance while `status` is `waiting`.\n- **`result`** and **`output.files`** carry the outcome.\n- **`agent.id`** and **`input.files`** are the immutable recipe for starting a successor after any terminal result.\n\n**Long-polling.** `?wait=<seconds>` (0–120) holds the request until the run finishes or blocks on a person.\n\n<Note>\nA `paused` run is not a failure: it stopped short, kept everything it produced, and can be started again. Nothing an agent run imported or attached is ever taken back.\n\nReading a `queued` run is also what starts it once its files are ready, so poll it rather than waiting. `expiresAt` is the run's deadline — an unfinished run parks itself for good when it passes, so a human step has to land before then.\n</Note>\n\n<Note>\n**Run scope is changing.** Today any API key of your organization may read and steer any agent run of that organization. Turn on the organization feature flag `v1_scoped_runs` and each key sees only the runs it created; a run created before you turned it on keeps answering every key. Scoping becomes the default in a future release, so give each integration its own key now.\n</Note>\n\n**Learn more:** [Agents guide](https://docs.cloudraker.com/capabilities/agents)",
        "responses": {
          "200": {
            "description": "The run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRun"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id (or a run belonging to another organization)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately."
          }
        ]
      }
    },
    "/v1/agent-runs/{id}/steer": {
      "post": {
        "operationId": "steerAgentRun",
        "tags": ["Agents"],
        "summary": "Guide an agent run",
        "description": "Adds guidance to a live run. `?wait=` follows the same 0–120 second convention as starting and reading a run.",
        "parameters": [
          {
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "description": "Retries with the same key replay the first applied mutation.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately."
          }
        ],
        "responses": {
          "200": {
            "description": "The run state after accepting the guidance.",
            "headers": {
              "idempotent-replay": {
                "description": "`true` when this response replays an earlier request.",
                "schema": {
                  "type": "string",
                  "enum": ["true"]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRunControl"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id."
          },
          "409": {
            "description": "The run is no longer running or its guidance queue is full."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1AgentRunControlBody"
              }
            }
          }
        }
      }
    },
    "/v1/agent-runs/{id}/pause": {
      "post": {
        "operationId": "pauseAgentRun",
        "tags": ["Agents"],
        "summary": "Pause an agent run",
        "description": "Interrupts a run at its next safe point without discarding its work.",
        "parameters": [
          {
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "description": "Retries with the same key replay the first applied mutation.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately."
          }
        ],
        "responses": {
          "200": {
            "description": "The run state after the pause request.",
            "headers": {
              "idempotent-replay": {
                "description": "`true` when this response replays an earlier request.",
                "schema": {
                  "type": "string",
                  "enum": ["true"]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRunControl"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id."
          },
          "409": {
            "description": "The run cannot be paused in its current state."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/agent-runs/{id}/resume": {
      "post": {
        "operationId": "resumeAgentRun",
        "tags": ["Agents"],
        "summary": "Resume an agent run",
        "description": "Continues a paused run from its durable state.",
        "parameters": [
          {
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "description": "Retries with the same key replay the first applied mutation.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately."
          }
        ],
        "responses": {
          "200": {
            "description": "The run state after resuming.",
            "headers": {
              "idempotent-replay": {
                "description": "`true` when this response replays an earlier request.",
                "schema": {
                  "type": "string",
                  "enum": ["true"]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRunControl"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id."
          },
          "409": {
            "description": "The run cannot be resumed in its current state."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/agent-runs/{id}/cancel": {
      "post": {
        "operationId": "cancelAgentRun",
        "tags": ["Agents"],
        "summary": "Cancel an agent run",
        "description": "Stops a run permanently. Work it already completed is retained.",
        "parameters": [
          {
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "description": "Retries with the same key replay the first applied mutation.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately."
          }
        ],
        "requestBody": {
          "required": false,
          "description": "An optional reason for cancelling.",
          "content": {
            "application/json": {
              "schema": {
                "default": {},
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The cancelled run state.",
            "headers": {
              "idempotent-replay": {
                "description": "`true` when this response replays an earlier request.",
                "schema": {
                  "type": "string",
                  "enum": ["true"]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRunControl"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id."
          },
          "409": {
            "description": "The run cannot be cancelled in its current state."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/agent-runs/{id}/timeline": {
      "get": {
        "operationId": "getAgentRunTimeline",
        "tags": ["Agents"],
        "summary": "Get an agent run timeline",
        "description": "Returns the durable event history in order. Use the last event id as `after` to fetch the next page. Events caused by someone identifiable carry an `actor` (`member`, `agent`, `api_key`, `automation`, `embed` or `external`); an embed-token actor has no name.",
        "responses": {
          "200": {
            "description": "A page of timeline events.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRunTimeline"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "after",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ]
      }
    },
    "/v1/agent-runs/{id}/stream": {
      "get": {
        "operationId": "streamAgentRun",
        "tags": ["Agents"],
        "summary": "Stream an agent run live",
        "description": "Server-sent events for a run, live: `text/event-stream` with three event kinds.\n\n- `timeline` — a durable event, same shape as `GET /v1/agent-runs/{id}/timeline`, with the SSE `id` set to the event id. Delivery is at-least-once: dedupe by id, and reconnect with `Last-Event-ID` to resume.\n- `live` — provisional activity while the agent works: `{kind: \"text_delta\", stepId, text}` streams the agent's words as it writes them; `{kind: \"tool_started\"|\"tool_finished\", toolCallId, toolName, ok?}` announce tool activity. Never durable — a reconnect replays none of it.\n- `status` — `{status}` in the run-status vocabulary, sent on connect and on every change. Terminal status ends the stream.\n\nStreams are capped at five minutes — reconnect to continue; `Last-Event-ID` carries the durable cursor. Reading a `queued` run's stream starts it, exactly like reading the run. curl it: `curl -N -H \"authorization: Bearer $KEY\" …/v1/agent-runs/agr_…/stream`\n\n**Learn more:** [Agents guide](https://docs.cloudraker.com/capabilities/agents)",
        "responses": {
          "200": {
            "description": "The event stream (`text/event-stream`)."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/agent-runs/{id}/result": {
      "get": {
        "operationId": "getAgentRunResult",
        "tags": ["Agents"],
        "summary": "Get an agent run result",
        "description": "Returns the durable terminal result. While the run is active, retry the status URL.",
        "responses": {
          "200": {
            "description": "The terminal result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRunResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id."
          },
          "409": {
            "description": "The run has not reached a terminal state (`result_not_ready`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/agent-runs/{id}/approvals/{approvalId}": {
      "post": {
        "operationId": "decideAgentRunApproval",
        "tags": ["Agents"],
        "summary": "Approve or reject a step",
        "description": "Answers a sign-off an agent run is waiting on, and lets the run carry on.\n\nRead the outstanding ones from `approvals[]` on [the run](https://docs.cloudraker.com/api/cloud-raker-api/agents/get-agent-run) — each carries the step's name, the files it touches and, for a `before` gate, the `params` it proposes.\n\n```json\n{ \"decision\": \"approve\" }\n```\n\n**Rejecting needs a reason.** `{ \"decision\": \"reject\", \"note\": \"Wrong signer.\" }` — a rejection without a `note` is a `400`.\n\n**Editing before you approve.** Send `params` to replace the proposed inputs, `files` to replace the files the step works on (ids from [POST /v1/files](https://docs.cloudraker.com/api/cloud-raker-api/files/create-file) or the run's own inputs). The two together must stay under 1 MiB.\n\nThe response carries the decision plus `run.status`, so you know whether the run moved on, finished, or is blocked on the next thing. `?wait=` holds the request while the run picks the work back up, releasing early the moment it finishes or blocks again.\n\nDeciding the same sign-off twice is a `409` — the first answer stands.\n\n<Note>\nAn API key has no person behind it, so the run records your organization's key as the actor rather than a named individual.\n</Note>\n\n**Learn more:** [Agents guide](https://docs.cloudraker.com/capabilities/agents)",
        "parameters": [
          {
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "description": "Retries with the same key replay the first applied mutation.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "approvalId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately."
          }
        ],
        "responses": {
          "200": {
            "description": "The decision, and where the run stands after it.",
            "headers": {
              "idempotent-replay": {
                "description": "`true` when this response replays an earlier request.",
                "schema": {
                  "type": "string",
                  "enum": ["true"]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRunApprovalDecision"
                }
              }
            }
          },
          "400": {
            "description": "A rejection with no reason, or edits over 1 MiB (`invalid_request`)."
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id (`not_found`), unknown sign-off (`approval_not_found`), or a file id that is not yours (`not_found`)."
          },
          "409": {
            "description": "Already decided (`approval_decided`), the run has not started yet (`run_not_started`), or it is no longer running (`run_not_running`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1DecideAgentRunApprovalBody"
              }
            }
          }
        }
      }
    },
    "/v1/agent-runs/{id}/tasks/{taskId}/complete": {
      "post": {
        "operationId": "completeAgentRunTask",
        "tags": ["Agents"],
        "summary": "Complete a human step",
        "description": "Marks one of the run's `executor: \"human\"` steps done, which releases everything waiting on it.\n\n```json\n{ \"note\": \"Client signed; scan attached.\", \"files\": [\"file_01JQ8ZKMRT4V6WXYZ0ABCDEF\"] }\n```\n\nBoth fields are optional. `files` are ids you [registered](https://docs.cloudraker.com/api/cloud-raker-api/files/create-file) or that the run already holds; they are attached to the step and show up in the run's `output.files`.\n\nOnly human steps are completable — an agent's own step answers `422`. A step whose dependencies are unfinished answers `409`, and so does one that is already done. The response carries the step plus `run.status`; `?wait=` holds the request while the run picks the work back up.\n\n<Note>\nAn API key has no person behind it, so the run records your organization's key as the actor rather than a named individual.\n</Note>\n\n**Learn more:** [Agents guide](https://docs.cloudraker.com/capabilities/agents)",
        "parameters": [
          {
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "description": "Retries with the same key replay the first applied mutation.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "taskId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately."
          }
        ],
        "responses": {
          "200": {
            "description": "The completed step, and where the run stands after it.",
            "headers": {
              "idempotent-replay": {
                "description": "`true` when this response replays an earlier request.",
                "schema": {
                  "type": "string",
                  "enum": ["true"]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRunTaskCompletion"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request`)."
          },
          "401": {
            "description": "Missing or invalid credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "403": {
            "description": "The credential is valid but cannot administer this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown run id (`not_found`), unknown step (`task_not_found`), or a file id that is not yours (`not_found`)."
          },
          "409": {
            "description": "Dependencies unfinished (`task_blocked`), already done (`task_resolved`), taken by someone else (`task_claimed`), or the run has not started yet (`run_not_started`)."
          },
          "422": {
            "description": "Not a human step (`task_not_completable`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CompleteAgentRunTaskBody"
              }
            }
          }
        }
      }
    },
    "/v1/work-sessions": {
      "post": {
        "operationId": "createWorkSession",
        "tags": ["Work Sessions"],
        "summary": "Open a work session",
        "description": "Opens a work session — one durable timeline that humans and named paperwork agents share.\n\nName the agents in `agents` (a handle such as `mike`, or an `agt_` id); each must have a published version. They are mentioned with your `description` and their turns start before this call returns — `startedTurnIds` names them, and `failedMentions` names any agent whose turn could not be started. Open with an empty `agents` to invite nobody, then post to `/entries` when you are ready.\n\nGive the session its working set in `fileIds`: every turn it runs is scoped to those files, so you never re-send them. With no `spaceIds` the session lives in your organization's API workspace.\n\nSet `webhookUrl` to receive this session's events at one https endpoint, signed exactly like every other delivery. Your saved `/v1/webhooks` subscriptions receive them too.\n\nAccess is scoped to the API key that opened the session: another key of the same organization gets `404` on every route here. Set `apiVisible: true` to let every key of your organization read and write it.\n\n**Learn more:** [Work sessions](https://docs.cloudraker.com/paperwork/api/overview)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWorkSessionBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The opened work session and the turns it started.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenedWorkSession"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "A named space or file does not exist, or you may not use it."
          },
          "422": {
            "description": "`agent_not_published` — a named agent has no published version."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "`turn_start_failed` — no invited agent could be started. Retry."
          }
        }
      }
    },
    "/v1/work-sessions/{id}": {
      "get": {
        "operationId": "getWorkSession",
        "tags": ["Work Sessions"],
        "summary": "Get a work session",
        "description": "Reads one work session: its status, the agents on it, the spaces and files it works with, and the counts a client polls.\n\nAnswers `404` for a session another API key opened, unless that key set `apiVisible: true`.\n\n**Learn more:** [Work sessions](https://docs.cloudraker.com/paperwork/api/overview)",
        "responses": {
          "200": {
            "description": "The work session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "Unknown session id, or it belongs to another API key."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          }
        ]
      }
    },
    "/v1/work-sessions/{id}/entries": {
      "get": {
        "operationId": "listWorkSessionEntries",
        "tags": ["Work Sessions"],
        "summary": "List a work session timeline",
        "description": "Reads the timeline in `seq` order, which is gapless and monotonic. Page forward with `afterSeq`; `nextAfterSeq` is the cursor for the next page, or `null` at the end.\n\nEvery entry is redacted before it leaves: a tool row keeps its name and loses its arguments and its result, and no signed URL or storage key is ever returned. Read a file through `GET /v1/files/{id}` instead.\n\n**Learn more:** [Work sessions](https://docs.cloudraker.com/paperwork/api/overview)",
        "responses": {
          "200": {
            "description": "One page of entries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionEntryPage"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "Unknown session id, or it belongs to another API key."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          },
          {
            "in": "query",
            "name": "afterSeq",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ]
      },
      "post": {
        "operationId": "appendWorkSessionEntry",
        "tags": ["Work Sessions"],
        "summary": "Post a message to a work session",
        "description": "Writes your message onto the timeline and starts one turn per agent you mention.\n\n`mentions` takes agent handles or ids. A handle that resolves to no published agent is returned in `unresolvedMentions` and starts nothing — it is never an error; an agent whose turn the platform could not start is returned in `failedMentions`, so you can retry that one. `startedTurnIds` names the turns this message began; a mention of an agent that is already working steers its live turn instead and is not listed. Files in `fileIds` join the session's working set for good.\n\nTurns start before the message is written, so a `turn_started` entry holds a lower `seq` than the message that caused it; the message names the turns it started.\n\n**Learn more:** [Work sessions](https://docs.cloudraker.com/paperwork/api/overview)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppendWorkSessionEntryBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The appended entry and the turns it started.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppendWorkSessionEntryResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "Unknown session id, or an attached file you may not read."
          },
          "409": {
            "description": "`session_has_no_space` — the session has no space to run a turn in."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "`turn_start_failed` — no mentioned agent could be started. Retry."
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          }
        ]
      }
    },
    "/v1/work-sessions/{id}/artifacts": {
      "get": {
        "operationId": "listWorkSessionArtifacts",
        "tags": ["Work Sessions"],
        "summary": "List the artifacts of a work session",
        "description": "Every document the session produced, oldest first. An artifact is `draft` until it is committed into a space. Page with `after`, which takes the previous page's last id; `nextCursor` is `null` at the end.\n\nFetch the bytes with `GET /v1/files/{fileId}`.\n\n**Learn more:** [Work sessions](https://docs.cloudraker.com/paperwork/api/overview)",
        "responses": {
          "200": {
            "description": "One page of artifacts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionArtifactPage"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "Unknown session id, or it belongs to another API key."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          },
          {
            "in": "query",
            "name": "after",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ]
      }
    },
    "/v1/work-sessions/{id}/approvals/{approvalId}": {
      "post": {
        "operationId": "decideWorkSessionApproval",
        "tags": ["Work Sessions"],
        "summary": "Decide an approval raised by a work session",
        "description": "Approves or rejects an action a turn proposed. The platform runs it; the agent never holds the credential. A rejection needs a `note` saying why — the agent reads it and takes another route.\n\nAn EGRESS approval releases a credentialed request the agent already formed, so its parameters cannot be edited (`422 egress_not_editable`) and only an approver the agent version names may decide it (`403 not_an_approver`).\n\nIf approval ownership cannot be resolved the call fails closed with `503`: releasing a credentialed request without that check is never safe.\n\n**Learn more:** [Work sessions](https://docs.cloudraker.com/paperwork/api/overview)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecideWorkSessionApprovalBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The decided approval."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "`not_an_approver` — this credential may not decide egress requests."
          },
          "404": {
            "description": "Unknown session or approval."
          },
          "422": {
            "description": "`egress_not_editable` — an egress approval cannot be edited; `note_required` — a rejection needs a reason."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "`approval_owner_unavailable` — ownership could not be resolved."
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          },
          {
            "in": "path",
            "name": "approvalId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          }
        ]
      }
    },
    "/v1/work-sessions/{id}/stream": {
      "get": {
        "operationId": "streamWorkSession",
        "tags": ["Work Sessions"],
        "summary": "Stream a work session live",
        "description": "Server-sent events for one session, live: `text/event-stream`.\n\n- `entry` — a durable timeline entry, redacted the same way `GET /entries` redacts it. The SSE `id` is the entry `seq`.\n- `turn.started`, `turn.finished`, `turn.failed` — an agent began, ended or failed a piece of work.\n- `approval.requested`, `approval.decided` — an action needs a person, or got one.\n- `artifact.created`, `artifact.committed` — a document was produced, or filed into a space.\n- `work_session.waiting`, `work_session.done` — the session needs you, or it has settled.\n- `ping` — a keep-alive every fifteen seconds.\n\nThe same ten type names arrive on your webhook, so one handler serves both. Streams end after five minutes; reconnect with `?afterSeq=` or the `Last-Event-ID` header to resume. A `done` session ends the stream. curl it: `curl -N -H \"authorization: Bearer $KEY\" …/v1/work-sessions/ws_…/stream`\n\n**Learn more:** [Work sessions](https://docs.cloudraker.com/paperwork/api/overview)",
        "responses": {
          "200": {
            "description": "The event stream (`text/event-stream`)."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "Unknown session id, or it belongs to another API key."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          }
        ]
      }
    },
    "/v1/work-sessions/{id}/artifacts/{artifactId}/compose": {
      "post": {
        "operationId": "composeWorkSessionArtifact",
        "tags": ["Work Sessions"],
        "summary": "Compose a markdown artifact into a PDF",
        "description": "Renders a `text/markdown` artifact into a PDF and files the PDF back onto the session as a new artifact, on the timeline, beside the markdown it came from.\n\nPass `configId` to render through one of your `/v1/compose` templates — the markdown arrives in the bundle as `body.typ`, which your template includes. Pass `styleProfileId` to render through one of your organization's style profiles instead — including the one marked default, which this route never applies on its own. With neither, the platform's own plain layout is used. Naming both answers `422 compose_target_ambiguous`.\n\nThe source must be `text/markdown`; anything else answers `422 artifact_not_markdown`.\n\nTwo rendering changes shipped with style profiles and apply to every call (RKO-766): CriticMarkup review comments and rejected suggestions (`{>> … <<}`, `{-- --}`) are stripped instead of printed, and GFM pipe tables render as tables instead of literal pipes.\n\n**Learn more:** [Work sessions](https://docs.cloudraker.com/paperwork/api/overview)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeWorkSessionArtifactBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The composed PDF artifact."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "Unknown session, artifact, compose config or style profile."
          },
          "422": {
            "description": "`artifact_not_markdown` — the source artifact is not markdown; `compose_target_ambiguous` — both targets were named; `template_render_failed` — the template did not compile."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          },
          {
            "in": "path",
            "name": "artifactId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "required": true
          }
        ]
      }
    },
    "/v1/paperwork-agents": {
      "get": {
        "operationId": "listPaperworkAgents",
        "tags": ["Paperwork Agents"],
        "summary": "List your paperwork agents",
        "description": "Lists the published paperwork agents of your organization — the named teammates you can put to work.\n\nEach entry carries its `handle` (mention it to wake it), its `name`, its `role` and its `harness`. An agent's instructions, tools, spaces and network policy stay private to your organization and never appear here.\n\nPage with `limit` (1-50) and `cursor`; `nextCursor` is `null` at the end.\n\n**Learn more:** [Paperwork agents](https://docs.cloudraker.com/paperwork/api/overview)",
        "responses": {
          "200": {
            "description": "One page of published agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaperworkAgentList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          }
        ]
      }
    },
    "/v1/paperwork-agents/{handle}/sessions": {
      "post": {
        "operationId": "startPaperworkAgentSession",
        "tags": ["Paperwork Agents"],
        "summary": "Put one paperwork agent to work",
        "description": "Opens a work session with one agent and hands it the job in a single call: the session is opened, the agent is mentioned, and its turn starts before the response returns.\n\n`{handle}` is the agent's handle (`mike`) or its `agt_` id. An unknown or unpublished agent answers `404`.\n\n`startedTurnIds` names the turn that began. Watch it at `streamUrl`, or set `webhookUrl` and receive the same events on your endpoint.\n\n**Learn more:** [Paperwork agents](https://docs.cloudraker.com/paperwork/api/overview)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartPaperworkAgentSessionBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The opened session and the turn it started.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartedPaperworkAgentSession"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "No such published agent, or a space or file you may not use."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "`turn_start_failed` — the agent could not be started. Retry."
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "handle",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          }
        ]
      }
    },
    "/v1/realtime/transcriptions": {
      "post": {
        "operationId": "createRealtimeTranscription",
        "tags": ["Realtime Transcriptions"],
        "summary": "Create a realtime transcription",
        "description": "Creates a live transcription session and returns a `websocket.url` for one client.\n\nCall this from your backend with your API key. Give `websocket.url` to the browser (or any client). The URL carries a single-use ticket that expires after 60 seconds. The client opens the socket and sends raw PCM16 little-endian audio, 16 kHz, mono, as binary frames. The session sends back `partial` and `final` text. The WebSocket upgrade is not an API operation: it is documented on the capability page, not here. Use `POST /v1/realtime/transcriptions/{id}/tickets` to get a new ticket for a reconnect.\n\n**Pricing.** A 5-credit session fee, charged when the first decoder joins, or when a session that no client connected to expires. Then 2 credits per started minute of decoded audio. When the session fails on our side (no capacity, no decoder), you pay nothing. With `finalPass: true`, the batch diarized transcription is billed by the normal audio meters on top (20 credits per minute, minimum 1 minute).\n\n**Data.** Montreal decode, North America session state, the final pass may run in the US; no residency guarantee. The server keeps no transcript: persist the finals your client receives. Without `finalPass`, no audio is kept after close.\n\n**Limits.** A session lasts at most 4 hours (2 hours with `finalPass`). It closes after 5 minutes without audio. It expires when no client connects within 10 minutes. A revoked API key does not end its live sessions.\n\nMCP code mode can create a session, but it cannot stream audio. Send an `idempotency-key`: a retry with the same key and body returns the same session with a fresh ticket and the `idempotent-replay: true` header.\n\n**Learn more:** [Realtime transcription](https://docs.cloudraker.com/capabilities/realtime-transcription)",
        "parameters": [
          {
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "description": "A retry with the same key and body returns the same session.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRealtimeTranscriptionBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The session, with `websocket` for the first client.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeTranscription"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request` — the body failed validation."
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "402": {
            "description": "`credits_exhausted`, or `feature_not_in_plan` — your plan does not include realtime transcription."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "409": {
            "description": "`idempotency_conflict` — the key was used with another body."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "`capacity_unavailable` — no capacity is free. Nothing was charged. Retry."
          }
        }
      },
      "get": {
        "operationId": "listRealtimeTranscriptions",
        "tags": ["Realtime Transcriptions"],
        "summary": "List realtime transcriptions",
        "description": "Lists your realtime transcriptions, newest first. An API key sees only the sessions it created.\n\n**Learn more:** [Realtime transcription](https://docs.cloudraker.com/capabilities/realtime-transcription)",
        "responses": {
          "200": {
            "description": "A page of sessions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeTranscriptionList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "pattern": "^rtt_[0-9A-HJKMNP-TV-Z]{26}$"
            }
          }
        ]
      }
    },
    "/v1/realtime/transcriptions/{id}": {
      "get": {
        "operationId": "getRealtimeTranscription",
        "tags": ["Realtime Transcriptions"],
        "summary": "Get a realtime transcription",
        "description": "Reads one session: its status, received audio, billed minutes and final pass. When `finalPass.status` is `ready`, read the transcript from `GET /v1/files/{fileId}`.\n\n**Learn more:** [Realtime transcription](https://docs.cloudraker.com/capabilities/realtime-transcription)",
        "responses": {
          "200": {
            "description": "The session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeTranscription"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "Unknown id, or another API key created it."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/realtime/transcriptions/{id}/tickets": {
      "post": {
        "operationId": "createRealtimeTranscriptionTicket",
        "tags": ["Realtime Transcriptions"],
        "summary": "Create a realtime transcription ticket",
        "description": "Returns a new `wss://` URL with a single-use ticket that expires after 60 seconds. Use it when a client must reconnect and has no `resumeTicket`. A newer ticket disconnects the client that holds an older one. This call is not billed.\n\n**Learn more:** [Realtime transcription](https://docs.cloudraker.com/capabilities/realtime-transcription) · [Create a realtime transcription](https://docs.cloudraker.com/api/cloud-raker-api/realtime-transcriptions/create-realtime-transcription)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRealtimeTranscriptionTicketBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The ticket URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeTranscriptionTicket"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request` — the body is not empty."
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "Unknown id, or another API key created it."
          },
          "409": {
            "description": "`session_closed` — the session is closing or closed."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/realtime/transcriptions/{id}/stop": {
      "post": {
        "operationId": "stopRealtimeTranscription",
        "tags": ["Realtime Transcriptions"],
        "summary": "Stop a realtime transcription",
        "description": "Stops the session. The decoder finishes the current utterance, the client gets its last finals, and the socket closes. A stop on a closed session answers `202` too.\n\n**Learn more:** [Realtime transcription](https://docs.cloudraker.com/capabilities/realtime-transcription)",
        "responses": {
          "202": {
            "description": "The session, now closing or already closed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeTranscription"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "Unknown id, or another API key created it."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/automations/{automationId}/run": {
      "post": {
        "operationId": "runAutomation",
        "tags": ["Automations"],
        "summary": "Run an automation now",
        "description": "Fires an automation immediately, exactly as its schedule would: the same thread, the same approval gate, the same fire-history row. Entitlement is checked at fire time. Takes the automation’s own id (`aut_…`). A run already live in the thread answers `busy`; one parked on an approval answers `needs_input`. An automation that has been migrated to a trigger keeps answering this URL: the trigger runs, in this same envelope. That fire is queued, so it answers `started` with `runId: null`; where `runId` is present it names the work session (`ws_…`) the fire opened, not a thread run.",
        "responses": {
          "200": {
            "description": "The fire outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationFire"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — unknown automation."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "automationId",
            "required": true
          }
        ]
      }
    },
    "/v1/embeds": {
      "post": {
        "operationId": "createEmbedSession",
        "tags": ["Embeds"],
        "summary": "Create an embed session",
        "description": "Creates a session for an embedded view and returns its iframe `url`.\n\nCall this from your backend with your API key. Put `url` in the `src` of an iframe on one of the `origins` pages. The URL carries a short-lived token in its fragment: treat it as a secret, and create a new session for each person and each visit.\n\nA `review` session binds one extraction run (`exr_…`) with unit `per_document` and 1 to 20 of its documents. In `write` mode the person can edit and approve values. `webhook` then receives each save and approval.\n\nA `transcript` or `document` session binds one ready `file`, in read mode. `transcript` needs a transcribed audio file. `document` needs a PDF, an office file with a preview, or an image.\n\nThe session ends at `expiresAt`: the earliest of now plus `ttl` and the run expiry. Call `DELETE /v1/embeds/{id}` to end it sooner.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEmbedBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The session, with the iframe `url`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbedSession"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request`: the body failed validation (theme, origins, webhook, ttl, or more than 20 documents)."
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "`not_found`: unknown run, file or space."
          },
          "409": {
            "description": "`result_not_ready`: the run has not finished. `review_closed`: the review state is gone, or less than 60 seconds remain. `file_not_ready`: the file is not ready."
          },
          "410": {
            "description": "`run_expired`: the run expired."
          },
          "422": {
            "description": "`unsupported_run`: not a `per_document` extraction run. `unknown_document`: a `documents` id is not a finished document of the run. `unsupported_file`: the file type does not fit the view."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "`embed_unconfigured`: embeds are not available right now."
          }
        }
      }
    },
    "/v1/embeds/{id}": {
      "delete": {
        "operationId": "revokeEmbedSession",
        "tags": ["Embeds"],
        "summary": "Revoke an embed session",
        "description": "Ends an embed session at once. The iframe stops loading data on its next request. Revoking a session that is already revoked also returns `204`.",
        "responses": {
          "204": {
            "description": "The session is revoked."
          },
          "401": {
            "description": "Missing or invalid credential."
          },
          "403": {
            "description": "The credential may not use the /v1 API."
          },
          "404": {
            "description": "`not_found`: unknown session id."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces": {
      "post": {
        "operationId": "createApiSpace",
        "tags": ["Spaces"],
        "summary": "Create a space",
        "description": "Creates a space: a named container for files and runs that you address explicitly.\n\nEverything the API does without a space happens in a hidden workspace where files are temporary and die with their run. Inside a space it is the other way round — files belong to the space, outlive the runs that produced them, and are indexed for [search](https://docs.cloudraker.com/developers/spaces).\n\n```json\n{ \"name\": \"Acme onboarding\", \"ttl\": 604800 }\n```\n\n**Lifetime.** `ttl` is seconds from now, from 300 to 7776000 (90 days), and defaults to one week. Once `expiresAt` passes the space is gone from this API: the next call that addresses it — or [DELETE /v1/spaces/{spaceId}](https://docs.cloudraker.com/developers/spaces) — closes it and deletes its files. Extend the deadline at any time with [PATCH /v1/spaces/{spaceId}](https://docs.cloudraker.com/developers/spaces).\n\n**Learn more:** [Spaces](https://docs.cloudraker.com/developers/spaces)",
        "responses": {
          "201": {
            "description": "The created space.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Space"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateSpaceBody"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listApiSpaces",
        "tags": ["Spaces"],
        "summary": "List spaces",
        "description": "Lists your organization's spaces, newest first.\n\n`?limit` caps the page (1–200, default 50). There is no cursor — paging is by `limit` only.\n\n`expiresAt` is `null` for a space created outside the API, which has no deadline.\n\n**Learn more:** [Spaces](https://docs.cloudraker.com/developers/spaces)",
        "responses": {
          "200": {
            "description": "The spaces.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1SpaceList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}": {
      "get": {
        "operationId": "getApiSpace",
        "tags": ["Spaces"],
        "summary": "Get a space",
        "description": "Returns a space and when it expires.\n\n**Learn more:** [Spaces](https://docs.cloudraker.com/developers/spaces)",
        "responses": {
          "200": {
            "description": "The space.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Space"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown, archived or expired space."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "spaceId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateApiSpace",
        "tags": ["Spaces"],
        "summary": "Rename a space or change its lifetime",
        "description": "Send `name`, `ttl`, or both.\n\n- `name` renames the space. The id does not change, so its files and runs stay attached.\n- `ttl` sets a new deadline: `expiresAt` becomes now plus `ttl` seconds, whether that extends the space or shortens it.\n\nOnly a space created with `POST /v1/spaces` can be changed here; any other space answers `404`.\n\n```json\n{ \"name\": \"Acme onboarding\", \"ttl\": 2592000 }\n```\n\n**Learn more:** [Spaces](https://docs.cloudraker.com/developers/spaces)",
        "responses": {
          "200": {
            "description": "The space.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Space"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request`)."
          },
          "404": {
            "description": "Unknown, archived, expired, or not an API-created space."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "spaceId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1UpdateSpaceBody"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteApiSpace",
        "tags": ["Spaces"],
        "summary": "Delete a space",
        "description": "Deletes every file in the space and closes it. Runs that already finished keep their results.\n\nThis is what expiry does when `expiresAt` passes — doing it by hand costs nothing extra. Only a space created with `POST /v1/spaces` can be deleted here; any other space answers `404`.\n\nRepeating the call is safe: on a very large space it deletes the next batch of leftover files, so calling it until it stops finding files always finishes the job.\n\n**Learn more:** [Spaces](https://docs.cloudraker.com/developers/spaces)",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown space, or not an API-created space."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "spaceId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/extract": {
      "post": {
        "operationId": "spaceExtract",
        "tags": ["Spaces"],
        "summary": "Extract structured data from documents",
        "description": "Runs JSON-Schema extraction with per-field citations over one or more files.\n\nSend exactly one of `file` or `files`, and at most one output shape:\n\n- **`schema`** — an inline JSON Schema object, written in the [extraction schema dialect](https://docs.cloudraker.com/capabilities/extract/schema).\n- **`action`** — a [saved action](https://docs.cloudraker.com/api/cloud-raker-api/actions/get-action) by id or slug. Inline config fields (`instructions`, `unit`, `judge`, …) are merged over the saved action's, so one saved action can be refined per call.\n- **neither** — the shape is inferred from the documents themselves. Add `hints` to steer it in prose. The finished run reports what was inferred as `config.schema`, ready to save as an action for the next run.\n\n**What you get back.** `output.value` holds the extracted object for a single-document run, `output.documents[]` one entry per file. Send `citations: true` to ground the result: `output.citations` then maps each extracted field to where it came from — `fileId` plus page and bounding box, or `timecodeStart`/`timecodeEnd` for audio, or `notFound: true` for a value the documents do not contain.\n\nAdd `?output=inline` to include each source file's parsed `markdown` and `json` alongside the extracted value. Signed `markdownUrl` / `jsonUrl` fields remain available; when the combined parsed source exceeds 1 MiB, the response falls back to those URLs only.\n\n```json\n{\n  \"file\": { \"url\": \"https://www.irs.gov/pub/irs-pdf/fw9.pdf\" },\n  \"schema\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"business_name\": { \"type\": [\"string\", \"null\"] },\n      \"tax_classification\": { \"type\": [\"string\", \"null\"] }\n    }\n  }\n}\n```\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Extraction guide](https://docs.cloudraker.com/capabilities/extract) · [Schema dialect](https://docs.cloudraker.com/capabilities/extract/schema)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ExtractRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ExtractBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          },
          {
            "in": "query",
            "name": "output",
            "schema": {
              "default": "urls",
              "type": "string",
              "enum": ["urls", "inline"]
            },
            "description": "How parsed source content is returned.\n\n`urls` returns signed download URLs. `inline` also returns markdown and parsed JSON when their combined payload is at most 1 MiB; larger content falls back to the URLs only."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/extract/batch": {
      "post": {
        "operationId": "spaceExtractBatch",
        "tags": ["Spaces"],
        "summary": "Extract from many files in one call",
        "description": "Runs one saved extraction action over up to 100 files, creating one ordinary run per file.\n\nA batch is fan-out sugar, not a new object: there is no batch id and nothing to poll for the batch as a whole. You get back a run id per file — read each one with [GET /v1/runs/{id}](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run), or list them together with [GET /v1/runs](https://docs.cloudraker.com/api/cloud-raker-api/runs/list-runs) using the `metadata` you attached.\n\n**A saved `action` is required.** Inline `schema` and `hints` are accepted on [POST /v1/extract](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/extract) only — running the same shape over a hundred files is exactly when that shape should be a reviewed, saved asset.\n\n`metadata`, `webhook`, `ttl` and `citations` are copied onto every run, so one webhook endpoint receives all of them and one flag grounds the whole batch.\n\n```json\n{\n  \"action\": \"invoice-fields\",\n  \"files\": [{ \"id\": \"a04d6597-…\" }, { \"url\": \"https://example.com/invoice-2.pdf\" }],\n  \"metadata\": { \"batch\": \"2026-07-25-invoices\" }\n}\n```\n\n**Always asynchronous.** The response is `202` right away. `runs[]` has one entry per file, in the order you sent them: `{id, statusUrl, file}` when the run was created, or `{file, error}` when that one file could not start — the other runs still stand, and `count` reports how many were created.\n\n<Note>\nThe whole batch costs a single request against your rate limit, however many files it fans out to.\n</Note>\n\n**Learn more:** [Extraction guide](https://docs.cloudraker.com/capabilities/extract)",
        "responses": {
          "202": {
            "description": "Accepted — one run per file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ExtractBatchAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request`)."
          },
          "422": {
            "description": "Unusable webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ExtractBatchBody"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/parse": {
      "post": {
        "operationId": "spaceParse",
        "tags": ["Spaces"],
        "summary": "Parse a document or audio file",
        "description": "Turns any document or audio file into clean markdown plus structured JSON — audio becomes a transcript.\n\nNothing else runs: parsing is the whole job, and `output` carries `markdownUrl` and `jsonUrl` (signed, ~1 hour). Add `?output=inline` for a one-call response that also carries `markdown` and parsed `json`. Inline source is capped at 1 MiB across both artifacts; larger output keeps the URLs only. Point `file` at a URL, or at a file you already registered with [POST /v1/files](https://docs.cloudraker.com/api/cloud-raker-api/files/create-file).\n\n**Choosing an engine** with `file.processing`:\n\n| Value | Use it for |\n| --- | --- |\n| `auto` | The default — self-upgrades to OCR when the page is a scan |\n| `ocr` | Force optical character recognition |\n| `simple` | Text-layer only, fastest |\n| `transcribe` | Audio and video |\n| `transcribe_diarize` | Audio and video, with speaker labels |\n\n```json\n{ \"file\": { \"url\": \"https://www.irs.gov/pub/irs-pdf/fw9.pdf\" } }\n```\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Parsing guide](https://docs.cloudraker.com/capabilities/parse)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ParseRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ParseBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          },
          {
            "in": "query",
            "name": "output",
            "schema": {
              "default": "urls",
              "type": "string",
              "enum": ["urls", "inline"]
            },
            "description": "How parsed source content is returned.\n\n`urls` returns signed download URLs. `inline` also returns markdown and parsed JSON when their combined payload is at most 1 MiB; larger content falls back to the URLs only."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/redact": {
      "post": {
        "operationId": "spaceRedact",
        "tags": ["Spaces"],
        "summary": "Permanently redact personal information",
        "description": "Destructively removes personal information from a document or an audio file and returns a new file.\n\nThe removal is real, not cosmetic: text is stripped out of the PDF content stream rather than covered with a black box, and audio is beeped or silenced with its transcript rewritten to match.\n\n**Routing is by the input's media type**, and the parameters are not interchangeable:\n\n- **Documents** — `mode`: `targeted` (default, per-entity boxes) or `lines` (whole lines).\n- **Audio and video** — `style`: `beep` or `silence`.\n\nSending the other medium's parameter is a `400`.\n\n**Choosing what to remove.** `categories` lists what counts as sensitive. A list you send **replaces** the [defaults](https://docs.cloudraker.com/capabilities/redact#what-counts-as-sensitive); it never adds to them, so narrowing the list leaves everything else in the file. `instructions` adds free-form guidance on top.\n\n**Reading the result.** `output.entities` counts what was removed, per category. Its keys are open, not a closed set: a finding your categories do not cover reports under its own label, such as `Passport number` or `MRN`. Iterate the map; never switch on a fixed set of keys. `output.skipped` counts the inputs that held nothing to redact. A skipped input produces no new file, so there is nothing to download for it.\n\n**One file per call.** `file` is singular, and `{ \"files\": […] }` is a `400`. To redact a set in one call, send a [pipeline](https://docs.cloudraker.com/capabilities/pipeline) with a single `{ \"redact\": … }` step.\n\n```json\n{\n  \"file\": { \"id\": \"a04d6597-4e34-4a99-94ea-964c289a4c68\" },\n  \"categories\": [\"ssn\", \"ein\"],\n  \"mode\": \"targeted\"\n}\n```\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Redaction guide](https://docs.cloudraker.com/capabilities/redact)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedactRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RedactBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/fill": {
      "post": {
        "operationId": "spaceFill",
        "tags": ["Spaces"],
        "summary": "Fill a form from values or source documents",
        "description": "Fills a form PDF and returns the completed file. Send exactly one of `values` or `files`:\n\n- `values` — the field values to write, keyed by field name. Deterministic: no drafting pass, no model call.\n- `files` — source documents the field values are drafted from.\n\n**Pick the form** with `template`, either shape:\n\n- `{ \"id\": \"…\" }` — a saved [template](https://docs.cloudraker.com/api/cloud-raker-api/templates/get-template), or any file you own.\n- `{ \"url\": \"…\" }` — fetched fresh for this run and purged with it.\n\n`template` is optional when `action` names a saved config that carries one; sending it inline still wins.\n\n**Shape the output** with `output`: `flattened` (default) bakes the values in, `editable` leaves the form fillable.\n\n```json\n{\n  \"files\": [{ \"id\": \"a04d6597-4e34-4a99-94ea-964c289a4c68\" }],\n  \"template\": { \"id\": \"23e0a865-0be9-45b1-a491-f1b6bd58a31a\" }\n}\n```\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Form filling guide](https://docs.cloudraker.com/capabilities/fill)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1FillRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1FillBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/sign": {
      "post": {
        "operationId": "spaceSign",
        "tags": ["Spaces"],
        "summary": "Collect e-signatures on a document",
        "description": "Sends a PDF out for signature and tracks the envelope until every required signing slot is complete.\n\nEach signer verifies their email with a one-time code and signs by typing their name. The completed document gets a signature certificate and a tamper-evident cryptographic seal, and comes back as a new file alongside `output.auditUrl`.\n\n**Where the signatures land** — `placement`:\n\n- `page` (default) — a signature certificate page is appended to the document.\n- `tags` — each required signing slot replaces a `[Signature N]` placeholder. Optional initials and date tags use the same slot number.\n\n**Signing steps** — `routingOrder` defaults to 1 (parallel signing). Later steps wait. People with the same `signingGroup` share one `fieldIndex` slot; the first to sign completes it.\n\n**Keeping others in the loop** — `cc`: informed-only recipients who do not sign. They receive no OTP or signature tag, and are emailed the sealed document when the envelope completes.\n\n**Language** — `language`: `en` (default) or `fr`. Sets the language of every recipient-facing asset — invitation and code emails, the signing page, and the audit certificate — for all signers and CC parties.\n\n**Always asynchronous.** The call returns `202` with `status: \"needs_input\"` as soon as the envelope exists, and stays there until every required signing slot completes.\n\n**Managing the envelope** — every sign response, both the `202` and [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run), carries `envelopeUrl`:\n\n- [GET /v1/runs/{id}/envelope](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run-envelope) — roster and per-signer state.\n- [POST /v1/runs/{id}/signers/{signerId}/resend](https://docs.cloudraker.com/api/cloud-raker-api/runs/resend-run-signer) — issue a fresh link.\n- [POST /v1/runs/{id}/void](https://docs.cloudraker.com/api/cloud-raker-api/runs/void-run-envelope) — kill every pending link.\n\n```json\n{\n  \"file\": { \"id\": \"a04d6597-4e34-4a99-94ea-964c289a4c68\" },\n  \"signers\": [{ \"name\": \"Ada Lovelace\", \"email\": \"ada@example.com\" }],\n  \"cc\": [{ \"name\": \"Charles Babbage\", \"email\": \"charles@example.com\" }],\n  \"message\": \"Please countersign by Friday.\",\n  \"placement\": \"page\",\n  \"language\": \"en\"\n}\n```\n\n<Note>\nSign runs are exempt from the run TTL, so an envelope outlives the 7-day maximum and waits for its signers. Signing links are signer-held secrets and never appear on the sender's API.\n</Note>\n\n**Learn more:** [E-signature guide](https://docs.cloudraker.com/capabilities/sign)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1SignRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1SignBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/classify": {
      "post": {
        "operationId": "spaceClassify",
        "tags": ["Spaces"],
        "summary": "Label documents, or find where each one starts",
        "description": "Classify decides what a file is. [Split](https://docs.cloudraker.com/capabilities/split) cuts it — they are two calls, and this is the only one that runs a model.\n\nSend `classes`: at least two, each an `{id, description}`. The description is the accuracy lever — there is no training data — and the `id` is your branch key, returned untouched. One class is the catch-all; supply `{\"id\": \"other\", …}` or one is injected and echoed back in `config`.\n\n**Two granularities:**\n\n| `granularity` | Answer | Billed |\n| --- | --- | --- |\n| `document` (default) | one label for the whole file | the first and last window only |\n| `page` | one label per page, plus derived `segments[]` | every page |\n\nPage mode is what feeds split: the model marks the first page of each document, and contiguous, non-overlapping `segments[]` are derived from that in code — so two invoices back to back come back as two segments, not one. Pass the run id to [POST /v1/split](https://docs.cloudraker.com/capabilities/split) as `classifyRunId`.\n\n`confidence` is 0–5. A low score never rewrites the label: threshold it yourself, and re-run with a sharper `description` when the model is unsure.\n\n```json\n{\n  \"file\": { \"url\": \"https://acme.example/scans/mail.pdf\" },\n  \"classes\": [\n    { \"id\": \"invoice\", \"description\": \"A bill from a supplier with line items and a total due.\" },\n    { \"id\": \"contract\", \"description\": \"A signed agreement with clauses and signature blocks.\" }\n  ],\n  \"granularity\": \"page\"\n}\n```\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Classification guide](https://docs.cloudraker.com/capabilities/classify)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ClassifyRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`classes_required`, `duplicate_class_id`, `too_many_classes`, `config_too_large`, `page_limit_exceeded`, `capability_mismatch`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ClassifyBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/split": {
      "post": {
        "operationId": "spaceSplit",
        "tags": ["Spaces"],
        "summary": "Cut a PDF into child files by page range",
        "description": "[Classify](https://docs.cloudraker.com/capabilities/classify) decides. Split cuts — it runs no model, has no classes and no configuration.\n\n**PDF only.** Office, image, audio and video inputs fail the run with `unsupported_split_source`.\n\nSend exactly one of:\n\n- `segments` — your own ranges, 1-based inclusive, ascending, non-overlapping, at most 100. Gaps are allowed. This path costs no model call at all.\n- `classifyRunId` — a page-mode classify run on the same file. Its `segments[]` are used as-is, with `classId` and `confidence` echoed onto each child.\n\nEach child is a real file with its own `fileId`, ready for [POST /v1/extract](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/extract); `output.documentIds` is the same list flattened. Children inherit the parent's `metadata`, gain `metadata.parentRunId`, land in the parent's space and share the run's TTL — call [keep](https://docs.cloudraker.com/api/cloud-raker-api/runs/keep-run) to move parent and children together.\n\nSend `materialize: false` to get the ranges back without creating anything: the safe first call on a large packet.\n\n```json\n{\n  \"file\": { \"id\": \"file_01K3F…\" },\n  \"classifyRunId\": \"clr_01K3F…\"\n}\n```\n\n<Note>\nChildren are parsed right after the split, so they are immediately usable by any verb. Each child's parse is billed as a normal parse. `usage` itemizes it.\n</Note>\n\n### Waiting for the result\n\nSync by default: the call holds open until the run finishes, up to `?wait=` seconds (default `60`, max `120`, `0` returns immediately).\n\n| Outcome | Response |\n| --- | --- |\n| Finished inside the window | `200` with the full run |\n| Still running at the cap | `202` with `{object, id, status, statusUrl}` |\n\n<Note>\nThe `202` is a graceful degrade, never an error — poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) or wait for a [webhook](https://docs.cloudraker.com/api/cloud-raker-api/webhooks/create-webhook-endpoint). Replaying an `idempotency-key` returns the original run alongside an `idempotent-replay: true` response header.\n</Note>\n\n**Learn more:** [Split guide](https://docs.cloudraker.com/capabilities/split)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1SplitRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — still running, or awaiting human input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`segments_required`, `segments_conflict`, `invalid_segments`, `classify_run_mismatch`, `classify_run_not_paged`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1SplitBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open waiting for the run to finish.\n\nFinishing inside the window returns `200` with the full run; running past it returns `202` with a `statusUrl` to poll. Send `0` to skip waiting entirely and always get the `202`."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/pipeline": {
      "post": {
        "operationId": "spacePipeline",
        "tags": ["Spaces"],
        "summary": "Run several capabilities over one set of files",
        "description": "Runs several capabilities over one set of files in a single call.\n\nEvery file is parsed once, then each step runs over the parsed set — **in parallel, not chained**. A step never consumes another step's output.\n\n**A step is one of:**\n\n- `{ \"extract\": {…} }`, `{ \"redact\": {…} }`, `{ \"fill\": {…} }`, `{ \"sign\": {…} }` — the same inline config the matching verb takes.\n- `{ \"action\": \"act_… | slug\", \"params\": {…} }` — a [saved action](https://docs.cloudraker.com/api/cloud-raker-api/actions/get-action).\n\nThere is no `parse` step: parsing is automatic.\n\n**Always asynchronous.** The response is `202` carrying the run id and one `{id, capability}` per step. Poll [the run](https://docs.cloudraker.com/api/cloud-raker-api/runs/get-run) — its `steps[]` reports each step's status and result under the id you were handed at create.\n\n```json\n{\n  \"files\": [{ \"id\": \"a04d6597-4e34-4a99-94ea-964c289a4c68\" }],\n  \"steps\": [\n    { \"extract\": { \"schema\": { \"type\": \"object\", \"properties\": { \"business_name\": { \"type\": [\"string\", \"null\"] } } } } },\n    { \"redact\": { \"mode\": \"targeted\" } }\n  ]\n}\n```\n\n**Learn more:** [Pipeline guide](https://docs.cloudraker.com/capabilities/pipeline)",
        "responses": {
          "202": {
            "description": "Accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1PipelineAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request` / `invalid_schema`)."
          },
          "422": {
            "description": "Unusable input file or webhook endpoint."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1PipelineBody"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/files": {
      "post": {
        "operationId": "spaceCreateFile",
        "tags": ["Spaces"],
        "summary": "Register a file by URL, or get a presigned upload URL",
        "description": "Adds a file to your reusable corpus, either by URL or by uploading the bytes yourself.\n\nTwo request shapes, both pure JSON — send one or the other, never both.\n\n**By URL.** `{ url, name?, processing? }` registers the file and fetches it over http(s). The media type is sniffed from the response, so any `mimeType` you send is ignored. You get the file back with `status: \"processing\"`.\n\n```json\n{ \"url\": \"https://www.irs.gov/pub/irs-pdf/fw9.pdf\", \"name\": \"fw9.pdf\" }\n```\n\n**By upload.** `{ name, mimeType, processing? }` reserves the record and returns `uploadUrl` plus `uploadExpiresAt` (15 minutes). `PUT` the bytes to that URL with a `Content-Type` header exactly equal to the `mimeType` you sent; parsing starts the moment they land.\n\n```json\n{ \"name\": \"recording.mp3\", \"mimeType\": \"audio/mpeg\" }\n```\n\n**Parsing engine** — `processing` accepts `auto` (the default, self-upgrades to OCR on scans), `ocr`, `simple`, `transcribe` and `transcribe_diarize`. Audio and video default to `transcribe_diarize`.\n\n<Note>\nFiles registered here are persistent — no TTL — and reusable across any number of runs as `file: { \"id\": \"…\" }`. That is what makes parse-once-run-many work: pass the same id to [extract](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/extract), [redact](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/redact) and [pipeline](https://docs.cloudraker.com/api/cloud-raker-api/capabilities/pipeline) without re-parsing.\n</Note>\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "201": {
            "description": "The registered file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1File"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "422": {
            "description": "The URL could not be fetched (`file_fetch_failed`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The fetched bytes could not be stored (`file_upload_failed`)."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateFileBody"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      },
      "get": {
        "operationId": "spaceListFiles",
        "tags": ["Spaces"],
        "summary": "List files",
        "description": "Lists the files your organization has registered, newest first.\n\n`?limit` caps the page (1–200, default 50). There is no cursor today — paging is by `limit` only.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "200": {
            "description": "The files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1FileList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/files/{id}": {
      "get": {
        "operationId": "spaceGetFile",
        "tags": ["Spaces"],
        "summary": "Get a file",
        "description": "Returns a file's metadata and where it is in the pipeline.\n\n`{id}` accepts the file id or the file name. A name has to match exactly one file here, otherwise the call answers `409 ambiguous_file_name`.\n\n`status` walks `uploading` → `processing` → `ready`, or lands on `failed` with an `error`. Poll this route after [registering a file](https://docs.cloudraker.com/api/cloud-raker-api/files/create-file) until it reads `ready`.\n\nOnce `ready`, `urls` carries signed links valid for about an hour:\n\n- `content` — the original bytes.\n- `markdown` and `json` — the parsed forms, present when the file was parsed.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1File"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file id (or a file outside the API workspace)."
          },
          "409": {
            "description": "The name matches more than one file (`ambiguous_file_name`), or there are too many files to resolve a name safely (`file_listing_truncated`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "spaceDeleteFile",
        "tags": ["Spaces"],
        "summary": "Delete a file",
        "description": "Deletes a file and everything parsed out of it.\n\n`{id}` accepts the file id or the file name, exactly as `GET` does.\n\nRuns that already referenced the file keep their results — deleting the source does not retroactively empty a finished run.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file id."
          },
          "409": {
            "description": "The name matches more than one file (`ambiguous_file_name`), or there are too many files to resolve a name safely (`file_listing_truncated`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/files/{ref}/convert/markdown": {
      "post": {
        "operationId": "spaceConvertFileToMarkdown",
        "tags": ["Spaces"],
        "summary": "Convert a file to Markdown",
        "description": "Returns the file as Markdown text.\n\n`{ref}` is the file id or the file name.\n\nWhen the file was already parsed, this serves the Markdown that parsing produced and costs nothing extra. Otherwise the bytes are converted on the spot — the answer is the same either way.\n\nThe result is text, not a new file: nothing is stored, and nothing is charged to your corpus.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "200": {
            "description": "The Markdown.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1Conversion"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file."
          },
          "409": {
            "description": "Ambiguous name, or the bytes have not landed yet."
          },
          "422": {
            "description": "The file could not be converted."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/files/{ref}/convert/pdf": {
      "post": {
        "operationId": "spaceConvertFileToPdf",
        "tags": ["Spaces"],
        "summary": "Convert a file to PDF",
        "description": "Turns a Word document, a spreadsheet, a presentation, an image or a plain-text file into a PDF, and stores the result as a new file next to the original.\n\n`{ref}` is the file id or the file name. A file that is already a PDF answers `400` — there is nothing to convert.\n\nThe new file carries `parentFileId` pointing back at the original, and is never indexed for search: the original is the thing that gets indexed.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "201": {
            "description": "The converted file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1File"
                }
              }
            }
          },
          "400": {
            "description": "The file is already a PDF (`invalid_request`)."
          },
          "404": {
            "description": "Unknown file."
          },
          "422": {
            "description": "The file type cannot be converted (`unsupported_file_type`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/files/{ref}/convert/image": {
      "post": {
        "operationId": "spaceRenderFilePage",
        "tags": ["Spaces"],
        "summary": "Render a PDF page to an image",
        "description": "Renders one page of a PDF as a PNG and stores it as a new file.\n\n```json\n{ \"page\": 1, \"scale\": 2 }\n```\n\n`page` is 1-based and defaults to the first page. `scale` runs from 0.1 to 6 and defaults to 2; the long edge is capped at 4000 pixels whatever you ask for.\n\nOnly a PDF can be rendered — convert first with [convert/pdf](https://docs.cloudraker.com/api/cloud-raker-api/tools/convert-file-to-pdf).\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "201": {
            "description": "The rendered image.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1File"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file."
          },
          "422": {
            "description": "The file is not a PDF, or the page does not exist."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RenderPageBody"
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{spaceId}/files/{ref}/split/pages": {
      "post": {
        "operationId": "spaceSplitFilePages",
        "tags": ["Spaces"],
        "summary": "Split a PDF into one file per page",
        "description": "Splits a PDF into single-page PDFs, one new file per page, named `<original>.p<n>.pdf`.\n\nEach page carries `parentFileId` pointing back at the source, so the set stays traceable to one document.\n\nA PDF longer than 100 pages answers `413 too_many_pages` — extract the pages you need one at a time instead. A PDF larger than 15 MB answers `413 too_large`.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "201": {
            "description": "One file per page, in page order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1FileList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file."
          },
          "413": {
            "description": "More than 100 pages (`too_many_pages`), or larger than 15 MB (`too_large`)."
          },
          "422": {
            "description": "The file is not a PDF."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/files/stitch": {
      "post": {
        "operationId": "spaceStitchFiles",
        "tags": ["Spaces"],
        "summary": "Join files into one",
        "description": "Joins 2 to 20 files, in the order you list them, into a single new file.\n\n```json\n{ \"files\": [\"call-part1.mp3\", \"call-part2.mp3\"] }\n```\n\nEach entry is a file id or a file name. Every file must be the same kind:\n\n- **Audio** — the recordings are concatenated. `format` (`mp3`, `m4a` or `wav`) forces the output container; without it the inputs' own container is kept. The result is named `<first>.joined.<ext>`.\n- **PDF** — the documents are merged into one. The result is named `<first>.merged.pdf`.\n\nMixing audio with PDFs answers `400`. The files must be under 40 MB in total, otherwise the call answers `413 too_large`.\n\n**Learn more:** [Working with files](https://docs.cloudraker.com/developers/files)",
        "responses": {
          "201": {
            "description": "The joined file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1File"
                }
              }
            }
          },
          "400": {
            "description": "Mixed or unsupported file types (`invalid_request`)."
          },
          "404": {
            "description": "Unknown file."
          },
          "409": {
            "description": "Ambiguous name (`ambiguous_file_name`)."
          },
          "413": {
            "description": "More than 40 MB in total (`too_large`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1StitchBody"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/files/{ref}/redline": {
      "post": {
        "operationId": "spaceRedlineFile",
        "tags": ["Spaces"],
        "summary": "Open a redlining session on a Word document",
        "description": "Opens an editing session on a `.docx` file so you can rewrite it with tracked changes.\n\n```json\n{ \"ttl\": 86400 }\n```\n\n`ttl` is seconds until the session expires, from 60 to 604800 (one week); it defaults to the redlining service's own default. Nothing is stored back into your corpus until you call [flush](https://docs.cloudraker.com/api/cloud-raker-api/redline/flush-redline-session).\n\nOnly a Word document can be redlined. Everything else answers `422`.\n\n**Learn more:** [Redlining](https://docs.cloudraker.com/developers/file-tools)",
        "responses": {
          "201": {
            "description": "The open session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RedlineSession"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown file."
          },
          "422": {
            "description": "The file is not a Word document."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "ref",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RedlineBody"
              }
            }
          }
        }
      }
    },
    "/v1/spaces/{spaceId}/compose": {
      "post": {
        "operationId": "spaceCompose",
        "tags": ["Spaces"],
        "summary": "Compose a document from a template and data",
        "description": "Renders one of your saved compose templates with the data you pass, and gives you back a PDF.\n\n`template` is the config id or slug from [POST /v1/compose/configs](https://docs.cloudraker.com/capabilities/compose). `data` is validated against that template's JSON Schema BEFORE anything renders, so a missing field costs you a `422` with the exact instance paths, not a broken document.\n\n```json\n{ \"template\": \"invoice\", \"data\": { \"customer\": \"Acme\", \"total\": 1240 } }\n```\n\n`output` decides what comes back:\n\n- `file` (the default) stores the PDF in your corpus and returns the file object, with the `templateHash` of the exact bundle that produced it.\n- `raw` streams the PDF bytes straight back and stores nothing.\n\n**Learn more:** [Compose](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "200": {
            "description": "The PDF bytes (`output: \"raw\"` only — nothing was stored).",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "201": {
            "description": "The composed file (`output: \"file\"`, the default).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ComposedFile"
                }
              }
            }
          },
          "400": {
            "description": "The reference is not a compose template (`capability_mismatch`)."
          },
          "404": {
            "description": "Unknown template."
          },
          "422": {
            "description": "The data does not satisfy the template schema (`invalid_data`, with `errors[]`), the template has no `main`/files (`config_incomplete`), or it failed to compile (`template_render_failed`)."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ComposeBody"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/compose/batch": {
      "post": {
        "operationId": "spaceComposeBatch",
        "tags": ["Spaces"],
        "summary": "Compose many documents from one template",
        "description": "Renders the same template once per item — a run of invoices, contracts or letters from one call.\n\nEvery item's `data` is validated first. If ANY item fails, nothing renders and the call answers `422` with an `errors[]` naming the failing item indexes and instance paths: a half-finished batch is worse than none.\n\n```json\n{\n  \"template\": \"invoice\",\n  \"items\": [\n    { \"name\": \"acme-0042\", \"data\": { \"customer\": \"Acme\", \"total\": 1240 } },\n    { \"name\": \"globex-0043\", \"data\": { \"customer\": \"Globex\", \"total\": 990 } }\n  ]\n}\n```\n\n`output` decides what comes back:\n\n- `files` (the default) stores each PDF and returns the list. An item's `name` names its file (`<name>.pdf`); without one the files are numbered from the template slug.\n- `zip` stores ONE archive holding every PDF and returns that single file.\n\nA `name` must be a bare file name — no `/`, no `\\`, no `..`, no leading dot — and two items may not end up with the same file name.\n\n**Learn more:** [Compose](https://docs.cloudraker.com/capabilities/compose)",
        "responses": {
          "201": {
            "description": "The composed files, or the single zip file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ComposedFileList"
                }
              }
            }
          },
          "400": {
            "description": "The reference is not a compose template (`capability_mismatch`)."
          },
          "404": {
            "description": "Unknown template."
          },
          "413": {
            "description": "The rendered documents exceed the per-call output limit (`output_too_large`) — split the batch."
          },
          "422": {
            "description": "At least one item fails the template schema (`invalid_data`, with `errors[]` carrying `index`), two items share a file name (`duplicate_item_names`), an item `name` is not a bare file name (`invalid_item_name`), or the template is incomplete or failed to compile."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1ComposeBatchBody"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/runs": {
      "get": {
        "operationId": "spaceListRuns",
        "tags": ["Spaces"],
        "summary": "List a space’s runs",
        "description": "Lists the runs created in this space, newest first — the same listing (and the same `object`, `status`, `metadata.<key>` filters and cursor paging) as `GET /v1/runs`, narrowed to one space.\n\n**Learn more:** [Spaces](https://docs.cloudraker.com/developers/spaces)",
        "responses": {
          "200": {
            "description": "The runs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RunList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown, archived or expired space."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "object",
            "schema": {
              "type": "string",
              "enum": [
                "extract_run",
                "parse_run",
                "redact_run",
                "fill_run",
                "sign_run",
                "classify_run",
                "split_run",
                "pipeline_run"
              ]
            },
            "description": "Only runs of this kind — `extract_run`, `parse_run`, `redact_run`, `fill_run`, `sign_run`, `classify_run`, `split_run` or `pipeline_run`."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": ["processing", "processed", "failed", "cancelled", "expired", "needs_input"]
            },
            "description": "Only runs in this state."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "description": "How many runs to return, 1–50."
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "description": "The `cursor` from the previous page. Opaque — pass it back unchanged."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/runs/{id}": {
      "get": {
        "operationId": "spaceGetRun",
        "tags": ["Spaces"],
        "summary": "Get a run in a space",
        "description": "Returns a run created in this space. Identical to `GET /v1/runs/{id}`, except that a run belonging to another space — or to no space — answers `404`.\n\n**Learn more:** [Spaces](https://docs.cloudraker.com/developers/spaces)",
        "responses": {
          "200": {
            "description": "The run.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/V1ExtractRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1ParseRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1RedactRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1FillRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1SignRun"
                    },
                    {
                      "$ref": "#/components/schemas/V1PipelineRun"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown run, or a run outside this space."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "output",
            "schema": {
              "default": "urls",
              "type": "string",
              "enum": ["urls", "inline"]
            },
            "description": "Return parsed source inline for parse/extract runs when the combined source is at most 1 MiB; otherwise retain signed URLs only."
          },
          {
            "in": "query",
            "name": "include",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/search": {
      "get": {
        "operationId": "spaceSearch",
        "tags": ["Spaces"],
        "summary": "Search a space",
        "description": "Semantic search over every file in the space. Files uploaded to a space are indexed as they are parsed, which is what makes this work — files in the default hidden workspace are not.\n\n`q` is the query in plain words; `limit` caps the matches (1–100, default 20). Each match carries where it came from: the file, and the page, box or timecode span when the file was indexed with grounding.\n\n**Learn more:** [Spaces](https://docs.cloudraker.com/developers/spaces)",
        "responses": {
          "200": {
            "description": "Ranked matches.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResults"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (`invalid_request`)."
          },
          "404": {
            "description": "Unknown, archived or expired space."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/agents": {
      "post": {
        "operationId": "spaceCreateAgentRun",
        "tags": ["Spaces"],
        "summary": "Start an agent run in a space",
        "description": "Starts an agent inside this space: the run and its input files live there, so anything the agent files stays after the run ends.\n\nSame body, same wait semantics and same run object as `POST /v1/agent-runs` — read the run back at `GET /v1/spaces/{spaceId}/agents/{runId}`, and steer, approve or cancel it on the ordinary `/v1/agent-runs/{id}` routes.\n\n**Learn more:** [Spaces](https://docs.cloudraker.com/developers/spaces)",
        "responses": {
          "200": {
            "description": "The finished run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRun"
                }
              }
            }
          },
          "202": {
            "description": "Accepted — queued, still working, or blocked on a person.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRunAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown agent, space, archived or expired space."
          },
          "422": {
            "description": "The agent cannot start, or an input file is unusable."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1CreateAgentRunBody"
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 60,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/v1/spaces/{spaceId}/agents/{runId}": {
      "get": {
        "operationId": "spaceGetAgentRun",
        "tags": ["Spaces"],
        "summary": "Get an agent run in a space",
        "description": "Returns an agent run started in this space. A run started elsewhere answers `404`.\n\n**Learn more:** [Spaces](https://docs.cloudraker.com/developers/spaces)",
        "responses": {
          "200": {
            "description": "The run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1AgentRun"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown run, or a run outside this space."
          },
          "429": {
            "description": "Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "message", "retryable", "requestId"],
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": ["rate_limited"]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "docUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "wait",
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 120
            },
            "description": "How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/onboarding/memberships": {
      "get": {
        "operationId": "getOnboardingMembership",
        "tags": ["Onboarding"],
        "summary": "The caller's existing organization, if any",
        "description": "Answers whether a signed-in caller whose session carries no organization already belongs to one — the state left behind when a membership is created after the session was issued, since session claims are only set at authentication. Returns the organization the session should be re-scoped into, or null when the caller has none and creating one is the right next step. Read-only: it never creates or changes anything, and pending invitations do not count as an organization.",
        "responses": {
          "200": {
            "description": "The caller's organization, or null when they have none.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingMembership"
                }
              }
            }
          }
        }
      }
    },
    "/onboarding/organization": {
      "post": {
        "operationId": "createOnboardingOrganization",
        "tags": ["Onboarding"],
        "summary": "Create the caller's organization",
        "description": "Creates the organization for a signed-in user who has none, sets its external id to the derived tenant slug, adds the caller as an active `admin`, and provisions the tenant. Idempotent: a caller who already belongs to an organization gets it back with `created: false` rather than a second one. A caller who has been invited to an organization is refused instead, so they can accept that invitation rather than being given a second organization of their own. Give `slug` to choose the tenant slug. A taken slug answers 409 `slug_taken` and is never changed. Without `slug`, the slug comes from the name, with a short suffix when it is taken. A caller who already has an organization gets it back, and `slug` is ignored. Give `workspace: personal` with no `name` and no `slug` to create a personal workspace. Its name and slug come from the caller's profile: the first and last name, else the email address. A taken slug gets a short suffix. The session must be re-issued afterwards: token claims are set at authentication, so the current token still carries no tenant.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OnboardingCreateOrganizationBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The caller's organization and tenant slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingOrganization"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a person. Organization API keys and embed tokens authenticate, but cannot hold a membership."
          },
          "409": {
            "description": "The caller has been invited to an organization and has not accepted yet. Accept the invitation, or resend with `ignorePendingInvitation` to create an organization anyway. `slug_taken` (body `{error, code}`): another organization uses the chosen `slug`. Choose a different one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingPendingInvitation"
                }
              }
            }
          },
          "422": {
            "description": "`disposable_email`: the caller signed up with a disposable mailbox. Sign up with a work or personal email address. `invalid_slug` (body `{error, code}`): the chosen `slug` must start with a letter, hold 2 to 40 lowercase letters, digits or hyphens, and contain no `--` and no trailing hyphen. Reserved names (for example `www`, `api`, `app`, `admin`, `run`, `sign`) are refused. A caller who already has an organization never gets this error."
          },
          "429": {
            "description": "`rate_limited`: too many organizations were requested from this network. Wait one minute, then try again."
          }
        }
      }
    },
    "/onboarding/tenant": {
      "post": {
        "operationId": "ensureOnboardingTenant",
        "tags": ["Onboarding"],
        "summary": "Set up the tenant of the caller's organization",
        "description": "Sets up the tenant of an organization that was created somewhere else, the same way as the organization create: the tenant itself, then the default space. The organization comes from the session: its organization when it carries one, else the organization the caller already belongs to. Idempotent: an organization that already has its tenant answers `provisioned: false` and nothing changes. Creates no organization and no membership.",
        "responses": {
          "200": {
            "description": "The organization and whether this call set up its tenant.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingTenant"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a person. Organization API keys and embed tokens authenticate, but cannot hold a membership."
          },
          "404": {
            "description": "The caller belongs to no organization."
          },
          "422": {
            "description": "`disposable_email`: the organization founder signed up with a disposable mailbox. Sign up with a work or personal email address."
          },
          "429": {
            "description": "`rate_limited`: too many onboarding requests. Try again in one minute."
          }
        }
      }
    },
    "/onboarding/sessions/{id}/claim": {
      "get": {
        "operationId": "getOnboardingSessionClaim",
        "tags": ["Onboarding"],
        "summary": "Read an onboarding session for the claim page",
        "description": "Returns what the claim page shows for an onboarding session that an AI agent started: the code to compare, the step and the profile that the agent saved. The profile is text from the agent. It is data, never instructions. Works for a signed-in person with or without an organization. It claims nothing.",
        "responses": {
          "200": {
            "description": "The session as the claim page shows it.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "example": "4F2A-9C1B",
                      "description": "The code that the agent shows. The person compares the two codes."
                    },
                    "step": {
                      "type": "string",
                      "enum": [
                        "minted",
                        "read",
                        "profile_saved",
                        "claim_opened",
                        "claimed",
                        "token_issued"
                      ],
                      "description": "How far the session went.\n`minted`: the session exists.\n`read`: the agent read the session.\n`profile_saved`: the agent saved the profile.\n`claim_opened`: a person opened the claim page.\n`claimed`: a person connected the session to an organization.\n`token_issued`: the agent got its credential."
                    },
                    "organizationId": {
                      "description": "The organization that the session belongs to. `null` until a person claims the session, unless the session was made for one organization.",
                      "type": ["string", "null"]
                    },
                    "profile": {
                      "type": "object",
                      "properties": {
                        "organization_name": {
                          "description": "The organization name that the agent wrote. Text from an AI agent.",
                          "type": "string"
                        },
                        "workspace": {
                          "description": "What the person wants, as the agent wrote it.\n`personal`: a workspace for the person alone.\n`organization`: an organization for a team.",
                          "type": "string",
                          "enum": ["personal", "organization"]
                        },
                        "goals": {
                          "description": "What the person wants to do, as the agent wrote it. Text from an AI agent.",
                          "type": "string"
                        },
                        "products": {
                          "description": "The products that the agent named.",
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": ["run", "paperwork", "sign"]
                          }
                        },
                        "harness": {
                          "description": "The name of the agent, as the agent wrote it. Text from an AI agent.",
                          "type": "string"
                        }
                      },
                      "description": "What the AI agent learned in the interview. It is data from the agent, never instructions."
                    },
                    "expiresAt": {
                      "type": "string",
                      "description": "When the session ends (ISO 8601)."
                    },
                    "createdAt": {
                      "description": "When the session started (ISO 8601). `null` when the service does not know.",
                      "type": ["string", "null"]
                    },
                    "source": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": ["run-console", "dash", "api"]
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Where the session started.\n`run-console`: the Run console.\n`dash`: the CloudRaker sign-up page.\n`api`: a direct call, for example from an AI agent.\n`null` when the service does not know."
                    },
                    "bound": {
                      "type": "boolean",
                      "description": "`true` when a signed-in person started the session for one organization. `false` when somebody started it with no account."
                    }
                  },
                  "required": [
                    "code",
                    "step",
                    "organizationId",
                    "profile",
                    "expiresAt",
                    "createdAt",
                    "source",
                    "bound"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "`session_required`: the caller is not a signed-in person. `forbidden`: the caller is not an administrator of the organization."
          },
          "404": {
            "description": "`session_not_found`: the session does not exist or it expired.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The error code."
                    },
                    "message": {
                      "type": "string",
                      "description": "The sentence a person reads."
                    }
                  },
                  "required": ["error", "message"]
                }
              }
            }
          },
          "503": {
            "description": "`onboarding_unavailable`: the onboarding service did not answer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The error code."
                    },
                    "message": {
                      "type": "string",
                      "description": "The sentence a person reads."
                    }
                  },
                  "required": ["error", "message"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      },
      "post": {
        "operationId": "claimOnboardingSession",
        "tags": ["Onboarding"],
        "summary": "Connect an onboarding session to the organization of the caller",
        "description": "Connects an onboarding session that an AI agent started to the organization of the session token. After the claim, the agent can get one credential with admin access to that organization. `organizationId` must be the organization of the session token. Authorization: a signed-in organization administrator only (denied, 403).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "organizationId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "example": "org_01H8ZK",
                    "description": "The organization that the claim page showed. It must be the organization of the session token."
                  }
                },
                "required": ["organizationId"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The session belongs to the organization now.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "claimed": {
                      "type": "boolean",
                      "const": true
                    },
                    "organizationId": {
                      "type": "string",
                      "description": "The organization that the session belongs to."
                    }
                  },
                  "required": ["claimed", "organizationId"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`session_required`: the caller is not a signed-in person. `forbidden`: the caller is not an administrator of the organization."
          },
          "404": {
            "description": "`session_not_found`: the session does not exist or it expired.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The error code."
                    },
                    "message": {
                      "type": "string",
                      "description": "The sentence a person reads."
                    }
                  },
                  "required": ["error", "message"]
                }
              }
            }
          },
          "409": {
            "description": "`organization_changed`: `organizationId` is not the organization of the session token. `session_claimed_elsewhere`: another organization or another person already claimed the session.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The error code."
                    },
                    "message": {
                      "type": "string",
                      "description": "The sentence a person reads."
                    }
                  },
                  "required": ["error", "message"]
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: too many claims. Wait one minute.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The error code."
                    },
                    "message": {
                      "type": "string",
                      "description": "The sentence a person reads."
                    }
                  },
                  "required": ["error", "message"]
                }
              }
            }
          },
          "503": {
            "description": "`onboarding_unavailable`: the onboarding service did not answer.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "The error code."
                    },
                    "message": {
                      "type": "string",
                      "description": "The sentence a person reads."
                    }
                  },
                  "required": ["error", "message"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/signing/documents/export": {
      "post": {
        "operationId": "postSigningDocumentsExport",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": ["ids"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/teams/{id}": {
      "patch": {
        "operationId": "patchSigningTeamsById",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "privacy": {
                    "type": "string",
                    "enum": ["team", "participants"]
                  },
                  "managerIds": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/settings": {
      "put": {
        "operationId": "putSigningSettings",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "delegatedSignedCopy": {
                    "type": "boolean"
                  }
                },
                "required": ["delegatedSignedCopy"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/developer/keys": {
      "get": {
        "operationId": "listSigningIntegrations",
        "tags": ["Signing administration"],
        "summary": "List signing integrations",
        "responses": {
          "200": {
            "description": "Integration credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningApiKeyList"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createSigningIntegration",
        "tags": ["Signing administration"],
        "summary": "Create a signing integration",
        "responses": {
          "201": {
            "description": "Save this secret before closing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedSigningApiKey"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSigningApiKey"
              }
            }
          }
        }
      }
    },
    "/signing/developer/keys/{id}": {
      "patch": {
        "operationId": "updateSigningIntegration",
        "tags": ["Signing administration"],
        "summary": "Update signing integration permissions",
        "responses": {
          "200": {
            "description": "Updated integration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningApiKey"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSigningApiKey"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "revokeSigningIntegration",
        "tags": ["Signing administration"],
        "summary": "Revoke a signing integration",
        "responses": {
          "204": {
            "description": "Integration revoked."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "version",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/signing/developer/keys/{id}/rotate": {
      "post": {
        "operationId": "rotateSigningIntegration",
        "tags": ["Signing administration"],
        "summary": "Rotate a signing integration credential",
        "responses": {
          "201": {
            "description": "The previous secret is revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedSigningApiKey"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SigningApiKeyVersion"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/signing/developer/activity": {
      "get": {
        "operationId": "listSigningApiActivity",
        "tags": ["Signing administration"],
        "summary": "List recent signing API requests",
        "responses": {
          "200": {
            "description": "Recent request metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "requestId": {
                            "type": "string"
                          },
                          "integrationId": {
                            "type": "string"
                          },
                          "keyId": {
                            "type": "string"
                          },
                          "method": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "status": {
                            "type": "number"
                          },
                          "durationMs": {
                            "type": "number"
                          },
                          "at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "requestId",
                          "integrationId",
                          "keyId",
                          "method",
                          "path",
                          "status",
                          "durationMs",
                          "at"
                        ]
                      }
                    },
                    "nextCursor": {
                      "type": "null"
                    }
                  },
                  "required": ["items", "nextCursor"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ]
      }
    },
    "/signing/developer/usage": {
      "get": {
        "operationId": "getSigningApiUsage",
        "tags": ["Signing administration"],
        "summary": "Get signing API usage for the current month",
        "responses": {
          "200": {
            "description": "Recorded requests and errors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "periodStart": {
                      "type": "string"
                    },
                    "requests": {
                      "type": "number"
                    },
                    "errors": {
                      "type": "number"
                    },
                    "integrations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "integrationId": {
                            "type": "string"
                          },
                          "requests": {
                            "type": "number"
                          },
                          "errors": {
                            "type": "number"
                          },
                          "lastUsedAt": {
                            "type": "string"
                          }
                        },
                        "required": ["integrationId", "requests", "errors", "lastUsedAt"]
                      }
                    }
                  },
                  "required": ["periodStart", "requests", "errors", "integrations"]
                }
              }
            }
          }
        }
      }
    },
    "/signing/developer/webhooks": {
      "get": {
        "operationId": "appListSigningWebhooks",
        "tags": ["Workspace Signing Webhooks"],
        "summary": "List team signing webhooks",
        "responses": {
          "200": {
            "description": "Accessible webhooks.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri"
                          },
                          "teamId": {
                            "type": "string"
                          },
                          "events": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "document.sent",
                                "document.completed",
                                "document.declined",
                                "document.expired",
                                "document.cancelled",
                                "document.failed",
                                "recipient.viewed",
                                "recipient.signed",
                                "recipient.approved",
                                "recipient.declined",
                                "delegation.requested",
                                "delegation.granted",
                                "delegation.declined",
                                "delegation.revoked",
                                "delegation.contested"
                              ]
                            }
                          },
                          "disabled": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "url",
                          "teamId",
                          "events",
                          "disabled",
                          "createdAt",
                          "updatedAt"
                        ]
                      }
                    }
                  },
                  "required": ["items"]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "appCreateSigningWebhook",
        "tags": ["Workspace Signing Webhooks"],
        "summary": "Subscribe to team signing events",
        "responses": {
          "201": {
            "description": "Webhook created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "teamId": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "document.sent",
                          "document.completed",
                          "document.declined",
                          "document.expired",
                          "document.cancelled",
                          "document.failed",
                          "recipient.viewed",
                          "recipient.signed",
                          "recipient.approved",
                          "recipient.declined",
                          "delegation.requested",
                          "delegation.granted",
                          "delegation.declined",
                          "delegation.revoked",
                          "delegation.contested"
                        ]
                      }
                    },
                    "disabled": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "url",
                    "teamId",
                    "events",
                    "disabled",
                    "createdAt",
                    "updatedAt"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  },
                  "teamId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "events": {
                    "minItems": 1,
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "document.sent",
                        "document.completed",
                        "document.declined",
                        "document.expired",
                        "document.cancelled",
                        "document.failed",
                        "recipient.viewed",
                        "recipient.signed",
                        "recipient.approved",
                        "recipient.declined",
                        "delegation.requested",
                        "delegation.granted",
                        "delegation.declined",
                        "delegation.revoked",
                        "delegation.contested"
                      ]
                    }
                  },
                  "disabled": {
                    "type": "boolean"
                  }
                },
                "required": ["url", "teamId", "events"],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/signing/developer/webhooks/{id}": {
      "patch": {
        "operationId": "appUpdateSigningWebhook",
        "tags": ["Workspace Signing Webhooks"],
        "summary": "Update or pause a signing webhook",
        "responses": {
          "200": {
            "description": "Updated webhook.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "teamId": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "document.sent",
                          "document.completed",
                          "document.declined",
                          "document.expired",
                          "document.cancelled",
                          "document.failed",
                          "recipient.viewed",
                          "recipient.signed",
                          "recipient.approved",
                          "recipient.declined",
                          "delegation.requested",
                          "delegation.granted",
                          "delegation.declined",
                          "delegation.revoked",
                          "delegation.contested"
                        ]
                      }
                    },
                    "disabled": {
                      "type": "boolean"
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "url",
                    "teamId",
                    "events",
                    "disabled",
                    "createdAt",
                    "updatedAt"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  },
                  "events": {
                    "minItems": 1,
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "document.sent",
                        "document.completed",
                        "document.declined",
                        "document.expired",
                        "document.cancelled",
                        "document.failed",
                        "recipient.viewed",
                        "recipient.signed",
                        "recipient.approved",
                        "recipient.declined",
                        "delegation.requested",
                        "delegation.granted",
                        "delegation.declined",
                        "delegation.revoked",
                        "delegation.contested"
                      ]
                    }
                  },
                  "disabled": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "appDeleteSigningWebhook",
        "tags": ["Workspace Signing Webhooks"],
        "summary": "Delete a signing webhook",
        "responses": {
          "204": {
            "description": "Webhook deleted."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/signing/developer/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "appListSigningWebhookDeliveries",
        "tags": ["Workspace Signing Webhooks"],
        "summary": "List signing webhook delivery attempts",
        "responses": {
          "200": {
            "description": "Recent attempts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "endpointId": {
                            "type": "string"
                          },
                          "eventId": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "document.sent",
                              "document.completed",
                              "document.declined",
                              "document.expired",
                              "document.cancelled",
                              "document.failed",
                              "recipient.viewed",
                              "recipient.signed",
                              "recipient.approved",
                              "recipient.declined",
                              "delegation.requested",
                              "delegation.granted",
                              "delegation.declined",
                              "delegation.revoked",
                              "delegation.contested"
                            ]
                          },
                          "attempt": {
                            "type": "number"
                          },
                          "responseStatus": {
                            "type": ["number", "null"]
                          },
                          "ok": {
                            "type": "boolean"
                          },
                          "at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "endpointId",
                          "eventId",
                          "type",
                          "attempt",
                          "responseStatus",
                          "ok",
                          "at"
                        ]
                      }
                    },
                    "nextCursor": {
                      "type": "null"
                    }
                  },
                  "required": ["items", "nextCursor"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/signing/developer/webhooks/{id}/deliveries/{eventId}/replay": {
      "post": {
        "operationId": "appReplaySigningWebhook",
        "tags": ["Workspace Signing Webhooks"],
        "summary": "Replay a signing webhook event",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "description": "Reuse this key when retrying the same replay request.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 200
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "eventId",
            "required": true
          }
        ],
        "responses": {
          "202": {
            "description": "Replay scheduled.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "boolean",
                      "const": true
                    },
                    "eventId": {
                      "type": "string"
                    }
                  },
                  "required": ["accepted", "eventId"]
                }
              }
            }
          }
        }
      }
    },
    "/signing/reports": {
      "get": {
        "operationId": "getSigningReports",
        "parameters": [
          {
            "in": "query",
            "name": "teamId",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            }
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            }
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/reports.csv": {
      "get": {
        "operationId": "getSigningReportsCsv",
        "parameters": [
          {
            "in": "query",
            "name": "teamId",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            }
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            }
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/reports/send": {
      "post": {
        "operationId": "postSigningReportsSend",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "teamId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "from": {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  "recipientIds": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": ["recipientIds"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/templates": {
      "post": {
        "operationId": "postSigningTemplates",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "default": "",
                    "type": "string",
                    "maxLength": 2000
                  },
                  "roles": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "locked": {
                          "description": "True: the current recipient of this role always signs it, and documents from the template lock that person. False: the sender chooses the person for each document. When absent, a new template makes the role open, and an update keeps the role as it is. An update from a document keeps a locked role only when its recipient has the same email as the locked person.",
                          "type": "boolean"
                        }
                      },
                      "required": ["id", "label"],
                      "additionalProperties": false
                    }
                  },
                  "cc": {
                    "description": "The emails of the copy recipients that the template keeps. Each document from the template sends a copy to them. When absent, a new template keeps no copy recipient, and an update keeps the copy recipients that the template has now. Each email must be a copy recipient of the document, or of the template when the update has no document.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 254,
                      "format": "email",
                      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                    }
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["documentId", "name"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/templates/{id}": {
      "patch": {
        "operationId": "patchSigningTemplatesById",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "default": "",
                    "type": "string",
                    "maxLength": 2000
                  },
                  "roles": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "locked": {
                          "description": "True: the current recipient of this role always signs it, and documents from the template lock that person. False: the sender chooses the person for each document. When absent, a new template makes the role open, and an update keeps the role as it is. An update from a document keeps a locked role only when its recipient has the same email as the locked person.",
                          "type": "boolean"
                        }
                      },
                      "required": ["id", "label"],
                      "additionalProperties": false
                    }
                  },
                  "cc": {
                    "description": "The emails of the copy recipients that the template keeps. Each document from the template sends a copy to them. When absent, a new template keeps no copy recipient, and an update keeps the copy recipients that the template has now. Each email must be a copy recipient of the document, or of the template when the update has no document.",
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 254,
                      "format": "email",
                      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                    }
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      },
      "delete": {
        "operationId": "deleteSigningTemplatesById",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/templates/{id}/duplicate": {
      "post": {
        "operationId": "postSigningTemplatesByIdDuplicate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/templates/{id}/instantiate": {
      "post": {
        "operationId": "postSigningTemplatesByIdInstantiate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "preview": {
                    "type": "boolean"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "recipients": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "roleId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "slot": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 50
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        },
                        "phone": {
                          "type": "string",
                          "pattern": "^\\+[1-9]\\d{1,14}$",
                          "description": "The recipient phone number in E.164 format, including the country code and leading plus sign."
                        }
                      },
                      "required": ["name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "variables": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "maxLength": 100
                    },
                    "additionalProperties": {
                      "$ref": "#/components/schemas/__schema0"
                    }
                  },
                  "purpose": {
                    "type": "string",
                    "const": "template"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/contacts": {
      "post": {
        "operationId": "postSigningContacts",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 254,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["name", "email"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/signing-groups": {
      "post": {
        "operationId": "postSigningSigningGroups",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "mode": {
                    "default": "all",
                    "type": "string",
                    "enum": ["all", "any"]
                  },
                  "recipients": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        }
                      },
                      "required": ["name", "email"],
                      "additionalProperties": false
                    }
                  }
                },
                "required": ["name", "recipients"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/contacts/{id}": {
      "patch": {
        "operationId": "patchSigningContactsById",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 254,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      },
      "delete": {
        "operationId": "deleteSigningContactsById",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/signing-groups/{id}": {
      "patch": {
        "operationId": "patchSigningSigningGroupsById",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "mode": {
                    "default": "all",
                    "type": "string",
                    "enum": ["all", "any"]
                  },
                  "recipients": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        }
                      },
                      "required": ["name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      },
      "delete": {
        "operationId": "deleteSigningSigningGroupsById",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/branding": {
      "post": {
        "operationId": "postSigningBranding",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "accentColor": {
                    "type": "string",
                    "pattern": "^#[0-9a-fA-F]{6}$"
                  },
                  "logoDataUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 44000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "privacy": {
                    "type": "string",
                    "enum": ["participants", "team"]
                  }
                },
                "required": ["name", "accentColor"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/branding/{id}": {
      "patch": {
        "operationId": "patchSigningBrandingById",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "accentColor": {
                    "type": "string",
                    "pattern": "^#[0-9a-fA-F]{6}$"
                  },
                  "logoDataUrl": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 44000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "teamId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "privacy": {
                    "type": "string",
                    "enum": ["participants", "team"]
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      },
      "delete": {
        "operationId": "deleteSigningBrandingById",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/jobs": {
      "get": {
        "operationId": "getSigningJobs",
        "parameters": [
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string",
              "enum": ["report", "bulk", "archive", "form"]
            }
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/jobs/{id}/pause": {
      "post": {
        "operationId": "postSigningJobsByIdPause",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/jobs/{id}/resume": {
      "post": {
        "operationId": "postSigningJobsByIdResume",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/jobs/{id}/retry": {
      "post": {
        "operationId": "postSigningJobsByIdRetry",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/bulk/preview": {
      "post": {
        "operationId": "postSigningBulkPreview",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "templateId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "templateVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "csv": {
                    "type": "string",
                    "maxLength": 256000
                  },
                  "mapping": {
                    "type": "object",
                    "properties": {
                      "nameColumn": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "emailColumn": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "requesterSlot": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 50
                      },
                      "requesterRoleId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      },
                      "variables": {
                        "default": {},
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      }
                    },
                    "required": ["nameColumn", "emailColumn", "requesterSlot"],
                    "additionalProperties": false
                  }
                },
                "required": ["templateId", "csv", "mapping"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/bulk/jobs": {
      "post": {
        "operationId": "postSigningBulkJobs",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "templateId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "templateVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "requesterSlot": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  },
                  "requesterRoleId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "rows": {
                    "minItems": 1,
                    "maxItems": 250,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        },
                        "variables": {
                          "default": {},
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "additionalProperties": {
                            "$ref": "#/components/schemas/__schema0"
                          }
                        }
                      },
                      "required": ["name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "fixedRecipients": {
                    "default": [],
                    "maxItems": 49,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "roleId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "slot": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 50
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "email": {
                          "type": "string",
                          "maxLength": 254,
                          "format": "email",
                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                        }
                      },
                      "required": ["slot", "name", "email"],
                      "additionalProperties": false
                    }
                  },
                  "confirmCount": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200
                  }
                },
                "required": [
                  "templateId",
                  "templateVersion",
                  "requesterSlot",
                  "rows",
                  "confirmCount",
                  "idempotencyKey"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/report-schedules": {
      "post": {
        "operationId": "postSigningReportSchedules",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cadence": {
                    "type": "string",
                    "enum": ["daily", "weekly"]
                  },
                  "time": {
                    "type": "string",
                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                  },
                  "timeZone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "weekday": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 6
                  },
                  "recipientIds": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "filters": {
                    "default": {},
                    "type": "object",
                    "properties": {
                      "teamId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "from": {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                      },
                      "to": {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "idempotencyKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 128
                  }
                },
                "required": [
                  "cadence",
                  "time",
                  "timeZone",
                  "recipientIds",
                  "name",
                  "idempotencyKey"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/report-schedules/{id}": {
      "patch": {
        "operationId": "patchSigningReportSchedulesById",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cadence": {
                    "type": "string",
                    "enum": ["daily", "weekly"]
                  },
                  "time": {
                    "type": "string",
                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
                  },
                  "timeZone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "weekday": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 6
                  },
                  "recipientIds": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "filters": {
                    "type": "object",
                    "properties": {
                      "teamId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "from": {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                      },
                      "to": {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                      }
                    },
                    "additionalProperties": false
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "status": {
                    "type": "string",
                    "enum": ["scheduled", "paused"]
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      },
      "delete": {
        "operationId": "deleteSigningReportSchedulesById",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/signing/delegations": {
      "get": {
        "operationId": "appListSigningDelegations",
        "tags": ["Workspace Signing Delegations"],
        "summary": "List signing delegations",
        "responses": {
          "200": {
            "description": "Delegation grants available to the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SigningDelegation"
                      }
                    },
                    "nextCursor": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["items", "nextCursor"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "templateId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "teamId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": ["pending", "active", "declined", "revoked"]
            }
          }
        ]
      },
      "post": {
        "operationId": "appRequestSigningDelegation",
        "tags": ["Workspace Signing Delegations"],
        "summary": "Request standing consent for a saved template revision",
        "responses": {
          "201": {
            "description": "The grant. A human must accept before it becomes active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningDelegation"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestSigningDelegation"
              }
            }
          }
        }
      }
    },
    "/signing/delegations/{id}": {
      "get": {
        "operationId": "appGetSigningDelegation",
        "tags": ["Workspace Signing Delegations"],
        "summary": "Read consent evidence and signature history",
        "responses": {
          "200": {
            "description": "The grant and the document history available to the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningDelegationDetail"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/signing/delegations/{id}/resend": {
      "post": {
        "operationId": "appResendSigningDelegation",
        "tags": ["Workspace Signing Delegations"],
        "summary": "Resend a signing delegation",
        "responses": {
          "200": {
            "description": "The current grant. Renewal requires a new human consent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningDelegation"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/signing/delegations/{id}/revoke": {
      "post": {
        "operationId": "appRevokeSigningDelegation",
        "tags": ["Workspace Signing Delegations"],
        "summary": "Revoke a signing delegation",
        "responses": {
          "200": {
            "description": "The current grant. Renewal requires a new human consent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningDelegation"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/signing/delegations/{id}/renew": {
      "post": {
        "operationId": "appRenewSigningDelegation",
        "tags": ["Workspace Signing Delegations"],
        "summary": "Renew a signing delegation",
        "requestBody": {
          "required": true,
          "description": "Explain why the signer receives a new consent request.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 1000
                  }
                },
                "required": ["reason"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The current grant. Renewal requires a new human consent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningDelegation"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/actions/library": {
      "get": {
        "operationId": "listActionLibrary",
        "tags": ["Installed Actions"],
        "summary": "List action manifests",
        "description": "Returns the manifest of every action the platform can run — what files it accepts (`input.sources`, `input.multiple`), the JSON Schemas describing its install-time and per-run configuration, what it produces (`output`), its timeout, and whether it is playbook-native (`execution`). Authorization: any authenticated organization member. This is the capability catalog behind installs; it does not reflect what this organization has installed (see `GET /actions`).",
        "responses": {
          "200": {
            "description": "Every action manifest.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionLibraryList"
                }
              }
            }
          }
        }
      }
    },
    "/actions/catalog": {
      "get": {
        "operationId": "listActionCatalog",
        "tags": ["Installed Actions"],
        "summary": "List installable catalog entries",
        "description": "Returns the presentation catalog the install UI renders — title, descriptions, category, tags, icon and accent, the default `config` an install is seeded with, and the underlying action `manifest`. Authorization: any authenticated organization member. Install an entry by posting its `action` to `POST /actions`.",
        "responses": {
          "200": {
            "description": "Installable catalog entries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionCatalogList"
                }
              }
            }
          }
        }
      }
    },
    "/actions": {
      "get": {
        "operationId": "listInstalledActions",
        "tags": ["Installed Actions"],
        "summary": "List installed actions",
        "description": "Returns this organization's installed actions — each with its `id`, its per-organization `slug` (interchangeable with the id wherever an action is named), the catalog entry it came from, its name and its saved `config`. Authorization: any authenticated organization member. Cursor-paginated: pass `starting_after` with the last `id` of the previous page while `has_more` is true.",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Page size, 1–100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "in": "query",
            "name": "starting_after",
            "required": false,
            "description": "Cursor: the `id` of the last item on the previous page.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of installed actions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstalledActionList"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "installAction",
        "tags": ["Installed Actions"],
        "summary": "Install an action",
        "description": "Installs a catalog entry for this organization, saving its install-time `config`. The install gets a unique per-organization `slug` derived from its name. Authorization: organization administrators only (denied → 403). Returns 400 for an unknown `action` or a slug collision.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Catalog entry to install (`action` or `slug` from `GET /actions/catalog`).",
                    "example": "extract-structured"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "example": "Contract terms"
                  },
                  "config": {
                    "description": "Install-time configuration; shape per the manifest `config.install` schema.",
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": ["action", "name"]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The installed action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstalledActionEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/actions/default/{slug}": {
      "get": {
        "operationId": "getDefaultInstalledAction",
        "tags": ["Installed Actions"],
        "summary": "Get an action's default install",
        "description": "Returns the organization’s default install for a first-party capability slug (e.g. `extract-structured`), seeding it on first read (idempotent — the same seeding a run would perform). Returns 400 for an unknown slug. Authorization: any organization member.",
        "responses": {
          "200": {
            "description": "The default install for this capability.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstalledActionEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "slug",
            "required": true
          }
        ]
      }
    },
    "/actions/{id}": {
      "get": {
        "operationId": "getInstalledAction",
        "tags": ["Installed Actions"],
        "summary": "Get an installed action",
        "description": "Returns one installed action by its `id` or its per-organization `slug` — the two are interchangeable. Authorization: any authenticated organization member. 404 when no install matches in this organization.",
        "responses": {
          "200": {
            "description": "The installed action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstalledActionEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateInstalledAction",
        "tags": ["Installed Actions"],
        "summary": "Update an installed action",
        "description": "Partial update of an install: `name`, its per-organization `slug`, and/or its saved `config` (deep-merged over the saved config: objects merge key by key, arrays and scalars replace, and `null` deletes a key; `schema` replaces whole, and a `null` inside it is kept). Addressed by id or slug. Authorization: organization administrators only. Returns 400 for a slug that is already taken in this organization.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "slug": {
                    "description": "Rename the per-organization slug. Must stay unique in the org.",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "config": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated install.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstalledActionEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "uninstallAction",
        "tags": ["Installed Actions"],
        "summary": "Uninstall an action",
        "description": "Removes the install (by id or slug) from this organization. Runs already dispatched are unaffected; the capability can be installed again later. Authorization: organization administrators only.",
        "responses": {
          "200": {
            "description": "The uninstalled action id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UninstallActionResult"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/actions/{id}/revisions": {
      "get": {
        "operationId": "listInstalledActionRevisions",
        "tags": ["Installed Actions"],
        "summary": "List the saved configs of an installed action",
        "description": "Newest first. Each save that changes the config adds a revision, and each run records the revision it used. Page with `limit` (1 to 100, default 20) and `starting_after` (a revision number). Authorization: any organization member. 404 when no install matches.",
        "responses": {
          "200": {
            "description": "The revisions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstalledActionRevisionList"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/actions/{id}/revisions/{revision}": {
      "get": {
        "operationId": "getInstalledActionRevision",
        "tags": ["Installed Actions"],
        "summary": "Get one saved config of an installed action",
        "description": "Returns the config of one revision. Authorization: any organization member. 404 when the install or the revision does not exist.",
        "responses": {
          "200": {
            "description": "The revision.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstalledActionRevisionEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "revision",
            "required": true
          }
        ]
      }
    },
    "/authorization/me/check": {
      "post": {
        "operationId": "checkMyAccess",
        "tags": ["Authorization"],
        "summary": "Check the current user’s permissions on resources",
        "description": "Checks resource access for the authenticated caller only. Authorization: any authenticated organization member — the subject is always the caller’s organization membership, so a caller can never probe another subject. Body: `checks` is a 1–50-item array of `{ permission, resourceType, resourceExternalId }`. Returns `{ results }` (one entry per check, each with an `authorized` boolean, in request order). If the caller has no organization-membership claim, returns `{ results: [] }`.",
        "responses": {
          "200": {
            "description": "Per-check authorization results for the calling user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessCheckResults"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "checks": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "permission": {
                          "type": "string",
                          "minLength": 1
                        },
                        "resourceType": {
                          "type": "string",
                          "minLength": 1
                        },
                        "resourceExternalId": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": ["permission", "resourceType", "resourceExternalId"]
                    }
                  }
                },
                "required": ["checks"]
              }
            }
          }
        }
      }
    },
    "/authorization/me/resources": {
      "get": {
        "operationId": "listMyAccessibleResources",
        "tags": ["Authorization"],
        "summary": "List resources the current user can access for a permission",
        "description": "Discovers the resource external ids the authenticated caller holds a given `permission` on. Authorization: any authenticated organization member — scoped to the caller’s membership. Query: `permission` and `resourceType` (required); `parentResourceType` + `parentResourceExternalId` (optional) scope the search to the immediate children of that parent. Omit the parent fields to search from the organization root. Returns `{ permission, resourceType, externalIds }`. With no membership claim, returns an empty `externalIds`.",
        "responses": {
          "200": {
            "description": "The external ids the caller may access under the permission.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessibleResources"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "permission",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "resourceType",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "parentResourceType",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "parentResourceExternalId",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ]
      }
    },
    "/authorization/me/permissions": {
      "get": {
        "operationId": "listMyPermissions",
        "tags": ["Authorization"],
        "summary": "List the current user’s effective permissions on a resource",
        "description": "Returns the authenticated caller’s effective (role-derived and inherited) permission set on a single resource. Authorization: any authenticated organization member — scoped to the caller’s membership. Query: `resourceType` and `resourceExternalId` (both required). Returns `{ permissions }` (the permission strings the caller effectively holds on that resource). With no membership claim, returns `{ permissions: [] }`.",
        "responses": {
          "200": {
            "description": "The caller’s effective permissions on the resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectivePermissions"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "resourceType",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "resourceExternalId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ]
      }
    },
    "/authorization/me/groups": {
      "get": {
        "operationId": "listMyGroups",
        "tags": ["Authorization"],
        "summary": "List the groups (teams) the current user belongs to",
        "description": "Returns the teams the authenticated caller is a member of. Authorization: any authenticated organization member — scoped to the caller’s membership; no query or body. Returns `{ groups }`. With no membership claim, returns `{ groups: [] }`.",
        "responses": {
          "200": {
            "description": "The groups the calling user belongs to.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GroupList"
                }
              }
            }
          }
        }
      }
    },
    "/authorization/grants": {
      "post": {
        "operationId": "createGrant",
        "tags": ["Authorization"],
        "summary": "Grant a role on a resource to a subject",
        "description": "Creates a role grant (a share) on a resource. Authorization: the caller must be an organization administrator, or hold the resource’s share permission on the target (`space:share` for `space`, `spacetype:share` for `spacetype`; `settings` has no share permission and is administrator-only); otherwise returns 403 `forbidden`. Body: `subject` (name exactly one of `organizationMembershipId` or `groupId`), `role` (role slug), `resourceType` (`space` | `spacetype` | `settings`), `resourceExternalId`. `settings` resources are created lazily (idempotent) before granting. Returns the created grant.",
        "responses": {
          "200": {
            "description": "The role grant was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoleGrant"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Caller is not an admin and lacks the resource’s share permission"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subject": {
                    "type": "object",
                    "properties": {
                      "organizationMembershipId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "groupId": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "role": {
                    "type": "string",
                    "minLength": 1
                  },
                  "resourceType": {
                    "type": "string",
                    "enum": ["space", "spacetype", "settings"]
                  },
                  "resourceExternalId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["subject", "role", "resourceType", "resourceExternalId"]
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteGrant",
        "tags": ["Authorization"],
        "summary": "Revoke a role grant on a resource from a subject",
        "description": "Revokes an existing role grant (unshares). Authorization: same as createGrant — org admin, or the caller holds the resource’s share permission on the target (`space:share`/`spacetype:share`; `settings` is admin-only); otherwise 403 `forbidden`. Body is the SAME shape as createGrant: `subject` (exactly one of `organizationMembershipId`/`groupId`), `role`, `resourceType`, `resourceExternalId`. Returns 204 No Content on success.",
        "responses": {
          "204": {
            "description": "The role grant was revoked"
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Caller is not an admin and lacks the resource’s share permission"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subject": {
                    "type": "object",
                    "properties": {
                      "organizationMembershipId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "groupId": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  },
                  "role": {
                    "type": "string",
                    "minLength": 1
                  },
                  "resourceType": {
                    "type": "string",
                    "enum": ["space", "spacetype", "settings"]
                  },
                  "resourceExternalId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["subject", "role", "resourceType", "resourceExternalId"]
              }
            }
          }
        }
      }
    },
    "/authorization/grants/resource": {
      "get": {
        "operationId": "listResourceGrants",
        "tags": ["Authorization"],
        "summary": "List the grants (shares) on a resource",
        "description": "Lists the role grants on a single resource — who it is shared with. Authorization: org admin, or the caller holds the resource’s share permission on the target (`space:share`/`spacetype:share`/`work_session:manage`; `settings` is admin-only); otherwise 403 `forbidden`. Query: `resourceType` (`space` | `spacetype` | `settings` | `work_session`) and `externalId` (required); optional `assignment` = `direct` | `indirect` filters to directly-assigned vs inherited grants. Returns the resource’s grants. `work_session` is readable here but NOT writable: the Workspace routes mint session grants, so `POST`/`DELETE /grants` still take only the three shareable types.",
        "responses": {
          "200": {
            "description": "The subjects and roles granted on the resource.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceGrants"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Caller is not an admin and lacks the resource’s share permission"
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "resourceType",
            "schema": {
              "type": "string",
              "enum": ["space", "spacetype", "settings", "work_session"]
            },
            "required": true
          },
          {
            "in": "query",
            "name": "externalId",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "assignment",
            "schema": {
              "type": "string",
              "enum": ["direct", "indirect"]
            }
          }
        ]
      }
    },
    "/authorization/grants/subject": {
      "get": {
        "operationId": "listSubjectGrants",
        "tags": ["Authorization"],
        "summary": "List the grants held by a subject (membership or group)",
        "description": "Lists every role grant held by one subject — what a membership or group has been shared. Authorization: org admin, EXCEPT a non-admin member may inspect their OWN membership’s grants (when the query’s `organizationMembershipId` equals the caller’s); any other subject requires admin, otherwise 403 `forbidden`. Query names EXACTLY ONE of `organizationMembershipId` or `groupId`. Returns the subject’s grants.",
        "responses": {
          "200": {
            "description": "The resources and roles granted to the subject.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubjectGrants"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Non-admin caller requested a subject other than their own membership"
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "organizationMembershipId",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "groupId",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ]
      }
    },
    "/authorization/groups": {
      "get": {
        "operationId": "listGroups",
        "tags": ["Authorization"],
        "summary": "List all groups (teams) in the organization",
        "description": "Lists every team in the caller’s organization. Authorization: any authenticated organization member (reads are open; only mutations are administrator-only). No query or body. Returns the organization’s groups.",
        "responses": {
          "200": {
            "description": "The organization’s groups.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GroupList"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createGroup",
        "tags": ["Authorization"],
        "summary": "Create a group (team)",
        "description": "Creates a new team in the caller’s organization. Authorization: organization administrators only — other callers get 403. Body: `name` (required, 1–255 chars) and optional `description`. Returns the created group with status 201.",
        "responses": {
          "201": {
            "description": "The group was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Group"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Caller is not an org admin"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "description": {
                    "type": ["string", "null"]
                  }
                },
                "required": ["name"]
              }
            }
          }
        }
      }
    },
    "/authorization/groups/{groupId}": {
      "get": {
        "operationId": "getGroup",
        "tags": ["Authorization"],
        "summary": "Get a single group (team) by id",
        "description": "Fetches one team by its `groupId` path parameter. Authorization: any authenticated organization member. Returns the group.",
        "responses": {
          "200": {
            "description": "The requested group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Group"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "groupId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateGroup",
        "tags": ["Authorization"],
        "summary": "Update a group (team)",
        "description": "Updates the group named by the `groupId` path parameter. Authorization: organization administrators only — other callers get 403. Body: optional `name` (1–255 chars) and/or `description` (both optional; send only the fields to change). Returns the updated group.",
        "responses": {
          "200": {
            "description": "The group was updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Group"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Caller is not an org admin"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "description": {
                    "type": ["string", "null"]
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "groupId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteGroup",
        "tags": ["Authorization"],
        "summary": "Delete a group (team)",
        "description": "Deletes the group named by the `groupId` path parameter and revokes its role grants. Authorization: organization administrators only — other callers get 403. Returns 204 No Content on success.",
        "responses": {
          "204": {
            "description": "The group was deleted"
          },
          "403": {
            "description": "Caller is not an org admin"
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "groupId",
            "required": true
          }
        ]
      }
    },
    "/authorization/groups/{groupId}/members": {
      "get": {
        "operationId": "listGroupMembers",
        "tags": ["Authorization"],
        "summary": "List the members of a group (team)",
        "description": "Lists the organization memberships that belong to the group named by the `groupId` path param. Authorization: any authed org member (reads are open). Returns the group’s members.",
        "responses": {
          "200": {
            "description": "The group’s members.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GroupMemberList"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "groupId",
            "required": true
          }
        ]
      },
      "post": {
        "operationId": "addGroupMember",
        "tags": ["Authorization"],
        "summary": "Add a member to a group (team)",
        "description": "Adds an organization membership to the group named by the `groupId` path parameter, applying the group’s grants to that member. Authorization: organization administrators only — other callers get 403. Body: `organizationMembershipId` (required). Returns the group with status 201.",
        "responses": {
          "201": {
            "description": "The member was added; the group is returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Group"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Caller is not an org admin"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "organizationMembershipId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["organizationMembershipId"]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "groupId",
            "required": true
          }
        ]
      }
    },
    "/authorization/groups/{groupId}/members/{om}": {
      "delete": {
        "operationId": "removeGroupMember",
        "tags": ["Authorization"],
        "summary": "Remove a member from a group (team)",
        "description": "Removes the organization membership named by the `:om` path parameter from the group named by `:groupId`, revoking the grants inherited from the group. Authorization: organization administrators only — other callers get 403. Returns 204 No Content on success.",
        "responses": {
          "204": {
            "description": "The member was removed from the group"
          },
          "403": {
            "description": "Caller is not an org admin"
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "groupId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "om",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/connections": {
      "get": {
        "operationId": "listConnections",
        "summary": "List the connections available in a space",
        "description": "Lists this space’s connections with their contract, auth status and verification status. A connection whose contract permits writes carries `installedActionId` — the approval-gated action a write goes through. Credential VALUES are never returned; `credentialRef` is an opaque reference. Authorization: `space:read` (org admins bypass); without it, 404 — existence is hidden. Query: `limit` (1–100) and `starting_after` (the last id of the previous page). Returns `{ data: Connection[], has_more }`.",
        "tags": ["Connections"],
        "responses": {
          "200": {
            "description": "One page of connections.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionList"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      },
      "post": {
        "operationId": "createConnection",
        "summary": "Add a connection to a space",
        "description": "Creates a connection in this space. `type` is `remote_mcp` (a remote MCP server), `authenticated_http` (one authenticated endpoint), `openapi` (an imported spec) or `slack`; `config` carries the plaintext, non-secret settings for that type (never a credential — use `POST …/credentials` or the OAuth flow). `operationPolicy` defaults to `read_only`: discovered write operations stay off until a builder opts in, and flipping it to `all` is what provisions the approval-gated `conn-<slug>` action. The space comes from the path and is never read from the body. Authorization: `space:contribute`. Returns 201 `{ data: Connection }`.",
        "tags": ["Connections"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": ["remote_mcp", "authenticated_http", "openapi", "slack"]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "config": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "operationPolicy": {
                    "default": "read_only",
                    "description": "A connection only becomes write-capable when a builder opts in.",
                    "type": "string",
                    "enum": ["read_only", "all"]
                  },
                  "scope": {
                    "type": "string",
                    "enum": ["space"]
                  }
                },
                "required": ["type", "name"],
                "description": "`spaceId` comes from the path, never the body."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created connection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/connections/discover": {
      "post": {
        "operationId": "discoverConnection",
        "summary": "Probe a URL for an OpenAPI surface",
        "description": "Fetches `url` (and the conventional spec paths beside it) and lists the operations it declares, each labelled `read` or `write`. `domainMismatch` is true when the spec’s own base host differs from the host that was typed — confirm explicitly before importing (P5-D11). The URL is checked against the SSRF denylist before any fetch: HTTPS only, no loopback, private, link-local or `.local`/`.internal` hosts. Authorization: `space:contribute`. Returns `{ data: ConnectionDiscovery }`.",
        "tags": ["Connections"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "example": "https://api.example.com/openapi.json"
                  }
                },
                "required": ["url"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The discovered surface.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionDiscovery"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/connections/{connectionId}": {
      "get": {
        "operationId": "getConnection",
        "summary": "Read one connection",
        "description": "Fetches one connection of this space by id or slug. A connection that resolves to a DIFFERENT space answers 404 — the authorization is the space in the path. An ambiguous alias answers 409 `ambiguous_connection` with the candidate list rather than guessing (P5-D13). Authorization: `space:read`; without it, 404.",
        "tags": ["Connections"],
        "responses": {
          "200": {
            "description": "The connection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateConnection",
        "summary": "Update a connection",
        "description": "Updates `name`, `slug`, `config`, `operationPolicy` or `enabled`. Flipping `operationPolicy` to `all` provisions the approval-gated `conn-<slug>` action; flipping it back removes it. Renaming the slug re-provisions the action under the new slug. Authorization: `space:contribute` on the connection’s own space (404 when it lives elsewhere). Returns `{ data: Connection }`.",
        "tags": ["Connections"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "config": {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "operationPolicy": {
                    "type": "string",
                    "enum": ["read_only", "all"]
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated connection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteConnection",
        "summary": "Delete a connection",
        "description": "Deletes the connection, destroys its stored secrets (deletion IS the revocation primitive) and removes its auto-provisioned action. Authorization: `space:contribute` on the connection’s own space. Returns `{ data: { id, deleted } }`.",
        "tags": ["Connections"],
        "responses": {
          "200": {
            "description": "The deleted connection id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedConnection"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/connections/{connectionId}/methods": {
      "get": {
        "operationId": "listConnectionMethods",
        "summary": "List a connection’s callable methods",
        "description": "The live method catalog: for a remote MCP server its `tools/list`, for an imported spec one method per operation. Each entry carries `access` plus the `sideEffect` / `externalDelivery` flags that decide whether the agent may call it inline or must go through the approval-gated action. Authorization: `space:read`; without it, 404.",
        "tags": ["Connections"],
        "responses": {
          "200": {
            "description": "The method catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionMethodList"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/connections/{connectionId}/verify": {
      "post": {
        "operationId": "verifyConnection",
        "summary": "Verify a connection now",
        "description": "Runs the contract’s live verification probe and persists the result on the connection. Stale verifications are also re-probed on a schedule — this is the “check it now” button. Authorization: `space:contribute`. Returns `{ data: { verificationStatus, verificationMessage, verificationCheckedAt, authStatus } }`.",
        "tags": ["Connections"],
        "responses": {
          "200": {
            "description": "The verification result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionVerification"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/connections/{connectionId}/credentials": {
      "post": {
        "operationId": "putConnectionCredential",
        "summary": "Store a connection credential",
        "description": "Stores a secret (an API key, a bot token) for this connection in the encrypted secret store. WRITE-ONLY: the value is never persisted by us, never echoed by any route, and never reaches the agent or its code sandbox — it is read only at call time, to authenticate the outbound request. The response carries the opaque reference. Re-posting the same `purpose` rotates the secret in place (the reference does not change). Authorization: `space:contribute`.",
        "tags": ["Connections"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "purpose": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "example": "apiKey"
                  },
                  "value": {
                    "type": "string",
                    "minLength": 1
                  },
                  "expiresAt": {
                    "type": "string"
                  }
                },
                "required": ["purpose", "value"],
                "description": "Write-only. The value goes to the encrypted secret store and is never echoed back."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored credential reference.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionCredentialRef"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ]
      }
    },
    "/me/developer-observability": {
      "get": {
        "operationId": "listDeveloperObservations",
        "tags": ["Developer observability"],
        "summary": "List recent request and run traces",
        "description": "Admin-only, organization-scoped operational metadata. Requires a real human admin session — org API keys are rejected here even though they are admin-equivalent elsewhere, since a machine credential has no legitimate use for internal telemetry. Developer Mode controls UI exposure; it is not the authorization gate.",
        "responses": {
          "200": {
            "description": "Recent unexpired trace roots.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeveloperObservationList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": ["running", "ok", "error", "cancelled", "expired"]
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string",
              "enum": ["request", "network", "queue", "inference", "action", "storage"]
            }
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "in": "query",
            "name": "spaceId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          },
          {
            "in": "query",
            "name": "before",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ]
      }
    },
    "/me/developer-observability/{traceId}": {
      "get": {
        "operationId": "getDeveloperObservationTrace",
        "tags": ["Developer observability"],
        "summary": "Inspect one request or run trace",
        "responses": {
          "200": {
            "description": "Ordered observations and current source-owned properties.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeveloperObservationDetail"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Trace not found or not visible to this caller."
          },
          "410": {
            "description": "The trace source TTL elapsed."
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "traceId",
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{32}$"
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/memory-repo/tree": {
      "get": {
        "operationId": "listMyAssistantMemoryRepoTree",
        "summary": "List memory files",
        "description": "Lists every file of the saved memory with its size, blob and front-matter summary.",
        "tags": ["My assistant"],
        "parameters": [
          {
            "in": "query",
            "name": "prefix",
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List memory files",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "path": {
                                "type": "string"
                              },
                              "size": {
                                "type": "number"
                              },
                              "blob": {
                                "type": "string"
                              },
                              "summary": {
                                "type": "string"
                              }
                            },
                            "required": ["path", "size", "blob"]
                          }
                        }
                      },
                      "required": ["sha", "entries"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/memory-repo/files": {
      "get": {
        "operationId": "getMyAssistantMemoryRepoFiles",
        "summary": "Read memory files",
        "description": "Reads up to 20 files at once. Repeat `path` for each file. A missing file answers `missing: true`.",
        "tags": ["My assistant"],
        "parameters": [
          {
            "in": "query",
            "name": "path",
            "description": "A relative file path. Repeat up to 20 times.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read memory files",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "files": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "path": {
                                "type": "string"
                              },
                              "content": {
                                "type": "string"
                              },
                              "blob": {
                                "type": "string"
                              },
                              "missing": {
                                "type": "boolean",
                                "const": true
                              }
                            },
                            "required": ["path"]
                          }
                        }
                      },
                      "required": ["sha", "files"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putMyAssistantMemoryRepoFile",
        "summary": "Save a memory file",
        "description": "Creates or replaces one file. `expectBlob` is the blob you read (null for a new file), so a concurrent edit answers 409 instead of being overwritten.",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  },
                  "content": {
                    "type": "string",
                    "maxLength": 262144
                  },
                  "expectBlob": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9a-f]{40}$"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The blob you read, or null to create a new file. Stale values answer 409."
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": ["path", "content", "expectBlob"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Nothing changed; the unchanged head",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "201": {
            "description": "The new version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`expect_failed` (`paths`) — the file changed since you read it; `stale_parent` or `conflict` — the history moved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`lint_failed` — `violations` lists each file rule the change broke.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteMyAssistantMemoryRepoFile",
        "summary": "Delete a memory file",
        "description": "Deletes one file. `expectBlob` is the blob you read; a changed file answers 409.",
        "tags": ["My assistant"],
        "parameters": [
          {
            "in": "query",
            "name": "path",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            },
            "required": true
          },
          {
            "in": "query",
            "name": "expectBlob",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Nothing changed; the unchanged head",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "201": {
            "description": "The new version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`expect_failed` (`paths`) — the file changed since you read it; `stale_parent` or `conflict` — the history moved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`lint_failed` — `violations` lists each file rule the change broke.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/memory-repo/history": {
      "get": {
        "operationId": "listMyAssistantMemoryRepoHistory",
        "summary": "List memory history",
        "description": "Lists saved versions, newest first, optionally for one file. Pass `nextCursor` back as `cursor` for the next page.",
        "tags": ["My assistant"],
        "parameters": [
          {
            "in": "query",
            "name": "path",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List memory history",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "sha": {
                            "type": "string"
                          },
                          "parents": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "author": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "time": {
                            "type": "number"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": ["sha", "parents", "author", "email", "time", "message"]
                      }
                    },
                    "nextCursor": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["data", "nextCursor"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/memory-repo/history/{sha}": {
      "get": {
        "operationId": "getMyAssistantMemoryRepoCommit",
        "summary": "Get one memory version",
        "description": "Returns one saved version with the per-file changes it made.",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Get one memory version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sha",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/memory-repo/history/{sha}/revert": {
      "post": {
        "operationId": "revertMyAssistantMemoryRepoCommit",
        "summary": "Revert a memory version",
        "description": "Saves a new version that undoes the given one. A later edit to the same files answers 409 `conflict`.",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Nothing changed; the unchanged head",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "201": {
            "description": "The new version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`expect_failed` (`paths`) — the file changed since you read it; `stale_parent` or `conflict` — the history moved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`lint_failed` — `violations` lists each file rule the change broke.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sha",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/memory-repo/proposals": {
      "get": {
        "operationId": "listMyAssistantMemoryRepoProposals",
        "summary": "List memory proposals",
        "description": "Lists proposed memory changes that wait for your review, newest first.",
        "tags": ["My assistant"],
        "parameters": [
          {
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string",
              "enum": ["open", "merged", "closed", "all"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List memory proposals",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "number": {
                            "type": "number"
                          },
                          "from": {
                            "type": "string"
                          },
                          "into": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string",
                            "enum": ["open", "merged", "closed"]
                          },
                          "title": {
                            "type": "string"
                          },
                          "author": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              }
                            },
                            "required": ["name", "email"]
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "mergedSha": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "number",
                          "from",
                          "into",
                          "state",
                          "title",
                          "author",
                          "createdAt"
                        ]
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/memory-repo/proposals/{n}": {
      "get": {
        "operationId": "getMyAssistantMemoryRepoProposal",
        "summary": "Get a memory proposal",
        "description": "Returns one proposal with its file changes.",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Get a memory proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "number"
                        },
                        "from": {
                          "type": "string"
                        },
                        "into": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "enum": ["open", "merged", "closed"]
                        },
                        "title": {
                          "type": "string"
                        },
                        "author": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            }
                          },
                          "required": ["name", "email"]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "mergedSha": {
                          "type": "string"
                        },
                        "compare": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The proposed file changes; null when the proposed branch is gone."
                        }
                      },
                      "required": [
                        "number",
                        "from",
                        "into",
                        "state",
                        "title",
                        "author",
                        "createdAt",
                        "compare"
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "n",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/memory-repo/proposals/{n}/approve": {
      "post": {
        "operationId": "approveMyAssistantMemoryRepoProposal",
        "summary": "Approve a memory proposal",
        "description": "Applies the proposed changes to the saved memory as you. A file changed on both sides answers 409 `conflict` and leaves the proposal open.",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Approve a memory proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "number"
                        },
                        "from": {
                          "type": "string"
                        },
                        "into": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "const": "merged"
                        },
                        "title": {
                          "type": "string"
                        },
                        "author": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            }
                          },
                          "required": ["name", "email"]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "mergedSha": {
                          "type": "string"
                        },
                        "sha": {
                          "type": ["string", "null"]
                        }
                      },
                      "required": [
                        "number",
                        "from",
                        "into",
                        "state",
                        "title",
                        "author",
                        "createdAt",
                        "sha"
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`conflict` or `not_open` — the proposal stays as it was.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "n",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/memory-repo/proposals/{n}/reject": {
      "post": {
        "operationId": "rejectMyAssistantMemoryRepoProposal",
        "summary": "Reject a memory proposal",
        "description": "Closes the proposal without applying it.",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Reject a memory proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "number"
                        },
                        "from": {
                          "type": "string"
                        },
                        "into": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "enum": ["open", "merged", "closed"]
                        },
                        "title": {
                          "type": "string"
                        },
                        "author": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            }
                          },
                          "required": ["name", "email"]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "mergedSha": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "number",
                        "from",
                        "into",
                        "state",
                        "title",
                        "author",
                        "createdAt"
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`not_open` — the proposal was already applied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "n",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/memory-repo/forget": {
      "post": {
        "operationId": "forgetMyAssistantMemoryRepo",
        "summary": "Forget memory content",
        "description": "Removes the matching files, or every file version that contains `text`, from all saved history. This cannot be undone.",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paths": {
                    "description": "Exact paths or globs (`**` spans folders) to drop from every version.",
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    }
                  },
                  "text": {
                    "description": "Drop every file version whose content contains this text.",
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 1000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Forget memory content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "rewritten": {
                          "type": "number"
                        },
                        "refs": {
                          "type": "number"
                        }
                      },
                      "required": ["rewritten", "refs"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/conversation": {
      "get": {
        "operationId": "getMyAssistantConversation",
        "summary": "Read your assistant conversation state",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Read your assistant conversation state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantConversation"
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      }
    },
    "/me/assistant/messages": {
      "get": {
        "operationId": "listMyAssistantMessages",
        "summary": "Read your assistant messages",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Read your assistant messages",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssistantEntry"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    }
                  },
                  "required": ["data", "hasMore"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "beforeSeq",
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ]
      },
      "post": {
        "operationId": "sendMyAssistantMessage",
        "summary": "Message your personal assistant",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{1,80}$",
                    "description": "Your message id. A retry with the same id is a no-op."
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16000
                  },
                  "replyTo": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{1,80}$"
                  },
                  "fileIds": {
                    "description": "Files from your own files (`me:<userId>`) to attach.",
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  }
                },
                "required": ["id", "text"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Message your personal assistant",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "queued": {
                          "type": "boolean"
                        }
                      },
                      "required": ["id", "queued"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "`reply_not_found`: the message you reply to is gone.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "`credits_exhausted`: the organization has no credits left.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          },
          "409": {
            "description": "`request_conflict`: the message id was used for another message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "`queue_full`: wait for the assistant to catch up.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/cancel": {
      "post": {
        "operationId": "cancelMyAssistantMessage",
        "summary": "Stop or unqueue a message",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{1,80}$"
                  }
                },
                "required": ["id"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Stop or unqueue a message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "cancelled": {
                          "type": "string",
                          "enum": ["active", "queued"]
                        }
                      },
                      "required": ["id", "cancelled"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          },
          "409": {
            "description": "`not_running`: no matching reply is running or queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/live": {
      "get": {
        "operationId": "getMyAssistantLive",
        "summary": "Read the reply being written",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Read the reply being written",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "replyTo": {
                              "type": "string"
                            },
                            "text": {
                              "type": "string"
                            },
                            "tools": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "running": {
                                    "type": "string"
                                  },
                                  "done": {
                                    "type": "string"
                                  },
                                  "kind": {
                                    "type": "string",
                                    "enum": ["read", "code"]
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": ["running", "done", "error"]
                                  }
                                },
                                "required": ["id", "running", "done", "kind", "status"]
                              }
                            }
                          },
                          "required": ["id", "replyTo", "text", "tools"]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      }
    },
    "/me/assistant/suggestions": {
      "get": {
        "operationId": "getMyAssistantSuggestions",
        "summary": "Suggested next messages",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Suggested next messages",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "suggestions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "label": {
                                "type": "string"
                              },
                              "prompt": {
                                "type": "string"
                              }
                            },
                            "required": ["label", "prompt"]
                          }
                        }
                      },
                      "required": ["suggestions"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      }
    },
    "/me/assistant/home": {
      "get": {
        "operationId": "getMyAssistantHome",
        "summary": "Read your latest briefing",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Read your latest briefing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantHome"
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      }
    },
    "/me/assistant/reactions": {
      "get": {
        "operationId": "listMyAssistantReactions",
        "summary": "Read assistant message reactions",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Read assistant message reactions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entryId": {
                            "type": "string"
                          },
                          "actor": {
                            "type": "string",
                            "enum": ["user", "assistant"]
                          },
                          "emoji": {
                            "type": "string",
                            "enum": ["👍", "❤️", "😂", "🎉", "👀", "🤔"]
                          }
                        },
                        "required": ["entryId", "actor", "emoji"]
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      }
    },
    "/me/assistant/messages/{entryId}/reaction": {
      "put": {
        "operationId": "reactToMyAssistantMessage",
        "summary": "React to an assistant message",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "emoji": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": ["👍", "❤️", "😂", "🎉", "👀", "🤔"]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["emoji"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "React to an assistant message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entryId": {
                            "type": "string"
                          },
                          "actor": {
                            "type": "string",
                            "enum": ["user", "assistant"]
                          },
                          "emoji": {
                            "type": "string",
                            "enum": ["👍", "❤️", "😂", "🎉", "👀", "🤔"]
                          }
                        },
                        "required": ["entryId", "actor", "emoji"]
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "entryId",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,80}$"
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/memory/{name}": {
      "get": {
        "operationId": "getMyAssistantMemory",
        "summary": "Read a personal memory document",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Read a personal memory document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "content": {
                          "type": "string",
                          "maxLength": 16000
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "name": {
                          "type": "string",
                          "enum": ["SOUL.md", "MEMORY.md"]
                        }
                      },
                      "required": ["content", "version", "name"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "enum": ["SOUL.md", "MEMORY.md"]
            },
            "required": true
          }
        ]
      },
      "put": {
        "operationId": "updateMyAssistantMemory",
        "summary": "Save a personal memory document",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string",
                    "maxLength": 16000
                  },
                  "version": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["content", "version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Save a personal memory document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "content": {
                          "type": "string",
                          "maxLength": 16000
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "name": {
                          "type": "string",
                          "enum": ["SOUL.md", "MEMORY.md"]
                        }
                      },
                      "required": ["content", "version", "name"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          },
          "409": {
            "description": "`memory_conflict`: the memory changed; reload it before saving.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "schema": {
              "type": "string",
              "enum": ["SOUL.md", "MEMORY.md"]
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/routines": {
      "get": {
        "operationId": "listMyAssistantRoutines",
        "summary": "List your personal routines",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "List your personal routines",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssistantRoutine"
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      }
    },
    "/me/assistant/routines/{routineId}": {
      "put": {
        "operationId": "saveMyAssistantRoutine",
        "summary": "Create or replace a personal routine",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "markdown": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16000,
                    "description": "The whole `routines/<id>.md` file: frontmatter `name`, `schedule`, `enabled`."
                  }
                },
                "required": ["markdown"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Create or replace a personal routine",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AssistantRoutine"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          },
          "422": {
            "description": "`invalid_routine` or `routine_limit`: the routine cannot be saved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "routineId",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,59}$"
            },
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteMyAssistantRoutine",
        "summary": "Remove a personal routine",
        "tags": ["My assistant"],
        "responses": {
          "204": {
            "description": "Remove a personal routine"
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "routineId",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,59}$"
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/routines/{routineId}/fire": {
      "post": {
        "operationId": "fireMyAssistantRoutine",
        "summary": "Run your personal routine now",
        "tags": ["My assistant"],
        "responses": {
          "202": {
            "description": "Run your personal routine now",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AssistantRoutine"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "402": {
            "description": "`credits_exhausted`: the organization has no credits left.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          },
          "409": {
            "description": "`routine_disabled`: turn the routine on first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "routineId",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,59}$"
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/commitments": {
      "get": {
        "operationId": "listMyAssistantCommitments",
        "summary": "What your assistant is following through",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "What your assistant is following through",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssistantCommitment"
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      }
    },
    "/me/assistant/commitments/{commitmentId}": {
      "patch": {
        "operationId": "updateMyAssistantCommitment",
        "summary": "Change what a commitment covers or when it next runs",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "outcome": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 400
                  },
                  "completion": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 400
                  },
                  "nextAction": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "schedule": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "nextWakeAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  }
                },
                "required": ["version"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Change what a commitment covers or when it next runs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AssistantCommitment"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "`commitment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`commitment_conflict`: it changed; reload. `commitment_closed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_schedule` or `invalid_wake`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "commitmentId",
            "schema": {
              "type": "string",
              "pattern": "^cmt_[0-9A-HJKMNP-TV-Z]{26}$"
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/commitments/{commitmentId}/stop": {
      "post": {
        "operationId": "stopMyAssistantCommitment",
        "summary": "Stop a commitment and its future wakes",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Stop a commitment and its future wakes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AssistantCommitment"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "`commitment_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "commitmentId",
            "schema": {
              "type": "string",
              "pattern": "^cmt_[0-9A-HJKMNP-TV-Z]{26}$"
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/delivery": {
      "get": {
        "operationId": "getMyAssistantDelivery",
        "summary": "When your assistant may message you",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "When your assistant may message you",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantDelivery"
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      },
      "put": {
        "operationId": "updateMyAssistantDelivery",
        "summary": "Save quiet hours and the pause switch",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quietHours": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "start": {
                            "type": "string",
                            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                          },
                          "end": {
                            "type": "string",
                            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                          }
                        },
                        "required": ["start", "end"],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "paused": {
                    "type": "boolean",
                    "description": "Hold all autonomous work; promises still deliver."
                  }
                },
                "required": ["quietHours", "paused"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Save quiet hours and the pause switch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantDelivery"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      }
    },
    "/me/assistant/home/close": {
      "post": {
        "operationId": "closeMyAssistantRecommendation",
        "summary": "Close a recommendation",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "issueKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256,
                    "pattern": "^[^\\s<>]+$"
                  },
                  "reason": {
                    "type": "string",
                    "enum": ["handled", "not_relevant", "less_like_this", "accepted"]
                  }
                },
                "required": ["issueKey", "reason"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Close a recommendation"
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "`issue_not_found`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/learning": {
      "get": {
        "operationId": "getMyAssistantLearning",
        "summary": "What your assistant learned",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "What your assistant learned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantLearning"
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      }
    },
    "/me/assistant/skills/{slug}": {
      "post": {
        "operationId": "updateMyAssistantSkill",
        "summary": "Use, roll back or turn off a learned skill",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "activate"
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": ["action", "version"],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "rollback"
                      }
                    },
                    "required": ["action"],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "action": {
                        "type": "string",
                        "const": "disable"
                      }
                    },
                    "required": ["action"],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Use, roll back or turn off a learned skill",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AssistantLearnedSkill"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          },
          "409": {
            "description": "`skill_state`: that version cannot be used now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`skill_limit`: turn another learned skill off first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]{0,59}$"
            },
            "required": true
          }
        ]
      }
    },
    "/me/assistant/browser": {
      "get": {
        "operationId": "getMyAssistantBrowser",
        "summary": "Your assistant’s browser",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Your assistant’s browser",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/browser/screenshot": {
      "get": {
        "operationId": "getMyAssistantBrowserScreenshot",
        "summary": "A live frame of your assistant’s browser",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "A live frame of your assistant’s browser"
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/browser/takeover": {
      "post": {
        "operationId": "myAssistantBrowsertakeover",
        "summary": "takeover your assistant’s browser",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["controlGeneration"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "takeover your assistant’s browser",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/browser/input": {
      "post": {
        "operationId": "myAssistantBrowserinput",
        "summary": "input your assistant’s browser",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "callId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "input": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "click"
                          },
                          "x": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 10000
                          },
                          "y": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 10000
                          }
                        },
                        "required": ["type", "x", "y"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "text"
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 8192
                          }
                        },
                        "required": ["type", "text"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "key"
                          },
                          "key": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          }
                        },
                        "required": ["type", "key"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "scroll"
                          },
                          "deltaX": {
                            "type": "number",
                            "minimum": -10000,
                            "maximum": 10000
                          },
                          "deltaY": {
                            "type": "number",
                            "minimum": -10000,
                            "maximum": 10000
                          }
                        },
                        "required": ["type", "deltaX", "deltaY"],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": ["controlGeneration", "callId", "input"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "input your assistant’s browser",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/browser/handback": {
      "post": {
        "operationId": "myAssistantBrowserhandback",
        "summary": "handback your assistant’s browser",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "handoffId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "required": ["controlGeneration", "handoffId"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "handback your assistant’s browser",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/browser/close": {
      "post": {
        "operationId": "myAssistantBrowserclose",
        "summary": "close your assistant’s browser",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["controlGeneration"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "close your assistant’s browser",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/browser/forget": {
      "post": {
        "operationId": "myAssistantBrowserforget",
        "summary": "forget your assistant’s browser",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["controlGeneration"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "forget your assistant’s browser",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/browser/connect-site": {
      "post": {
        "operationId": "myAssistantBrowserconnect-site",
        "summary": "connect-site your assistant’s browser",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "policy": {
                    "type": "object",
                    "properties": {
                      "allowedDomains": {
                        "minItems": 1,
                        "maxItems": 30,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 253,
                          "pattern": "^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,63}$"
                        }
                      },
                      "persist": {
                        "type": "boolean"
                      }
                    },
                    "required": ["allowedDomains", "persist"],
                    "additionalProperties": false
                  }
                },
                "required": ["controlGeneration", "policy"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "connect-site your assistant’s browser",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant/browser/ws-ticket": {
      "post": {
        "operationId": "myAssistantBrowserws-ticket",
        "summary": "ws-ticket your assistant’s browser",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["controlGeneration"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ws-ticket your assistant’s browser",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ticket": {
                      "type": "string"
                    },
                    "computer": {
                      "type": "string"
                    }
                  },
                  "required": ["ticket", "computer"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/me/assistant": {
      "get": {
        "operationId": "getMyAssistant",
        "summary": "Your assistant profile",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Your assistant profile",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AssistantProfile"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      },
      "put": {
        "operationId": "updateMyAssistant",
        "summary": "Save your assistant name, appearance and time zone",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "appearance": {
                    "type": "object",
                    "properties": {
                      "emoji": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": ["🌿", "🦉", "🦊", "🐙", "☁️", "✦"],
                            "x-fern-enum": {
                              "🌿": {
                                "name": "Herb"
                              },
                              "🦉": {
                                "name": "Owl"
                              },
                              "🦊": {
                                "name": "Fox"
                              },
                              "🐙": {
                                "name": "Octopus"
                              },
                              "☁️": {
                                "name": "Cloud"
                              },
                              "✦": {
                                "name": "Star"
                              }
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "accent": {
                        "type": "string",
                        "enum": ["sage", "sand", "sky", "rose", "lilac"]
                      }
                    },
                    "required": ["emoji", "accent"],
                    "additionalProperties": false
                  },
                  "timeZone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Save your assistant name, appearance and time zone",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AssistantProfile"
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      }
    },
    "/me/assistant/connections": {
      "get": {
        "operationId": "listMyAssistantConnections",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Private integrations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionList"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createMyAssistantConnection",
        "tags": ["My assistant"],
        "responses": {
          "201": {
            "description": "Private integration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": ["remote_mcp", "authenticated_http", "openapi", "slack"]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "config": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "operationPolicy": {
                    "default": "read_only",
                    "description": "A connection only becomes write-capable when a builder opts in.",
                    "type": "string",
                    "enum": ["read_only", "all"]
                  }
                },
                "required": ["type", "name"],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/me/assistant/connections/{connectionId}": {
      "get": {
        "operationId": "getMyAssistantConnection",
        "summary": "Read your private integration",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Read your private integration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateMyAssistantConnection",
        "summary": "Update your private integration",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Update your private integration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                  },
                  "config": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "operationPolicy": {
                    "type": "string",
                    "enum": ["read_only", "all"]
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteMyAssistantConnection",
        "summary": "Remove your private integration",
        "tags": ["My assistant"],
        "responses": {
          "204": {
            "description": "Integration removed."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ]
      }
    },
    "/me/assistant/connections/{connectionId}/methods": {
      "get": {
        "operationId": "listMyAssistantConnectionMethods",
        "summary": "Discover private integration tools",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Discover private integration tools",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionMethodList"
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ]
      }
    },
    "/me/assistant/connections/{connectionId}/verify": {
      "post": {
        "operationId": "verifyMyAssistantConnection",
        "summary": "Test your private integration",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Test your private integration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionVerification"
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ]
      }
    },
    "/me/assistant/connections/{connectionId}/credentials": {
      "post": {
        "operationId": "postMeAssistantConnectionsByConnectionIdCredentials",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "purpose": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "example": "apiKey"
                  },
                  "value": {
                    "type": "string",
                    "minLength": 1
                  },
                  "expiresAt": {
                    "type": "string"
                  }
                },
                "required": ["purpose", "value"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "connectionId",
            "required": true
          }
        ],
        "responses": {
          "200": {},
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "tags": ["Workspace"]
      }
    },
    "/me/assistant/dictation/transcribe": {
      "post": {
        "operationId": "transcribeMyAssistantDictation",
        "summary": "Transcribe a dictated message",
        "tags": ["My assistant"],
        "responses": {
          "200": {
            "description": "Transcribe a dictated message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": ["text"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "402": {
            "description": "`credits_exhausted`: the organization has no credits left.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "clean",
            "schema": {
              "type": "string",
              "enum": ["true", "false"]
            }
          }
        ]
      }
    },
    "/me/assistant/dictation/cleanup": {
      "post": {
        "operationId": "cleanMyAssistantDictation",
        "summary": "Clean up a dictated message",
        "tags": ["My assistant"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 8000
                  }
                },
                "required": ["text"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Clean up a dictated message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": ["text"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "An active personal account is required."
          },
          "404": {
            "description": "The resource is unavailable to this user."
          }
        }
      }
    },
    "/me": {
      "get": {
        "operationId": "getMe",
        "tags": ["Me"],
        "summary": "Get the authenticated caller",
        "description": "Returns the current caller as `userId`, `organizationId`, `tenantSlug`, `roles`, and the caller’s own display `name` / `avatarUrl`. Authorization: any authenticated organization member. An `admin` role grants access to organization-administration operations. Use this endpoint to discover the caller’s organization and privileges before calling scoped routes.",
        "responses": {
          "200": {
            "description": "The authenticated caller and their organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          }
        }
      }
    },
    "/me/preferences": {
      "get": {
        "operationId": "getMyPreferences",
        "tags": ["Me"],
        "summary": "The caller's preferences",
        "description": "Returns the caller's own preferences — `language` (or null if never set), `developer` (developer-mode flag, defaults to false), `notifications`, and `files` (the sort of the file list). Authorization: any authenticated member of the organization (no administrator role required).",
        "responses": {
          "200": {
            "description": "The caller's preferences.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserPreferences"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateMyPreferences",
        "tags": ["Me"],
        "summary": "Update the caller's preferences",
        "description": "Strict partial merge: send only the fields to change (`language`, `developer`, `notifications`, `files`); nested objects merge per key, and unknown keys are rejected. Returns the full updated preferences. Authorization: any authenticated member of the tenant (the caller edits only their own preferences). Returns 400 for an invalid body.",
        "responses": {
          "200": {
            "description": "The updated preferences.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserPreferences"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUserPreferences"
              }
            }
          }
        }
      }
    },
    "/me/desk": {
      "get": {
        "operationId": "getMyDesk",
        "tags": ["Me"],
        "summary": "Get (and lazily create) the caller's desk space",
        "description": "Returns the caller's private desk space id, creating the hidden space on first call. The desk is where default-agent runs execute: it never appears in `GET /spaces` and is readable by its owner only — every other caller, organization administrators included, receives 404 on its space-scoped routes. Authorization: any authenticated member.",
        "responses": {
          "200": {
            "description": "The caller's desk.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Desk"
                }
              }
            }
          }
        }
      }
    },
    "/me/work": {
      "get": {
        "operationId": "getMyWork",
        "tags": ["Me"],
        "summary": "The caller's work queue",
        "description": "Everything waiting on the caller: pending `approval`s (anyone with access to the work session may decide), ready `human_task`s assigned to them or unassigned (anyone in the space may complete those; claiming is optional), `question`s and `mention`s, `parked` — a turn that stopped and is waiting on a person — `run_attention` — a LEGACY run **they started** that failed, or that parked with nobody watching (an overnight trigger or a channel message) — and `connector`, a connection in a space they can read whose authorization broke and needs re-auth. Served from ONE reader — the `inbox_items` projection plus the broken-connection scan — which is also what `GET /workspace/inbox` serves, grouped by work session instead of listed flat, so the two surfaces can never disagree: the same `connector` item id appears on both, and `POST /workspace/inbox/{itemId}/read` dismisses it on both. Newest first, cursor-paginated via `starting_after` (up to 50 items per page); `connector` items ride one extra group with `runId: null` on the first page. Reads a best-effort projection — `asOf` (response) and per-group `asOf` mark staleness; a decision made seconds ago may still appear until the projection catches up, and clients poll this route (there is no push), so the badge can lag the session you are looking at by up to 30 seconds. `totalCount` is the badge number: every pending item for the caller across all pages. Authorization: any authenticated member; non-admins see only sessions and spaces they may read.",
        "parameters": [
          {
            "in": "query",
            "name": "starting_after",
            "description": "Cursor: the previous page’s `nextCursor`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The work queue, grouped by work session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MyWork"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — an unparseable `starting_after`."
          }
        }
      }
    },
    "/me/threads": {
      "post": {
        "operationId": "createThread",
        "tags": ["Me"],
        "summary": "Start a thread with the default agent",
        "description": "Starts a new conversation thread: resolves the container, mints a `threadId`, and creates the thread’s first agent run there from the founding `prompt` (1–4000 chars) and optional `fileIds` (1–200). Omit `spaceId` for the caller’s private desk (the default); pass a `spaceId` to start the thread in a space, where every holder of `space:contribute` can read and continue it. Authorization: any real organization member (embed tokens and API keys have no desk → 404); a named space requires `space:contribute` (404 otherwise) and may never be a desk id (400 `cannot_target_desk`). Gated by `AGENTS_ENABLED`; disabled → 404. Returns 201 `{ threadId, runId, steered: false, status, spaceId }`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateThreadBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The thread’s first run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ThreadRunResult"
                }
              }
            }
          },
          "400": {
            "description": "`cannot_target_desk` — a desk is never a named target."
          },
          "404": {
            "description": "Agents disabled, no desk, or the space is not contributable."
          }
        }
      }
    },
    "/me/threads/{threadId}/messages": {
      "post": {
        "operationId": "sendThreadMessage",
        "tags": ["Me"],
        "summary": "Send a message to a thread",
        "description": "Adds a turn to a thread. If the latest run in the thread is still live (not terminal, not paused) the message steers it in place; otherwise a successor run is started in the same thread, carrying the previous conversation forward as context (spec §A.4). A thread holds at most one non-terminal run. Authorization: whoever may contribute to the thread’s container — its owner for a desk thread, any holder of `space:contribute` for a thread in a space (everyone else gets 404). Gated by `AGENTS_ENABLED`; disabled → 404. Returns `{ threadId, runId, steered, status, spaceId }` — 200 when steered, 201 for a successor run. 409 `agent_busy` when the run’s steering queue is full: with several participants that is routine, so retry after `retryAfterMs` (default ~3 s) rather than surfacing an error.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessageBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The steered run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ThreadRunResult"
                }
              }
            }
          },
          "201": {
            "description": "A new successor run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ThreadRunResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Agents disabled, unknown thread, or no access to its container."
          },
          "409": {
            "description": "The agent is busy (`agent_busy`, with `queueDepth`/`retryAfterMs`)."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "threadId",
            "required": true
          }
        ]
      }
    },
    "/me/threads/{threadId}/share": {
      "post": {
        "operationId": "shareThread",
        "tags": ["Me"],
        "summary": "Continue a thread in a shared space",
        "description": "Forks the thread into a space so colleagues can join it (P3-D7). A thread never changes container: this starts a NEW thread in the target, seeded with the source thread’s conversation tail (≤4 KiB) and its title, and leaves a one-way pointer on both sides. Files are NEVER carried over — promoting them stays the explicit `keep` / `move_files` path. Body: either `{ spaceId }` for an existing space, or `{ spaceTypeId, title }` to create one (the creator is granted `space-contributor` on it). Authorization: the caller must be able to contribute to the source thread’s container AND to the target — 404 hides either; creating a space requires `spacetype:contribute` on the parent (403). A desk is never a valid target (400 `cannot_target_desk`). Gated by `AGENTS_ENABLED`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShareThreadBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new thread in the target space.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SharedThreadResult"
                }
              }
            }
          },
          "400": {
            "description": "`cannot_target_desk` — a desk is never a share target."
          },
          "403": {
            "description": "The caller may not create a space under that space type."
          },
          "404": {
            "description": "Agents disabled, unknown thread, or the target is not contributable."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "threadId",
            "required": true
          }
        ]
      }
    },
    "/me/threads/{threadId}/view": {
      "post": {
        "operationId": "markThreadViewed",
        "tags": ["Me"],
        "summary": "Mark a thread as seen",
        "description": "Records that the caller has looked at this thread, which is what `GET /me/agent-runs?group=thread` compares each thread’s last activity against to decide `unread`. Idempotent, bodyless, fire-and-forget — call it when the thread view mounts and when the window regains focus. It creates nothing and starts nothing: a thread is marked seen, not read-receipted, so there is no per-message state and no notification is consumed. Authorization: whoever can read the thread’s container — its owner for a desk thread, any holder of `space:read` for a thread in a space (everyone else gets 404).",
        "responses": {
          "204": {
            "description": "Recorded."
          },
          "404": {
            "description": "Unknown thread, or no access to its container."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "threadId",
            "required": true
          }
        ]
      }
    },
    "/me/agent-runs": {
      "get": {
        "operationId": "listMyAgentRuns",
        "tags": ["Me"],
        "summary": "The caller's agent runs (and threads)",
        "description": "Lists agent runs in every container the caller can read — their own desk plus every space they hold `space:read` on — newest activity first. Each row carries `startedBy` and the container `spaceTitle` (null for desks), so a client can split \"mine\" from \"shared with me\"; `?scope=mine|shared` filters to one side. Other filters: `status` and `threadId`. `?group=thread` collapses to the newest run per thread (the thread list, up to 20; no further paging) and is the only mode that derives `threadStatus` — `running` while a run is live, `unread` when the thread moved since the caller last marked it seen (`POST /me/threads/{threadId}/view`, with a 30-second grace on a brand-new thread), `idle` otherwise. Every other mode reports `idle`. Otherwise cursor-paginated via `starting_after` (the previous page’s last `updatedAt`), 20 runs per page. Reads best-effort projections — the envelope `asOf` and per-row `updatedAt` mark staleness. `totalCount` is the (scan-capped) number of matching runs. Authorization: any authenticated member; another member’s desk threads are never listed, organization administrators included.",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "description": "Filter to one run status.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "threadId",
            "description": "Filter to one thread.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "scope",
            "description": "'mine' (started by the caller) or 'shared' (started by someone else).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "group",
            "description": "Set to 'thread' to collapse to the newest run per thread.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "starting_after",
            "description": "Cursor: the previous page’s last updatedAt.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of agent runs (or the thread list).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentRuns"
                }
              }
            }
          }
        }
      }
    },
    "/home": {
      "get": {
        "operationId": "getHome",
        "tags": ["Home"],
        "summary": "Landing dashboard for the current user",
        "description": "Aggregates the landing dashboard for the authenticated caller in one read. Authorization: any authenticated organization member — organization administrators see the whole organization; every other caller sees only what lies inside the spaces they hold `space:read` on. Returns `summary` (`pendingApprovals`, `runsInProgress`, `doneToday` counts), `pendingApprovals` (up to 20 approvals the caller owes, newest first, read from `inbox_items` — the same rows and the same `id` as `GET /api/workspace/inbox`), `activity` (the latest 30 activity events, newest first — `type` is an open string), and `recentSpaces` (up to 6 non-archived spaces, most recently updated first). `doneToday` counts completed activity since UTC midnight.",
        "responses": {
          "200": {
            "description": "The caller’s dashboard.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Home"
                }
              }
            }
          }
        }
      }
    },
    "/organization/automations": {
      "get": {
        "operationId": "listAutomations",
        "tags": ["Org Automations"],
        "summary": "List the organization’s automations",
        "description": "Lists every automation with its cadence, next fire time, last run and runtime badge. Trigger secrets are NEVER returned — `trigger.secretPreview` shows the last four characters only. Authorization: any organization member.",
        "responses": {
          "200": {
            "description": "The organization’s automations.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "automations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Automation"
                      }
                    }
                  },
                  "required": ["automations"]
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createAutomation",
        "tags": ["Org Automations"],
        "summary": "Create an automation",
        "deprecated": true,
        "description": "RETIRED — always answers `409 legacy_create_retired`. Create a trigger (`POST /triggers`) instead. Creates an agent task: a stored prompt plus a cadence (`cron` with an IANA timezone, a `once` instant, or `manual` for trigger-only). When it fires it drops a message into a real thread you can join, nudge and correct — not a hidden pipeline. Omit `spaceId` for your own desk; a named space needs `space:contribute` for you AND for the owner the automation runs as. The inbound trigger secret is returned ONCE, here. Authorization: organization admin.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAutomationBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The automation and its one-time trigger secret.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "automation": {
                      "$ref": "#/components/schemas/Automation"
                    },
                    "secret": {
                      "type": "string"
                    }
                  },
                  "required": ["automation", "secret"]
                }
              }
            }
          },
          "400": {
            "description": "`cannot_target_desk` — a desk is never another member’s target."
          },
          "403": {
            "description": "`run_as_forbidden` — the owner cannot contribute to that space."
          },
          "404": {
            "description": "Agents disabled, or the space is not contributable."
          },
          "409": {
            "description": "`legacy_create_retired` — automations have moved to triggers."
          }
        }
      }
    },
    "/organization/automations/{automationId}": {
      "get": {
        "operationId": "getAutomation",
        "tags": ["Org Automations"],
        "summary": "Read one automation",
        "description": "Reads one automation, reconciling its runtime status against the live run first (so an automation parked on an approval reads `needs_input`, and flips to `success` the moment the approval is granted in the thread). Authorization: any organization member.",
        "responses": {
          "200": {
            "description": "The automation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "automation": {
                      "$ref": "#/components/schemas/Automation"
                    }
                  },
                  "required": ["automation"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "automationId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateAutomation",
        "tags": ["Org Automations"],
        "summary": "Update an automation",
        "description": "Patches an automation and recomputes its next fire time — on every write, not only a schedule change, so re-enabling one re-arms it. Pass `threadId: null` to forget the bound thread so the next fire starts a fresh one. Authorization: organization admin (plus `space:contribute` for a new named `spaceId`, for the caller and for the owner).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAutomationBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated automation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "automation": {
                      "$ref": "#/components/schemas/Automation"
                    }
                  },
                  "required": ["automation"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Agents disabled, unknown automation, or space not contributable."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "automationId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteAutomation",
        "tags": ["Org Automations"],
        "summary": "Delete an automation",
        "description": "Deletes the automation and disarms it. Its fire history is left in place (it is the record of work that actually happened). Authorization: organization admin.",
        "responses": {
          "204": {
            "description": "Deleted."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "automationId",
            "required": true
          }
        ]
      }
    },
    "/organization/automations/{automationId}/runs": {
      "get": {
        "operationId": "listAutomationRuns",
        "tags": ["Org Automations"],
        "summary": "List an automation’s fire history",
        "description": "One keyset page of fires, newest first: `started | success | busy | needs_input | blocked | error`, each with the thread it landed in. Unbounded history (no retention cap). Pass the previous page’s `nextCursor` to continue. Authorization: any organization member.",
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "description": "The previous page’s `nextCursor`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Rows per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "automationId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "One page of fires.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "runs": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AutomationRun"
                      }
                    },
                    "nextCursor": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["runs", "nextCursor"]
                }
              }
            }
          }
        }
      }
    },
    "/organization/automations/{automationId}/rotate-secret": {
      "post": {
        "operationId": "rotateAutomationSecret",
        "tags": ["Org Automations"],
        "summary": "Rotate the inbound trigger secret",
        "description": "Mints a new HMAC secret for the automation’s inbound trigger and returns it ONCE. Signatures made with the old secret stop verifying immediately. Authorization: organization admin.",
        "responses": {
          "200": {
            "description": "The new secret, shown once.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "secret": {
                      "type": "string"
                    },
                    "secretPreview": {
                      "type": "string"
                    }
                  },
                  "required": ["secret", "secretPreview"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "automationId",
            "required": true
          }
        ]
      }
    },
    "/organization/automations/{automationId}/run": {
      "post": {
        "operationId": "runAutomationNow",
        "tags": ["Org Automations"],
        "summary": "Run an automation now",
        "description": "Fires the automation immediately, exactly as its schedule would: same thread, same approval gate, same run history row. Entitlement is checked at fire time. A run already live in the thread answers `busy` (no second parallel run); one parked on an approval answers `needs_input`. Authorization: organization admin.",
        "responses": {
          "200": {
            "description": "The fire outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "automationRunId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": ["started", "success", "busy", "needs_input", "blocked", "error"]
                    },
                    "threadId": {
                      "type": "string"
                    },
                    "runId": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": ["automationRunId", "status"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "automationId",
            "required": true
          }
        ]
      }
    },
    "/organization": {
      "get": {
        "operationId": "getOrganization",
        "tags": ["Organization Settings"],
        "summary": "Get the current organization",
        "description": "Returns the caller's organization as `id`, `name`, and `slug`. Authorization: any authenticated organization member. Returns 404 if the organization cannot be resolved.",
        "responses": {
          "200": {
            "description": "The current organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateOrganization",
        "tags": ["Organization Settings"],
        "summary": "Update the current organization",
        "description": "Updates the organization name or assistant default name. Send assistantName:null to clear the default. The slug (tenant key) is immutable. Authorization: organization administrators only. Returns 400 on an invalid body or 404 if the organization cannot be resolved.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "example": "Acme Inc",
                    "type": "string",
                    "minLength": 1
                  },
                  "assistantName": {
                    "nullable": true,
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The renamed organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/users": {
      "get": {
        "operationId": "listUsers",
        "tags": ["Organization Settings"],
        "summary": "List organization users",
        "description": "Lists every member of the caller's organization, plus the invitations nobody has accepted yet, in one list — members first, then pending invitations. Each row carries its role, status (`active` / `inactive` / `invited`) and `directoryManaged`. Authorization: any authenticated member of the tenant. Not paginated — returns the full member set.",
        "responses": {
          "200": {
            "description": "Every member of the organization, and its pending invitations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationUserList"
                }
              }
            }
          }
        }
      }
    },
    "/users/invitations": {
      "post": {
        "operationId": "inviteUser",
        "tags": ["Organization Settings"],
        "summary": "Invite a member",
        "description": "Emails an invitation to join the caller's organization. Body: `{ email: string, roleSlug?: string }` — absent, the organization's default role applies. Authorization: organization administrators only. Returns 400 on a malformed body and 422 when the address cannot be invited — e.g. it is already a member.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                    "example": "person@acme.com"
                  },
                  "roleSlug": {
                    "example": "admin",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": ["email"]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The invitation that was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationResponse"
                }
              }
            }
          }
        }
      }
    },
    "/users/invitations/{invitationId}": {
      "delete": {
        "operationId": "revokeInvitation",
        "tags": ["Organization Settings"],
        "summary": "Revoke an invitation",
        "description": "Revokes a pending invitation by `:invitationId` after confirming it belongs to the caller's organization. Authorization: organization administrators only. Returns 204 on success; 404 if it does not exist or is not in this org.",
        "responses": {
          "204": {
            "description": "Invitation revoked (empty body)."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "invitationId",
            "required": true
          }
        ]
      }
    },
    "/users/memberships/{membershipId}": {
      "delete": {
        "operationId": "removeMember",
        "tags": ["Organization Settings"],
        "summary": "Remove a member",
        "description": "Removes a membership by `:membershipId` after confirming it belongs to the caller's organization. Authorization: organization administrators only. Returns 204 on success; 404 if it does not exist or is not in this org; 409 when refused — removing yourself (`cannot_remove_self`), the last remaining member (`last_member`), a directory-managed membership (`directory_managed`), or the organization's last owner (`last_owner`).",
        "responses": {
          "204": {
            "description": "Member removed (empty body)."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "membershipId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "changeMemberRole",
        "tags": ["Organization Settings"],
        "summary": "Change the role of a member",
        "description": "Sets the product role of a membership in the caller's organization. Body: `{ roleSlug: string }`. An owner keeps `owner` beside the new role; `owner` itself is not a valid value. Authorization: organization administrators only. Returns 204 on success; 400 on a malformed body; 404 if it does not exist or is not in this org; 409 when refused: your own membership (`cannot_change_self`) or a directory-managed membership (`directory_managed`).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "roleSlug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "example": "member"
                  }
                },
                "required": ["roleSlug"]
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Role changed (empty body)."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "membershipId",
            "required": true
          }
        ]
      }
    },
    "/roles": {
      "get": {
        "operationId": "listRoles",
        "tags": ["Organization Settings"],
        "summary": "List organization roles",
        "description": "Lists the product roles for the caller's organization, shaped for a role picker. Authorization: any authenticated member of the tenant. Not paginated.",
        "responses": {
          "200": {
            "description": "The organization’s product roles.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationRoleList"
                }
              }
            }
          }
        }
      }
    },
    "/memberships": {
      "get": {
        "operationId": "listMemberships",
        "tags": ["Organization Settings"],
        "summary": "List my memberships",
        "description": "Lists the CALLER's own active organization memberships (shaped for the sidebar org switcher), not the org's member list. Authorization: any authenticated member of the tenant. Not paginated.",
        "responses": {
          "200": {
            "description": "The caller's active memberships.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MembershipList"
                }
              }
            }
          }
        }
      }
    },
    "/organization/logo": {
      "get": {
        "operationId": "getOrganizationLogo",
        "tags": ["Organization Settings"],
        "summary": "Get organization logo URL",
        "description": "Returns a URL to the organization's logo image, or null when no logo is set. Authorization: any authenticated member of the tenant. This endpoint returns a URL, not the raw image bytes.",
        "responses": {
          "200": {
            "description": "The logo URL, or null when unset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationLogo"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updateOrganizationLogo",
        "tags": ["Organization Settings"],
        "summary": "Upload organization logo",
        "description": "Uploads (and replaces) the organization logo. The request body is the raw image bytes (not JSON or multipart); the `content-type` header must be a supported image type and the size must be within the documented limit. Authorization: organization administrators only. Returns 400 on an invalid image, 413 if too large, or 415 on an unsupported content type.",
        "requestBody": {
          "required": true,
          "description": "Raw image bytes. The `content-type` header must be a supported image type.",
          "content": {
            "image/png": {},
            "image/jpeg": {},
            "image/svg+xml": {},
            "image/webp": {}
          }
        },
        "responses": {
          "200": {
            "description": "The updated logo URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationLogo"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteOrganizationLogo",
        "tags": ["Organization Settings"],
        "summary": "Remove organization logo",
        "description": "Removes the organization logo. Authorization: organization administrators only. Returns 204, also when no logo is set.",
        "responses": {
          "204": {
            "description": "Logo removed (empty body)."
          }
        }
      }
    },
    "/organization/widget-token": {
      "get": {
        "operationId": "getWidgetToken",
        "tags": ["Organization Settings"],
        "summary": "Mint a widget access token",
        "description": "Mints a short-lived access token scoped to the caller's organization and user for the embeddable User Management and API Key widgets, always. The Domain Verification widget scope is included only when the caller's organization has the `domain-verification` rollout flag enabled — an unflagged organization gets a token that cannot drive that widget. Authorization: organization administrators only. Returns 503 when the widget integration is unavailable.",
        "responses": {
          "200": {
            "description": "A short-lived widget access token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WidgetToken"
                }
              }
            }
          }
        }
      }
    },
    "/api-keys": {
      "get": {
        "operationId": "listApiKeys",
        "tags": ["Organization Settings"],
        "summary": "List API keys",
        "description": "Lists every API key issued for the caller's organization (metadata only — plaintext key values are never returned by this list). Each key carries `createdBy` (the member or API key that issued it), which is `null` for keys created before that was recorded. Authorization: organization administrators only. Not paginated.",
        "responses": {
          "200": {
            "description": "API key metadata (never the plaintext values).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyList"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createApiKey",
        "tags": ["Organization Settings"],
        "summary": "Create API key",
        "description": "Issues a new API key for the organization. Body: `{ name: string (1-255 chars, required), v1Only?: boolean (default false) }`. The plaintext key value is returned ONCE in this 201 response and is never retrievable again. Authorization: organization administrators only. Returns 400 on an invalid body.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "example": "CI pipeline"
                  },
                  "v1Only": {
                    "default": false,
                    "description": "When true, the key may only call the public /v1 API; every other route answers 403 `api_key_v1_only`.",
                    "type": "boolean"
                  }
                },
                "required": ["name"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created API key, including its one-time plaintext value.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedApiKey"
                }
              }
            }
          }
        }
      }
    },
    "/api-keys/{id}": {
      "delete": {
        "operationId": "deleteApiKey",
        "tags": ["Organization Settings"],
        "summary": "Revoke API key",
        "description": "Revokes an API key by `:id` path parameter after confirming it belongs to the caller's organization. Authorization: organization administrators only. Returns 204 on success; 404 if the key does not exist or is not in this org.",
        "responses": {
          "204": {
            "description": "API key revoked (empty body)."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/organization/assistant-policy/tree": {
      "get": {
        "operationId": "listOrganizationAssistantPolicyTree",
        "summary": "List memory files",
        "description": "Lists every file of the saved memory with its size, blob and front-matter summary.",
        "tags": ["Organization Settings"],
        "parameters": [
          {
            "in": "query",
            "name": "prefix",
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List memory files",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "path": {
                                "type": "string"
                              },
                              "size": {
                                "type": "number"
                              },
                              "blob": {
                                "type": "string"
                              },
                              "summary": {
                                "type": "string"
                              }
                            },
                            "required": ["path", "size", "blob"]
                          }
                        }
                      },
                      "required": ["sha", "entries"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/organization/assistant-policy/files": {
      "get": {
        "operationId": "getOrganizationAssistantPolicyFiles",
        "summary": "Read memory files",
        "description": "Reads up to 20 files at once. Repeat `path` for each file. A missing file answers `missing: true`.",
        "tags": ["Organization Settings"],
        "parameters": [
          {
            "in": "query",
            "name": "path",
            "description": "A relative file path. Repeat up to 20 times.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read memory files",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "files": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "path": {
                                "type": "string"
                              },
                              "content": {
                                "type": "string"
                              },
                              "blob": {
                                "type": "string"
                              },
                              "missing": {
                                "type": "boolean",
                                "const": true
                              }
                            },
                            "required": ["path"]
                          }
                        }
                      },
                      "required": ["sha", "files"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putOrganizationAssistantPolicyFile",
        "summary": "Save a memory file",
        "description": "Creates or replaces one file. `expectBlob` is the blob you read (null for a new file), so a concurrent edit answers 409 instead of being overwritten.",
        "tags": ["Organization Settings"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  },
                  "content": {
                    "type": "string",
                    "maxLength": 262144
                  },
                  "expectBlob": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9a-f]{40}$"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The blob you read, or null to create a new file. Stale values answer 409."
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": ["path", "content", "expectBlob"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Nothing changed; the unchanged head",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "201": {
            "description": "The new version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`expect_failed` (`paths`) — the file changed since you read it; `stale_parent` or `conflict` — the history moved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`lint_failed` — `violations` lists each file rule the change broke.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteOrganizationAssistantPolicyFile",
        "summary": "Delete a memory file",
        "description": "Deletes one file. `expectBlob` is the blob you read; a changed file answers 409.",
        "tags": ["Organization Settings"],
        "parameters": [
          {
            "in": "query",
            "name": "path",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            },
            "required": true
          },
          {
            "in": "query",
            "name": "expectBlob",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Nothing changed; the unchanged head",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "201": {
            "description": "The new version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`expect_failed` (`paths`) — the file changed since you read it; `stale_parent` or `conflict` — the history moved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`lint_failed` — `violations` lists each file rule the change broke.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/organization/assistant-policy/history": {
      "get": {
        "operationId": "listOrganizationAssistantPolicyHistory",
        "summary": "List memory history",
        "description": "Lists saved versions, newest first, optionally for one file. Pass `nextCursor` back as `cursor` for the next page.",
        "tags": ["Organization Settings"],
        "parameters": [
          {
            "in": "query",
            "name": "path",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List memory history",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "sha": {
                            "type": "string"
                          },
                          "parents": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "author": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "time": {
                            "type": "number"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": ["sha", "parents", "author", "email", "time", "message"]
                      }
                    },
                    "nextCursor": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["data", "nextCursor"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/organization/assistant-policy/history/{sha}": {
      "get": {
        "operationId": "getOrganizationAssistantPolicyCommit",
        "summary": "Get one memory version",
        "description": "Returns one saved version with the per-file changes it made.",
        "tags": ["Organization Settings"],
        "responses": {
          "200": {
            "description": "Get one memory version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sha",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            },
            "required": true
          }
        ]
      }
    },
    "/organization/assistant-policy/history/{sha}/revert": {
      "post": {
        "operationId": "revertOrganizationAssistantPolicyCommit",
        "summary": "Revert a memory version",
        "description": "Saves a new version that undoes the given one. A later edit to the same files answers 409 `conflict`.",
        "tags": ["Organization Settings"],
        "responses": {
          "200": {
            "description": "Nothing changed; the unchanged head",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "201": {
            "description": "The new version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`expect_failed` (`paths`) — the file changed since you read it; `stale_parent` or `conflict` — the history moved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`lint_failed` — `violations` lists each file rule the change broke.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sha",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            },
            "required": true
          }
        ]
      }
    },
    "/organization/assistant-policy/proposals": {
      "get": {
        "operationId": "listOrganizationAssistantPolicyProposals",
        "summary": "List memory proposals",
        "description": "Lists proposed memory changes that wait for your review, newest first.",
        "tags": ["Organization Settings"],
        "parameters": [
          {
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string",
              "enum": ["open", "merged", "closed", "all"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List memory proposals",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "number": {
                            "type": "number"
                          },
                          "from": {
                            "type": "string"
                          },
                          "into": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string",
                            "enum": ["open", "merged", "closed"]
                          },
                          "title": {
                            "type": "string"
                          },
                          "author": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              }
                            },
                            "required": ["name", "email"]
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "mergedSha": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "number",
                          "from",
                          "into",
                          "state",
                          "title",
                          "author",
                          "createdAt"
                        ]
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/organization/assistant-policy/proposals/{n}": {
      "get": {
        "operationId": "getOrganizationAssistantPolicyProposal",
        "summary": "Get a memory proposal",
        "description": "Returns one proposal with its file changes.",
        "tags": ["Organization Settings"],
        "responses": {
          "200": {
            "description": "Get a memory proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "number"
                        },
                        "from": {
                          "type": "string"
                        },
                        "into": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "enum": ["open", "merged", "closed"]
                        },
                        "title": {
                          "type": "string"
                        },
                        "author": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            }
                          },
                          "required": ["name", "email"]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "mergedSha": {
                          "type": "string"
                        },
                        "compare": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The proposed file changes; null when the proposed branch is gone."
                        }
                      },
                      "required": [
                        "number",
                        "from",
                        "into",
                        "state",
                        "title",
                        "author",
                        "createdAt",
                        "compare"
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "n",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "required": true
          }
        ]
      }
    },
    "/organization/assistant-policy/proposals/{n}/approve": {
      "post": {
        "operationId": "approveOrganizationAssistantPolicyProposal",
        "summary": "Approve a memory proposal",
        "description": "Applies the proposed changes to the saved memory as you. A file changed on both sides answers 409 `conflict` and leaves the proposal open.",
        "tags": ["Organization Settings"],
        "responses": {
          "200": {
            "description": "Approve a memory proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "number"
                        },
                        "from": {
                          "type": "string"
                        },
                        "into": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "const": "merged"
                        },
                        "title": {
                          "type": "string"
                        },
                        "author": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            }
                          },
                          "required": ["name", "email"]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "mergedSha": {
                          "type": "string"
                        },
                        "sha": {
                          "type": ["string", "null"]
                        }
                      },
                      "required": [
                        "number",
                        "from",
                        "into",
                        "state",
                        "title",
                        "author",
                        "createdAt",
                        "sha"
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`conflict` or `not_open` — the proposal stays as it was.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "n",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "required": true
          }
        ]
      }
    },
    "/organization/assistant-policy/proposals/{n}/reject": {
      "post": {
        "operationId": "rejectOrganizationAssistantPolicyProposal",
        "summary": "Reject a memory proposal",
        "description": "Closes the proposal without applying it.",
        "tags": ["Organization Settings"],
        "responses": {
          "200": {
            "description": "Reject a memory proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "number"
                        },
                        "from": {
                          "type": "string"
                        },
                        "into": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "enum": ["open", "merged", "closed"]
                        },
                        "title": {
                          "type": "string"
                        },
                        "author": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            }
                          },
                          "required": ["name", "email"]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "mergedSha": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "number",
                        "from",
                        "into",
                        "state",
                        "title",
                        "author",
                        "createdAt"
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`not_open` — the proposal was already applied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "n",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "required": true
          }
        ]
      }
    },
    "/organization/assistant-policy/forget": {
      "post": {
        "operationId": "forgetOrganizationAssistantPolicy",
        "summary": "Forget memory content",
        "description": "Removes the matching files, or every file version that contains `text`, from all saved history. This cannot be undone.",
        "tags": ["Organization Settings"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paths": {
                    "description": "Exact paths or globs (`**` spans folders) to drop from every version.",
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    }
                  },
                  "text": {
                    "description": "Drop every file version whose content contains this text.",
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 1000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Forget memory content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "rewritten": {
                          "type": "number"
                        },
                        "refs": {
                          "type": "number"
                        }
                      },
                      "required": ["rewritten", "refs"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden`: only an organization administrator may edit the assistant policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/organization/default-space": {
      "get": {
        "operationId": "getOrganizationDefaultSpace",
        "tags": ["Workspace Spaces"],
        "summary": "Resolve the organization's default space",
        "description": "Returns the organization's default-space id from the persisted per-org pointer, adopting the legacy literal-id space into the pointer on first read if needed. Read-only: it never creates a space and never designates an existing one. Returns 404 when the organization has no default space yet — even if it has other spaces — matching the \"not ready\" state `POST /onboarding/default-space` repairs. Authorization: any authenticated organization member.",
        "responses": {
          "200": {
            "description": "The organization's default space id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationDefaultSpace"
                }
              }
            }
          },
          "404": {
            "description": "`no_default_space` — the organization has no default space yet."
          }
        }
      }
    },
    "/billing/plan-view": {
      "get": {
        "operationId": "getBillingPlanView",
        "summary": "Plan, credit balance, grants and recent usage",
        "tags": ["Billing"],
        "description": "The plan and usage summary the Settings → Billing screen renders. Its `rates` come from the advertised catalog and carry a price for every row — for the plan’s own credit price list, including the meters it does not price, read `GET /api/billing/rates`. Authorization: any member of the organization.",
        "responses": {
          "200": {
            "description": "The organization’s plan view.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingPlanViewResponse"
                }
              }
            }
          },
          "503": {
            "description": "`not_configured` — billing is not wired in this environment; `metering_unavailable` — the billing service did not answer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingUnavailableResponse"
                }
              }
            }
          }
        }
      }
    },
    "/billing/rates": {
      "get": {
        "operationId": "getBillingRates",
        "summary": "Credit rate card for the organization",
        "tags": ["Billing"],
        "description": "One entry per meter in the organization’s resolved plan, plus every sandbox meter the plan does not price with `creditsPerUnit: null`. Derived from the plan, never from the advertised catalog: an unpriced meter has no price, so a caller reserves nothing rather than invent one. Authorization: any member of the organization.",
        "responses": {
          "200": {
            "description": "The organization’s credit rate card.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingRatesResponse"
                }
              }
            }
          },
          "503": {
            "description": "`not_configured` — billing is not wired in this environment; `metering_unavailable` — the billing service did not answer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingUnavailableResponse"
                }
              }
            }
          }
        }
      }
    },
    "/billing/portal-token": {
      "post": {
        "operationId": "createBillingPortalToken",
        "summary": "Mint a billing-portal token",
        "tags": ["Billing"],
        "description": "Mints the 15-minute company-scoped token the embedded billing portal renders with. Authorization: a human org admin — an org API key carries `role: admin` but must not be able to change the plan or the card.",
        "responses": {
          "200": {
            "description": "A billing-portal token and its component id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingPortalTokenResponse"
                }
              }
            }
          },
          "503": {
            "description": "`not_configured` — billing is not wired in this environment; `metering_unavailable` — the billing service did not answer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingUnavailableResponse"
                }
              }
            }
          }
        }
      }
    },
    "/organization/templates": {
      "post": {
        "operationId": "createOrgTemplate",
        "tags": ["Organization Templates"],
        "summary": "Register an org-level template file and get a presigned upload URL",
        "description": "Reserves a template file metadata record parented to the caller’s organization (not any space) and returns { id, uploadUrl, uploadExpiresAt, file }. `uploadUrl` is a secure PUT URL valid for 15 minutes (see `uploadExpiresAt`, ISO 8601). Two-step upload: PUT the raw bytes to `uploadUrl` with a `Content-Type` request header EXACTLY equal to the `mimeType` you sent, then poll `getOrgTemplate` until `status` reaches `stored`. Request body: `fileName` (required), `mimeType` (required), `size` (bytes, optional). `parentType`/`parentId` in the body are ignored: the API forces the parent to this organization. No processing is requested (templates are filled, not parsed). Authorization: org admin (denied → 403).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileName": {
                    "type": "string",
                    "minLength": 1,
                    "example": "w9.pdf"
                  },
                  "mimeType": {
                    "type": "string",
                    "minLength": 1,
                    "example": "application/pdf"
                  },
                  "size": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["fileName", "mimeType"],
                "description": "Templates are filled, not parsed: no `processingKind` is sent, so the file settles at `stored` and is never indexed. `parentType` / `parentId` are ignored."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Template record created, with its presigned upload URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedFile"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listOrgTemplates",
        "tags": ["Organization Templates"],
        "summary": "List the organization's template files",
        "description": "Returns { files: FileDoc[] } for the organization, newest first. Each entry carries enough for a picker row (id, fileName, size, status, mimeType) but NO download URLs — fetch a single template via `getOrgTemplate` for its minted `urls.file`. Optional `?limit` caps the page (default 50, max 200). Authorization: org admin (denied → 403).",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "description": "Page size, 1–200. There is no cursor: this is one most-recent page.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Template files for the organization, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileList"
                }
              }
            }
          }
        }
      }
    },
    "/organization/templates/{fileId}": {
      "get": {
        "operationId": "getOrgTemplate",
        "tags": ["Organization Templates"],
        "summary": "Get an org template file with download URLs",
        "description": "Returns the template file record plus a `urls` object of minted download links (each ~1h), notably `urls.file` (the stored PDF bytes) for the curation canvas. Returns 404 if the file is not parented to the caller’s organization (a space file, or another tenant’s, is hidden). Authorization: org admin (denied → 403).",
        "responses": {
          "200": {
            "description": "The template record, with minted ~1h download URLs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDoc"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "fileId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteOrgTemplate",
        "tags": ["Organization Templates"],
        "summary": "Delete an org template file",
        "description": "Deletes the template file; responds 204 with no body. Returns 404 if the file is not parented to the caller’s organization (cross-parent deletes are hidden). Authorization: org admin (denied → 403).",
        "responses": {
          "204": {
            "description": "Template file deleted (no body)"
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "fileId",
            "required": true
          }
        ]
      }
    },
    "/playbooks": {
      "get": {
        "operationId": "listPlaybooks",
        "summary": "List playbook definitions",
        "description": "Lists the org-level playbook definitions for the caller tenant. Authorization: any authenticated org member (session + tenant context only, no admin required). Optional query `status` filters by lifecycle state and MUST be one of `draft` | `active` | `archived` — any other value returns 400 `invalid_status`. Optional query `spaceType` filters to playbooks whose `spaceTypes` includes that space-type slug (playbooks with an empty `spaceTypes` apply to all space types). Response is `{ data: Playbook[] }` — a single unpaginated array; each Playbook carries id, name, description, status, spaceTypes, tasks, actions, version, createdAt/updatedAt, createdBy.",
        "tags": ["Playbooks"],
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "description": "Lifecycle filter: `draft`, `active` or `archived`. Any other value returns 400 `invalid_status`.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["draft", "active", "archived"]
            }
          },
          {
            "in": "query",
            "name": "spaceType",
            "description": "Only playbooks whose `spaceTypes` includes this identifier. Playbooks with an empty `spaceTypes` apply everywhere.",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The playbook definitions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookList"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createPlaybook",
        "summary": "Create a playbook definition",
        "description": "Creates a new organization-level playbook definition; it starts in `draft` status. Authorization: organization administrators only — other callers are rejected with 403. Body: `name` (required, 1-200 chars); optional `description` (<=5000 chars); optional `spaceTypes` (array of space-type slugs the playbook applies to — omit/empty means all space types); optional `tasks` (<=30 items, each `{ id (1-64), title (1-200), instructions?, dependsOn? (ids of tasks that must complete first) }`); optional `actions` (<=20 items, each `{ installedActionId, preApproval?, postApproval?, dependsOn? (task ids only — an action may not depend on another action) }` referencing installed actions, with per-action human-approval gates). Response 201: `{ data: Playbook }`.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "spaceTypes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tasks": {
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "instructions": {
                          "nullable": true,
                          "type": "string",
                          "maxLength": 4000
                        },
                        "dependsOn": {
                          "maxItems": 30,
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Task ids that must complete first."
                        },
                        "executor": {
                          "type": "string",
                          "enum": ["agent", "human"],
                          "description": "`human` tasks are completed by a person out-of-band; the agent never does them."
                        },
                        "assignee": {
                          "nullable": true,
                          "description": "User id. Human tasks only; null = anyone in the space.",
                          "type": "string"
                        }
                      },
                      "required": ["id", "title"]
                    }
                  },
                  "model": {
                    "nullable": true,
                    "type": "string",
                    "maxLength": 200
                  },
                  "actions": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "installedActionId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "preApproval": {
                          "type": "boolean",
                          "description": "Gate the action behind a human approval."
                        },
                        "postApproval": {
                          "type": "boolean",
                          "description": "Review the action output before continuing."
                        },
                        "dependsOn": {
                          "maxItems": 30,
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Task ids only — an action may never depend on another action."
                        },
                        "trigger": {
                          "type": "string",
                          "enum": ["agent", "user"],
                          "description": "`user` actions are started from the run view; the agent never proposes them."
                        }
                      },
                      "required": ["installedActionId"]
                    }
                  }
                },
                "required": ["name"],
                "description": "The playbook starts in `draft`."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created playbook definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/playbooks/{playbookId}": {
      "get": {
        "operationId": "getPlaybook",
        "summary": "Get a playbook definition",
        "description": "Fetches a single playbook definition by `playbookId`, scoped to the caller tenant. Authorization: any authenticated org member (session + tenant context only, no admin required). Returns 404 if the playbook does not exist in this org. Response: `{ data: Playbook }`.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The playbook definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "playbookId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updatePlaybook",
        "summary": "Update a playbook definition",
        "description": "Partially updates the playbook definition identified by `playbookId` and bumps its `version`. Authorization: organization administrators only — other callers are rejected with 403. All body fields are optional: `name` (1-200), `description` (<=5000), `spaceTypes` (replaces the list), `tasks` (<=30, replaces the whole list; each `{ id, title, instructions?, dependsOn? (ids of tasks that must complete first) }`), `actions` (<=20, replaces the whole list; each `{ installedActionId, preApproval?, postApproval?, dependsOn? (task ids only) }`). Response: `{ data: Playbook }`.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "spaceTypes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tasks": {
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "instructions": {
                          "nullable": true,
                          "type": "string",
                          "maxLength": 4000
                        },
                        "dependsOn": {
                          "maxItems": 30,
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Task ids that must complete first."
                        },
                        "executor": {
                          "type": "string",
                          "enum": ["agent", "human"],
                          "description": "`human` tasks are completed by a person out-of-band; the agent never does them."
                        },
                        "assignee": {
                          "nullable": true,
                          "description": "User id. Human tasks only; null = anyone in the space.",
                          "type": "string"
                        }
                      },
                      "required": ["id", "title"]
                    }
                  },
                  "model": {
                    "nullable": true,
                    "type": "string",
                    "maxLength": 200
                  },
                  "actions": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "installedActionId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "preApproval": {
                          "type": "boolean",
                          "description": "Gate the action behind a human approval."
                        },
                        "postApproval": {
                          "type": "boolean",
                          "description": "Review the action output before continuing."
                        },
                        "dependsOn": {
                          "maxItems": 30,
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Task ids only — an action may never depend on another action."
                        },
                        "trigger": {
                          "type": "string",
                          "enum": ["agent", "user"],
                          "description": "`user` actions are started from the run view; the agent never proposes them."
                        }
                      },
                      "required": ["installedActionId"]
                    }
                  }
                },
                "additionalProperties": false,
                "description": "`tasks` and `actions` replace the whole list. Every update bumps `version`."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated playbook definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "playbookId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deletePlaybook",
        "summary": "Delete a playbook definition",
        "description": "Permanently deletes the playbook definition identified by `playbookId`. Authorization: organization administrators only — other callers are rejected with 403. Response: `{ data: { id } }` echoing the deleted playbook id.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The deleted playbook id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedPlaybook"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "playbookId",
            "required": true
          }
        ]
      }
    },
    "/playbooks/{playbookId}/validate": {
      "post": {
        "operationId": "validatePlaybook",
        "summary": "Validate a playbook definition",
        "description": "Lints the playbook, optionally with a draft overlay merged over the stored document (same fields as update). Always 200 with `{ data: { issues } }` — each issue carries `severity: error | warning`; warnings never block activation. Authorization: organization administrators only.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "spaceTypes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "tasks": {
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "instructions": {
                          "nullable": true,
                          "type": "string",
                          "maxLength": 4000
                        },
                        "dependsOn": {
                          "maxItems": 30,
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Task ids that must complete first."
                        },
                        "executor": {
                          "type": "string",
                          "enum": ["agent", "human"],
                          "description": "`human` tasks are completed by a person out-of-band; the agent never does them."
                        },
                        "assignee": {
                          "nullable": true,
                          "description": "User id. Human tasks only; null = anyone in the space.",
                          "type": "string"
                        }
                      },
                      "required": ["id", "title"]
                    }
                  },
                  "model": {
                    "nullable": true,
                    "type": "string",
                    "maxLength": 200
                  },
                  "actions": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "installedActionId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "preApproval": {
                          "type": "boolean",
                          "description": "Gate the action behind a human approval."
                        },
                        "postApproval": {
                          "type": "boolean",
                          "description": "Review the action output before continuing."
                        },
                        "dependsOn": {
                          "maxItems": 30,
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Task ids only — an action may never depend on another action."
                        },
                        "trigger": {
                          "type": "string",
                          "enum": ["agent", "user"],
                          "description": "`user` actions are started from the run view; the agent never proposes them."
                        }
                      },
                      "required": ["installedActionId"]
                    }
                  }
                },
                "description": "A draft overlay merged over the stored playbook before linting."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validation issues (possibly empty).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookValidation"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "playbookId",
            "required": true
          }
        ]
      }
    },
    "/playbooks/{playbookId}/activate": {
      "post": {
        "operationId": "activatePlaybook",
        "summary": "Activate a playbook definition",
        "description": "Transitions the playbook identified by `playbookId` to `active` status so it can be run. Authorization: organization administrators only — other callers are rejected with 403. No request body. Response: `{ data: Playbook }` with the updated status.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The activated playbook definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "playbookId",
            "required": true
          }
        ]
      }
    },
    "/playbooks/{playbookId}/archive": {
      "post": {
        "operationId": "archivePlaybook",
        "summary": "Archive a playbook definition",
        "description": "Transitions the playbook identified by `playbookId` to `archived` status, retiring it from active use. Authorization: organization administrators only — other callers are rejected with 403. No request body. Response: `{ data: Playbook }` with the updated status.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The archived playbook definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "playbookId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbooks": {
      "get": {
        "operationId": "listSpacePlaybooks",
        "summary": "List active playbooks available in a space",
        "description": "Lists the ACTIVE playbook definitions launchable in this space, i.e. whose spaceTypes include the space's spaceType (resolved server-side from the space record — the caller never passes it). These are the playbooks a user can start as a run here. Authorization: requires `space:read` on the space (org admins bypass); callers without it get 404 (existence is hidden). 404 is also returned when the space does not exist. Returns `{ data: Playbook[] }` with no pagination; each Playbook carries its id, name, description, tasks and configured actions.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "Active playbooks launchable in this space.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookList"
                }
              }
            }
          },
          "404": {
            "description": "Space not found, or caller lacks space:read"
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs": {
      "post": {
        "operationId": "createPlaybookRun",
        "summary": "Start a playbook run in a space",
        "description": "Starts a new durable agentic run of a playbook in this space. Authorization: requires `space:contribute` on the space (org admins bypass); missing permission → 403. Body: `playbookId` (required — the playbook to run) and `fileScope`, which is either `{ mode: \"space\" }` (the agent may see all files in the space) or `{ mode: \"picked\", fileIds: [...] }` (1–200 explicit file ids). Optional `prompt` (1–4000 chars) is the request that founds the run: it is frozen into the run’s immutable snapshot and stays part of the agent’s standing instructions for every turn — use `steer` to say anything after launch. `spaceType` is resolved from the space record server-side and is NOT accepted from the caller. Returns 404 when the space does not exist. On success returns 201 `{ data: PlaybookRun }` — the created run with its immutable snapshot of the playbook captured at launch time.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "playbookId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "fileScope": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "mode": {
                            "type": "string",
                            "enum": ["space"]
                          }
                        },
                        "required": ["mode"]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "mode": {
                            "type": "string",
                            "enum": ["picked"]
                          },
                          "fileIds": {
                            "minItems": 1,
                            "maxItems": 200,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          }
                        },
                        "required": ["mode", "fileIds"]
                      }
                    ]
                  },
                  "prompt": {
                    "description": "The request that founds the run, frozen into its immutable snapshot and kept in the agent’s standing instructions. Use steer for anything after launch.",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  }
                },
                "required": ["playbookId", "fileScope"],
                "description": "The space type is resolved from the space record and is not accepted here."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created playbook run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Space not found"
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      },
      "get": {
        "operationId": "listPlaybookRuns",
        "summary": "List playbook runs in a space",
        "description": "Lists playbook runs in this space, newest first. Authorization: `space:read` (org admins bypass); missing → 404. Query params: `playbookId` (filter to one playbook), `status` (one of running, waiting_approval, waiting_action, waiting_user, paused, completed, failed, cancelled — an unrecognized value returns 400 `invalid_status`), `limit` (1–100), and `starting_after` (opaque cursor = the id of the last run from the previous page). Returns `{ data: PlaybookRun[], has_more }`; when `has_more` is true, page again using the last run id as `starting_after`.",
        "tags": ["Playbooks"],
        "parameters": [
          {
            "in": "query",
            "name": "playbookId",
            "description": "Only runs of this playbook.",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "status",
            "description": "Run-status filter. An unrecognized value returns 400 `invalid_status`.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "running",
                "waiting_approval",
                "waiting_action",
                "waiting_user",
                "paused",
                "completed",
                "failed",
                "cancelled"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Page size, 1–100.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "in": "query",
            "name": "starting_after",
            "description": "Cursor: the id of the last run on the previous page.",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "One page of playbook runs, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunList"
                }
              }
            }
          },
          "400": {
            "description": "Unrecognized status filter (invalid_status)"
          }
        }
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}": {
      "get": {
        "operationId": "getPlaybookRun",
        "summary": "Get one playbook run",
        "description": "Fetches one playbook run with full detail: current status, task progress, any pending approval, current activity, result/error, and the immutable snapshot of the playbook (tasks + actions + fileScope) captured at launch. Authorization: `space:read` (org admins bypass); missing → 404; 404 also when the run does not exist in this space. Returns `{ data: PlaybookRunDetail }`.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The playbook run, with its launch snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Run not found, or caller lacks space:read"
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/timeline": {
      "get": {
        "operationId": "getPlaybookRunTimeline",
        "summary": "Get a playbook run timeline",
        "description": "Returns the run's append-only event timeline in chronological order — event types include run_started, step, task_completed, action_proposed, approval_requested, approval_decided, action_dispatched, action_awaiting_input, action_completed, action_failed, action_skipped, output_review_requested, output_edited, steer, pause, resume, stop_requested, run_completed, run_failed, run_cancelled. Authorization: `space:read` (org admins bypass); missing → 404. Query: `after` (cursor = last event id already seen, for polling forward) and `limit` (1–200). Returns `{ data: TimelineItem[], has_more }`. Capability redaction: callers WITHOUT `space:contribute` receive event payloads sanitized (artifact URLs / storage keys stripped), so read-only viewers never get signed file links.",
        "tags": ["Playbooks"],
        "parameters": [
          {
            "in": "query",
            "name": "after",
            "description": "Cursor: the id of the last event already seen.",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Page size, 1–200.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "One page of timeline events, oldest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunTimeline"
                }
              }
            }
          }
        }
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/approvals": {
      "get": {
        "operationId": "listPlaybookRunApprovals",
        "summary": "List approvals for a playbook run",
        "description": "Lists the run's action approval requests — both pre-action gates (approve before an action runs) and post-action gates (review the action output) — each with its status (pending, approved, rejected, void), the proposed action (slug, installedActionId, name), rationale, params, input files, output and artifacts, plus decision metadata (decidedBy, decidedAt, note, edited params/files/output). Authorization: `space:read` (org admins bypass); missing → 404. Returns `{ data: Approval[] }` with no pagination. Capability redaction: callers without `space:contribute` get artifact URLs / storage keys stripped from the payload.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The run’s approval requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookApprovalList"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/approvals/{approvalId}": {
      "post": {
        "operationId": "decidePlaybookRunApproval",
        "summary": "Decide a playbook run approval",
        "description": "Approves or rejects a pending approval on the run — either a pre-action gate (allow the action to run) or a post-action output review. Authorization: `space:contribute` (org admins bypass); missing → 403. Body: `decision` (\"approve\" | \"reject\", required); optional `note` (≤4000 chars); and, when approving, you may edit before proceeding — `editedParams` (override the action params), `editedFileIds` (1–200, override the input files), `editedOutput` (override the reviewed output). The request body is capped at 1 MiB → 413 `payload_too_large` if exceeded. Returns 200 `{ data: Approval }` with the updated approval.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": ["approve", "reject"]
                  },
                  "note": {
                    "description": "Required when rejecting.",
                    "type": "string",
                    "maxLength": 4000
                  },
                  "editedParams": {
                    "description": "Override the action parameters.",
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "editedFileIds": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "editedOutput": {
                    "description": "Override the reviewed output."
                  }
                },
                "required": ["decision"],
                "description": "The whole body is capped at 1 MiB (413 `payload_too_large` beyond it)."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated approval.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookApprovalEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeded 1 MiB (payload_too_large)"
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "approvalId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/approvals:decide-batch": {
      "post": {
        "operationId": "decidePlaybookRunApprovalsBatch",
        "summary": "Decide a batch of playbook run approvals",
        "description": "Applies up to 20 approval decisions in order. Each decision is validated independently (same fields as the single-decision endpoint, plus `approvalId`) and failures are reported per item without rolling back the others; the agent loop is resumed once at the end. Authorization: `space:contribute` (org admins bypass); missing → 403. The body is capped at 1 MiB → 413 `payload_too_large`. Returns 200 `{ data: Outcome[] }` in request order.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "decisions": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "decision": {
                          "type": "string",
                          "enum": ["approve", "reject"]
                        },
                        "note": {
                          "description": "Required when rejecting.",
                          "type": "string",
                          "maxLength": 4000
                        },
                        "editedParams": {
                          "description": "Override the action parameters.",
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "editedFileIds": {
                          "minItems": 1,
                          "maxItems": 200,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "editedOutput": {
                          "description": "Override the reviewed output."
                        },
                        "approvalId": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": ["decision", "approvalId"]
                    }
                  }
                },
                "required": ["decisions"],
                "description": "Up to 20 decisions, applied in order; each item is validated independently and failures are reported per item without rolling back the others. Capped at 1 MiB."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-decision outcomes, in request order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookApprovalBatchOutcomeList"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeded 1 MiB (payload_too_large)"
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/tasks/{taskId}/claim": {
      "post": {
        "operationId": "claimPlaybookRunTask",
        "summary": "Claim a human task",
        "description": "Marks a `ready` human task `in_progress` with the caller as claimant. Claiming is optional — anyone in the space may complete an unassigned task without claiming it. Authorization: `space:contribute` (org admins bypass); missing → 403. Errors: 409 `task_claimed` (someone else holds it), 409 `task_resolved` (already completed/skipped), 409 `run_not_running`, 422 `not_human_task`, 404 unknown task.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The updated task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunTaskEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "taskId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/tasks/{taskId}/complete": {
      "post": {
        "operationId": "completePlaybookRunTask",
        "summary": "Complete a human task",
        "description": "Completes a human task out-of-band, with an optional note and file references that flow into the agent’s context for the tasks that follow. Anyone in the space may complete an unassigned task; claiming first is optional. A second completion is a no-op. Authorization: `space:contribute` (org admins bypass). Errors: 409 `task_blocked` (gates not cleared), 409 `run_not_running`, 422 `not_human_task`, 404.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "fileIds": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The completed task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunTaskEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "taskId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/tasks/{taskId}/skip": {
      "post": {
        "operationId": "skipPlaybookRunTask",
        "summary": "Skip a human task",
        "description": "Flags a human task as skipped (note required) and unblocks the work behind it exactly like a completion. Authorization: `space:contribute` (org admins bypass). Errors: 409 `task_blocked`, 409 `run_not_running`, 422 `not_human_task`, 404.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                },
                "required": ["note"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The skipped task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunTaskEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "taskId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/steer": {
      "post": {
        "operationId": "steerPlaybookRun",
        "summary": "Steer a running playbook",
        "description": "Injects a free-text steering message into a running playbook to nudge the agent mid-run. Authorization: `space:contribute` (org admins bypass); missing → 403. Body: `message` (required, 1–4000 chars). Returns 200 `{ data }` with the run's updated status.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  }
                },
                "required": ["message"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The run state after steering.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunState"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/pause": {
      "post": {
        "operationId": "pausePlaybookRun",
        "summary": "Pause a playbook run",
        "description": "Requests the run to pause at the next safe point. Authorization: `space:contribute` (org admins bypass); missing → 403. No request body. Returns 200 `{ data }` with the updated run status.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The run state after the pause request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunState"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/resume": {
      "post": {
        "operationId": "resumePlaybookRun",
        "summary": "Resume a paused playbook run",
        "description": "Resumes a paused run. Authorization: `space:contribute` (org admins bypass); missing → 403. No request body. Returns 200 `{ data }` with the updated run status.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The run state after resuming.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunState"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/skip-action": {
      "post": {
        "operationId": "skipPlaybookRunAction",
        "summary": "Skip the action a run is waiting on",
        "description": "Skips the action the run is currently waiting on (e.g. one blocked on external input) and lets the run proceed. Authorization: `space:contribute` (org admins bypass); missing → 403. No request body. Returns 200 `{ data }` with the updated run state.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The run state after skipping the action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunState"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/actions/{installedActionId}/start-browser": {
      "post": {
        "operationId": "startPlaybookRunBrowserAction",
        "summary": "Start (or fetch) the browser session of a user-triggered playbook action",
        "description": "Starts the browser session for a user-triggered form-filling playbook action and returns `{ data: { sessionId, pairUrl, controlUrl, status, ... } }`. The caller opens the pairUrl in a compatible browser with the CloudRaker extension installed; once paired, the playbook agent drives that tab to fill the form. Idempotent: while a session is open the same session (and pairUrl) is returned. Authorization: `space:contribute` (org admins bypass); missing → 403. Returns 409 when dependencies are unmet or another session open, 422 not a user-triggered action, 502 browser session unavailable.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The browser session, including its pairing URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunBrowserSession"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "installedActionId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/actions/{installedActionId}/skip-browser": {
      "post": {
        "operationId": "skipPlaybookRunBrowserAction",
        "summary": "Skip a user-triggered browser action",
        "description": "Marks a user-triggered browser action as skipped (closing any open session) so the run can finish without it. Authorization: `space:contribute` (org admins bypass); missing → 403. Returns 200 `{ data }` with the run state.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The run state after skipping the browser step.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunState"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "installedActionId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/cancel": {
      "post": {
        "operationId": "cancelPlaybookRun",
        "summary": "Cancel a playbook run",
        "description": "Cancels the run (terminal). Authorization: `space:contribute` (org admins bypass); missing → 403. Body: optional `reason` (1–4000 chars) recorded on the run. Returns 200 `{ data }` with the run's final status, task progress, result and error.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The final run state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunState"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/playbook-runs/{runId}/ws-ticket": {
      "post": {
        "operationId": "mintPlaybookRunWsTicket",
        "summary": "Mint a live WebSocket ticket for a run",
        "description": "Mints a short-lived ticket for opening the run's live WebSocket, used to stream timeline events in real time (the WS upgrade itself is not exposed over this API / MCP surface). Authorization: `space:read` (org admins bypass); missing → 404. No request body. The ticket carries a capability view — \"full\" when the caller has `space:contribute`, otherwise \"sanitized\" (artifact URLs redacted on the stream). Returns 200 `{ ticket, expiresAt }`.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "A ticket and its expiry for the run WebSocket.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookRunWsTicket"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/space-types/{spaceTypeId}/playbooks": {
      "get": {
        "operationId": "listSpaceTypePlaybooks",
        "summary": "List playbooks with their binding to a space type",
        "description": "Admin configuration view of the playbook ↔ space-type binding: returns EVERY playbook definition in the org annotated for the space type named in the path. Each entry carries the playbook id, name, description, status and spaceTypes plus two flags: `bound` (its `spaceTypes` explicitly includes this space type) and `global` (its `spaceTypes` is empty, so it applies to every space type and cannot be unbound here). Authorization: org admin only — other callers get 403. Returns 404 `not_found` if the space type does not exist. Response: `{ data: [...] }`, unpaginated.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "Every playbook, annotated for this space type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceTypePlaybookList"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — the space type does not exist"
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceTypeId",
            "required": true
          }
        ]
      },
      "put": {
        "operationId": "setSpaceTypePlaybooks",
        "summary": "Set the playbooks explicitly bound to a space type",
        "description": "Declaratively sets which playbooks are explicitly bound to the space type named in the path. Body: `{ playbookIds: string[] }` — the desired full set of explicitly-bound playbook ids. Each changed playbook has this space type added to / removed from its `spaceTypes` array; unchanged playbooks are not touched. Playbooks with an EMPTY `spaceTypes` apply to all space types and are ignored by this endpoint — listing their id has no effect (binding one explicitly would silently restrict it everywhere else). Authorization: organization administrators only — other callers get 403. Returns 404 `not_found` if the space type does not exist; 400 `unknown_playbook` if an id matches no playbook. Response: the same annotated list as GET, after the update.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The annotated playbook list, after the update.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceTypePlaybookList"
                }
              }
            }
          },
          "400": {
            "description": "`unknown_playbook` — an id matches no playbook definition"
          },
          "404": {
            "description": "`not_found` — the space type does not exist"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "playbookIds": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": "The desired full set of explicitly-bound playbook ids."
                  }
                },
                "required": ["playbookIds"]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceTypeId",
            "required": true
          }
        ]
      }
    },
    "/skills": {
      "get": {
        "operationId": "listSkills",
        "summary": "List the skills the org’s agents can read",
        "description": "A skill is instructions the agent reads on demand — it never executes, never dispatches and is never approval-gated (actions are the executable, gated layer). Lists the resolved catalog for the caller tenant: platform skills plus the org’s own, and — when `agentId` is given — that agent’s skills too. A slug is won WHOLE by the highest tier that defines it (agent > org > platform), reference files included; there is no per-file merge. Authorization: any authenticated org member. Response `{ data: SkillCatalogEntry[] }` — catalog only, never the file bodies. Returns 404 when agents are disabled.",
        "tags": ["Playbooks"],
        "parameters": [
          {
            "in": "query",
            "name": "agentId",
            "description": "Include that agent’s own tier and resolve the slug as that agent would see it.",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The resolved skill catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillList"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createSkill",
        "summary": "Create an organization or agent skill",
        "description": "A skill is instructions the agent reads on demand — it never executes, never dispatches and is never approval-gated (actions are the executable, gated layer). Creates a skill from a map of markdown files. `SKILL.md` is required and its YAML frontmatter supplies `name`, `description` and the optional `requires:` list of action slugs (400 `invalid_frontmatter` when it is missing or incomplete). Sibling `.md` files are progressive-disclosure references. Body: `slug` (1–64), `files`, optional `scope` (`org` default, or `agent` with a `playbookId`). Caps: 10 files, 64 KiB per file, 256 KiB per skill, 100 org skills — an over-cap write is 400 `skill_too_large` / `too_many_skills`, a non-markdown or traversing filename 400 `invalid_skill_file`, an existing scoped slug 409 `slug_conflict`. Authorization: organization administrators only. Response 201 `{ data: Skill }`.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "scope": {
                    "default": "org",
                    "description": "Which tier the skill lives in.",
                    "type": "string",
                    "enum": ["org", "agent"]
                  },
                  "playbookId": {
                    "description": "Required when `scope` is `agent`.",
                    "nullable": true,
                    "type": "string"
                  },
                  "slug": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "files": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    },
                    "description": "Markdown files keyed by filename. `SKILL.md` is required and carries the frontmatter (`name`, `description`, optional `requires:` action slugs); siblings are progressive-disclosure references the agent reads on demand."
                  }
                },
                "required": ["slug", "files"],
                "description": "`name`, `description` and `requires` are parsed from the SKILL.md frontmatter."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created skill.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/skills/{slug}": {
      "get": {
        "operationId": "getSkill",
        "summary": "Read one skill, including its files",
        "description": "A skill is instructions the agent reads on demand — it never executes, never dispatches and is never approval-gated (actions are the executable, gated layer). Fetches the tier that WINS this slug for the caller tenant (or, with `agentId`, for that agent) — never a merge across tiers. Authorization: any authenticated org member. 404 `skill_not_found` when no tier defines it. Response `{ data: Skill }` including `files`.",
        "tags": ["Playbooks"],
        "parameters": [
          {
            "in": "query",
            "name": "agentId",
            "description": "Include that agent’s own tier and resolve the slug as that agent would see it.",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "slug",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The winning skill.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateSkill",
        "summary": "Replace a skill’s files",
        "description": "A skill is instructions the agent reads on demand — it never executes, never dispatches and is never approval-gated (actions are the executable, gated layer). `files` replaces the whole map (same validation and caps as create) and bumps `version`. The slug IS the storage key, so this route never renames: a rename is a create plus a delete. `scope`/`playbookId` select which tier is edited (`org` by default); platform skills are code and cannot be edited here. Authorization: organization administrators only. Response `{ data: Skill }`.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "scope": {
                    "type": "string",
                    "enum": ["org", "agent"]
                  },
                  "playbookId": {
                    "nullable": true,
                    "type": "string"
                  },
                  "files": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    },
                    "description": "Markdown files keyed by filename. `SKILL.md` is required and carries the frontmatter (`name`, `description`, optional `requires:` action slugs); siblings are progressive-disclosure references the agent reads on demand."
                  }
                },
                "required": ["files"],
                "description": "`files` replaces the whole map and bumps `version`. The slug is the key, so renaming is a create plus a delete."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated skill.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "slug",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteSkill",
        "summary": "Delete an organization or agent skill",
        "description": "A skill is instructions the agent reads on demand — it never executes, never dispatches and is never approval-gated (actions are the executable, gated layer). Permanently deletes the org (default) or agent skill with this slug. Deleting a skill that shadowed a platform skill of the same slug brings the platform one back, whole; platform skills themselves are code and answer 403 `platform_skill_immutable`. Query: `scope` (`org` | `agent`, default `org`) and `playbookId` for the agent tier. Authorization: organization administrators only. Response `{ data: { slug } }`.",
        "tags": ["Playbooks"],
        "parameters": [
          {
            "in": "query",
            "name": "scope",
            "description": "Which tier to delete.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["org", "agent"],
              "default": "org"
            }
          },
          {
            "in": "query",
            "name": "playbookId",
            "description": "Required when `scope` is `agent`.",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "slug",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted skill slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedSkill"
                }
              }
            }
          }
        }
      }
    },
    "/agent-policy": {
      "get": {
        "operationId": "getAgentPolicy",
        "summary": "Read the organization prompt policy",
        "description": "The organization’s additive-only prompt policy: short text prepended and appended to every agent’s standing instructions. It ADDS rules — it can never remove or weaken a platform safety, evidence, approval or tool rule, and the agent is told so explicitly. Authorization: any authenticated org member. Response `{ data: { prepend, append, version } }`, zeroed when no policy has been set.",
        "tags": ["Playbooks"],
        "responses": {
          "200": {
            "description": "The organization prompt policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPolicyEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putAgentPolicy",
        "summary": "Set the organization prompt policy",
        "description": "Replaces the organization’s prompt policy and bumps its `version`. `prepend` and `append` are each capped at 2000 characters and reach the agent framed as operator policy that adds rules on top of — never in place of — the platform rules, so text asking the agent to drop approval gating changes nothing (the gates are mechanical). Authorization: organization administrators only. Response `{ data: { prepend, append, version } }`.",
        "tags": ["Playbooks"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prepend": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "append": {
                    "type": "string",
                    "maxLength": 2000
                  }
                },
                "description": "Additive-only operator policy. It ADDS rules on top of the platform prompt and can never remove or weaken a platform safety, evidence, approval or tool rule."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated organization prompt policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPolicyEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agents": {
      "get": {
        "operationId": "listOrgAgentDirectory",
        "summary": "List the org agent directory",
        "description": "Lists the paperwork agents this organization owns, one keyset page at a time, newest-updated first. Authorization: any authenticated org member (session + tenant context only, no admin required). Optional query `status` is one of `all` | `published` | `draft` (default `all`); any other value is ignored and the default applies. Optional `includeArchived=true` adds archived agents. A `private` agent is listed only for its owner; it is absent from every other member's directory. Paging: `limit` is 1-200 (default 100), and `cursor` takes the previous response's `nextCursor` — an opaque string the caller never parses; an out-of-range or non-numeric `limit` falls back to the default instead of failing. Response is `{ data: Agent[], nextCursor }` and `nextCursor` is null on the last page. Each Agent carries its id, handle, name, role, avatar, visibility, `publishedVersionId` (the `agv_` id runs are started with), `draftVersionId` and `sourcePlaybookId`.",
        "tags": ["Workspace Agents"],
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "description": "Filter by lifecycle state.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["all", "published", "draft"],
              "default": "all"
            }
          },
          {
            "in": "query",
            "name": "includeArchived",
            "description": "Include archived agents.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["true", "false"],
              "default": "false"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Agents per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "description": "The previous page's `nextCursor`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of org agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentList"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createPaperworkAgent",
        "summary": "Create an agent",
        "description": "Creates an agent together with its version-1 draft. Authorization: organization administrators only — other callers are rejected with 403. Body: `name` (required, 1-200 chars); optional `role`, `avatar`, `visibility` (`org` | `private`), `handle` (lowercase/digits/hyphens; derived from the name and de-duplicated — a second \"Mike\" becomes `mike-2` — when omitted) and a full `draft` version config. 409 `handle_taken` if an explicit handle is already used. Response 201: `{ data: { agent, draft, published } }`.",
        "tags": ["Workspace Agents"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "role": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "handle": {
                    "description": "Lowercase, digits and hyphens. Derived from `name` when omitted.",
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 32,
                    "pattern": "^[a-z0-9][a-z0-9-]{0,30}[a-z0-9]$"
                  },
                  "avatar": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": ["initials", "generated"]
                      },
                      "color": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$"
                      }
                    },
                    "required": ["kind"]
                  },
                  "visibility": {
                    "type": "string",
                    "enum": ["org", "private"]
                  },
                  "draft": {
                    "type": "object",
                    "properties": {
                      "documentAgent": {
                        "description": "Offer this published agent as a document reviewer. Requires file reading and document editing tools.",
                        "type": "boolean"
                      },
                      "harness": {
                        "description": "Automatic execution keeps the agent loop in the platform and starts isolated compute only when a tool needs it. Default: `auto`. Legacy `native` and `sandbox` values remain accepted for existing integrations.",
                        "type": "string",
                        "enum": ["auto", "native", "sandbox"]
                      },
                      "instructions": {
                        "description": "The standing instructions the agent runs under. A `native` version must also fit the engine ceiling (8000 chars) to publish.",
                        "type": "string",
                        "maxLength": 32768
                      },
                      "model": {
                        "type": "object",
                        "properties": {
                          "policy": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "maxSteps": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100
                          },
                          "budgetCredits": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          }
                        }
                      },
                      "memory": {
                        "description": "Saved memory the agent reads and updates across sessions. Private agents only: publishing an org agent with memory enabled answers 422 `memory_requires_private`. Default: on for `sandbox`, off otherwise.",
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean"
                          }
                        },
                        "required": ["enabled"],
                        "additionalProperties": false
                      },
                      "skills": {
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        }
                      },
                      "tools": {
                        "maxItems": 40,
                        "type": "array",
                        "items": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": ["action"]
                                },
                                "installedActionId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "preApproval": {
                                  "type": "boolean"
                                },
                                "postApproval": {
                                  "type": "boolean"
                                }
                              },
                              "required": ["kind", "installedActionId"]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": ["connector"]
                                },
                                "connectionId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "readOnlyTools": {
                                  "maxItems": 50,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64
                                  }
                                }
                              },
                              "required": ["kind", "connectionId"]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": ["platform"]
                                },
                                "name": {
                                  "type": "string",
                                  "enum": [
                                    "files",
                                    "artifacts",
                                    "spaces",
                                    "compose",
                                    "sign",
                                    "search",
                                    "objects",
                                    "ontology",
                                    "markdown"
                                  ]
                                }
                              },
                              "required": ["kind", "name"]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": ["sandbox"]
                                },
                                "name": {
                                  "type": "string",
                                  "enum": ["fs", "shell", "browser", "code", "net"]
                                }
                              },
                              "required": ["kind", "name"]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": ["delegate"]
                                }
                              },
                              "required": ["kind"]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": ["ask_human"]
                                }
                              },
                              "required": ["kind"]
                            }
                          ],
                          "description": "What the version may call. `fs` / `shell` / `browser` are refused on a `native` version at publish."
                        }
                      },
                      "spaces": {
                        "type": "object",
                        "properties": {
                          "mode": {
                            "type": "string",
                            "enum": ["session", "fixed", "any"]
                          },
                          "spaceIds": {
                            "maxItems": 50,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          "spaceTypes": {
                            "maxItems": 50,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9-]{0,38}[a-z0-9]$"
                            }
                          }
                        }
                      },
                      "network": {
                        "type": "object",
                        "properties": {
                          "policyId": {
                            "nullable": true,
                            "type": "string",
                            "maxLength": 128
                          }
                        }
                      },
                      "approvals": {
                        "type": "object",
                        "properties": {
                          "defaultForWrite": {
                            "type": "string",
                            "enum": ["ask", "allow"]
                          },
                          "sensitive": {
                            "type": "string",
                            "enum": ["ask"]
                          },
                          "approvers": {
                            "maxItems": 50,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          }
                        }
                      },
                      "delegation": {
                        "type": "object",
                        "properties": {
                          "canInvite": {
                            "anyOf": [
                              {
                                "maxItems": 20,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                }
                              },
                              {
                                "type": "string",
                                "enum": ["any", "none"]
                              }
                            ]
                          }
                        }
                      },
                      "tasks": {
                        "maxItems": 30,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "title": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "instructions": {
                              "nullable": true,
                              "type": "string",
                              "maxLength": 4000
                            },
                            "dependsOn": {
                              "maxItems": 30,
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "executor": {
                              "type": "string",
                              "enum": ["agent", "human"]
                            },
                            "assignee": {
                              "nullable": true,
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          "required": ["id", "title"]
                        }
                      }
                    }
                  }
                },
                "required": ["name"]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created agent and its draft.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDetail"
                }
              }
            }
          },
          "409": {
            "description": "`handle_taken` — the requested handle is already used in this org."
          }
        }
      }
    },
    "/agents/migrate": {
      "post": {
        "operationId": "migratePlaybooksToAgents",
        "summary": "Import the org playbooks as agents",
        "description": "Creates one agent per stored playbook definition (agent-refactor-spec §13): the handle comes from the playbook name, and the published version mirrors the playbook. Idempotent and additive — a playbook that already has an agent comes back in `skipped`, and the source playbook documents are never modified. Every playbook has its own error boundary: a legacy document the current schema refuses lands in `failed` instead of failing the whole import. Authorization: organization administrators only. Response: `{ data: { created: [{ playbookId, agentId, handle }], skipped: string[], failed: [{ playbookId, error }] } }`.",
        "tags": ["Workspace Agents"],
        "responses": {
          "200": {
            "description": "What was created and what was skipped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookMigrationResult"
                }
              }
            }
          }
        }
      }
    },
    "/agents/{agentRef}": {
      "get": {
        "operationId": "getPaperworkAgent",
        "summary": "Get an agent",
        "description": "Fetches one agent by id, handle or source playbook id, scoped to the caller tenant. Authorization: any authenticated org member (no admin required). Returns 404 if no such agent exists in this org. A `private` agent is visible only to its owner; every other caller gets 404. Response: `{ data: { agent, draft, published } }` — `published` is null until the agent has been published at least once.",
        "tags": ["Workspace Agents"],
        "responses": {
          "200": {
            "description": "The agent, its draft and its published version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDetail"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such agent in this organization."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updatePaperworkAgent",
        "summary": "Update an agent identity",
        "description": "Partially updates the agent identity — `name`, `role`, `handle`, `avatar`, `visibility`. The version config is edited through `PUT /agents/:agentRef/draft` instead. Authorization: organization administrators only. 409 `handle_taken` if the requested handle is used by another agent. A `private` agent is visible only to its owner; every other caller gets 404. Response: `{ data: { agent, draft, published } }`.",
        "tags": ["Workspace Agents"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "role": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "handle": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 32,
                    "pattern": "^[a-z0-9][a-z0-9-]{0,30}[a-z0-9]$"
                  },
                  "avatar": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": ["initials", "generated"]
                      },
                      "color": {
                        "type": "string",
                        "pattern": "^#[0-9a-fA-F]{6}$"
                      }
                    },
                    "required": ["kind"]
                  },
                  "visibility": {
                    "type": "string",
                    "enum": ["org", "private"]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated agent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDetail"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such agent in this organization."
          },
          "409": {
            "description": "`handle_taken` — the requested handle is already used in this org."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      }
    },
    "/agents/{agentRef}/draft": {
      "put": {
        "operationId": "putPaperworkAgentDraft",
        "summary": "Replace the agent draft version config",
        "description": "Replaces the whole draft version config: `harness`, `instructions`, `model`, `skills`, `tools` (the grants the version may call), `spaces`, `network`, `approvals`, `delegation` and `tasks`. The body is the FULL config — omitted fields fall back to their defaults, they are not merged with the stored draft. Nothing a run sees changes until the draft is published. Authorization: organization administrators only. A `private` agent is visible only to its owner; every other caller gets 404. Response: `{ data: { agent, draft, published } }`.",
        "tags": ["Workspace Agents"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentAgent": {
                    "description": "Offer this published agent as a document reviewer. Requires file reading and document editing tools.",
                    "type": "boolean"
                  },
                  "harness": {
                    "description": "Automatic execution keeps the agent loop in the platform and starts isolated compute only when a tool needs it. Default: `auto`. Legacy `native` and `sandbox` values remain accepted for existing integrations.",
                    "type": "string",
                    "enum": ["auto", "native", "sandbox"]
                  },
                  "instructions": {
                    "description": "The standing instructions the agent runs under. A `native` version must also fit the engine ceiling (8000 chars) to publish.",
                    "type": "string",
                    "maxLength": 32768
                  },
                  "model": {
                    "type": "object",
                    "properties": {
                      "policy": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "maxSteps": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100
                      },
                      "budgetCredits": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9007199254740991
                      }
                    }
                  },
                  "memory": {
                    "description": "Saved memory the agent reads and updates across sessions. Private agents only: publishing an org agent with memory enabled answers 422 `memory_requires_private`. Default: on for `sandbox`, off otherwise.",
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean"
                      }
                    },
                    "required": ["enabled"],
                    "additionalProperties": false
                  },
                  "skills": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "tools": {
                    "maxItems": 40,
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": ["action"]
                            },
                            "installedActionId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "preApproval": {
                              "type": "boolean"
                            },
                            "postApproval": {
                              "type": "boolean"
                            }
                          },
                          "required": ["kind", "installedActionId"]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": ["connector"]
                            },
                            "connectionId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "readOnlyTools": {
                              "maxItems": 50,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              }
                            }
                          },
                          "required": ["kind", "connectionId"]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": ["platform"]
                            },
                            "name": {
                              "type": "string",
                              "enum": [
                                "files",
                                "artifacts",
                                "spaces",
                                "compose",
                                "sign",
                                "search",
                                "objects",
                                "ontology",
                                "markdown"
                              ]
                            }
                          },
                          "required": ["kind", "name"]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": ["sandbox"]
                            },
                            "name": {
                              "type": "string",
                              "enum": ["fs", "shell", "browser", "code", "net"]
                            }
                          },
                          "required": ["kind", "name"]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": ["delegate"]
                            }
                          },
                          "required": ["kind"]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": ["ask_human"]
                            }
                          },
                          "required": ["kind"]
                        }
                      ],
                      "description": "What the version may call. `fs` / `shell` / `browser` are refused on a `native` version at publish."
                    }
                  },
                  "spaces": {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": ["session", "fixed", "any"]
                      },
                      "spaceIds": {
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        }
                      },
                      "spaceTypes": {
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[a-z][a-z0-9-]{0,38}[a-z0-9]$"
                        }
                      }
                    }
                  },
                  "network": {
                    "type": "object",
                    "properties": {
                      "policyId": {
                        "nullable": true,
                        "type": "string",
                        "maxLength": 128
                      }
                    }
                  },
                  "approvals": {
                    "type": "object",
                    "properties": {
                      "defaultForWrite": {
                        "type": "string",
                        "enum": ["ask", "allow"]
                      },
                      "sensitive": {
                        "type": "string",
                        "enum": ["ask"]
                      },
                      "approvers": {
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        }
                      }
                    }
                  },
                  "delegation": {
                    "type": "object",
                    "properties": {
                      "canInvite": {
                        "anyOf": [
                          {
                            "maxItems": 20,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          {
                            "type": "string",
                            "enum": ["any", "none"]
                          }
                        ]
                      }
                    }
                  },
                  "tasks": {
                    "maxItems": 30,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "instructions": {
                          "nullable": true,
                          "type": "string",
                          "maxLength": 4000
                        },
                        "dependsOn": {
                          "maxItems": 30,
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "executor": {
                          "type": "string",
                          "enum": ["agent", "human"]
                        },
                        "assignee": {
                          "nullable": true,
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        }
                      },
                      "required": ["id", "title"]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The agent with its new draft.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDetail"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such agent in this organization."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      }
    },
    "/agents/{agentRef}/publish": {
      "post": {
        "operationId": "publishPaperworkAgent",
        "summary": "Publish the agent draft",
        "description": "Publishes the current draft as the agent`s live version and opens a fresh draft at the next version number. Publishing writes the engine-compat shadow playbook document whose id IS the new `agv_` version id, so `POST /spaces/:spaceId/playbook-runs` can start the agent with `playbookId: \"<publishedVersionId>\"` unchanged. The previous version stops starting runs (its id answers 409 `playbook_not_active`). Authorization: organization administrators only. A `private` agent is visible only to its owner; every other caller gets 404. 409 `agent_archived` when the agent is archived — unarchive it first, publishing must never re-activate a hidden agent. 422 when the draft cannot run: `harness_not_available`, `instructions_too_long_for_native`, `too_many_skills_for_native`, `sandbox_tool_on_native_harness`, `platform_tool_not_available_on_sandbox` (a sandbox version may hold the `files` and `spaces` platform tools only — the rest resolve in the run engine), `tool_grants_nothing_on_sandbox` (a sandbox version may not hold `code`, a connector or delegation — none of them expands to a tool inside a container), `unknown_model_policy`, `space_scope_not_supported_on_native`, or `engine_rejected_version` when the run engine's own validator refuses the version (that one carries `issues[]`, each with the failing `path`). Branch on `error_code`, never on the sentence. Response: `{ data: { agent, draft, published } }` — `agent.publishedVersionId` is the `agv_` id.",
        "tags": ["Workspace Agents"],
        "responses": {
          "200": {
            "description": "The published agent and its fresh draft.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentDetail"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such agent in this organization."
          },
          "409": {
            "description": "`agent_archived` — unarchive the agent before publishing it."
          },
          "422": {
            "description": "The draft cannot run — `error_code` is one of the seven publish codes, or `engine_rejected_version` with per-field `issues[]`."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      }
    },
    "/agents/{agentRef}/archive": {
      "post": {
        "operationId": "archivePaperworkAgent",
        "summary": "Archive an agent",
        "description": "Archives the agent and stops its published version from starting new runs. It drops out of the directory unless `includeArchived=true` is passed. Runs already in flight are untouched. Archiving is a durable stop: publishing an archived agent answers 409 `agent_archived` — `POST /agents/:agentRef/unarchive` is the way back. Authorization: organization administrators only. A `private` agent is visible only to its owner; every other caller gets 404. Response: `{ data: Agent }`.",
        "tags": ["Workspace Agents"],
        "responses": {
          "200": {
            "description": "The archived agent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such agent in this organization."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      }
    },
    "/agents/{agentRef}/unarchive": {
      "post": {
        "operationId": "unarchivePaperworkAgent",
        "summary": "Unarchive an agent",
        "description": "Clears `archivedAt` and puts the published version back in service, so directory visibility and runnability agree again. The agent keeps its handle and its version history. Authorization: organization administrators only. A `private` agent is visible only to its owner; every other caller gets 404. Response: `{ data: Agent }`.",
        "tags": ["Workspace Agents"],
        "responses": {
          "200": {
            "description": "The unarchived agent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such agent in this organization."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      }
    },
    "/agents/{agentRef}/memory/tree": {
      "get": {
        "operationId": "listAgentMemoryTree",
        "summary": "List memory files",
        "description": "Lists every file of the saved memory with its size, blob and front-matter summary.",
        "tags": ["Workspace Agents"],
        "parameters": [
          {
            "in": "query",
            "name": "prefix",
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "List memory files",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "path": {
                                "type": "string"
                              },
                              "size": {
                                "type": "number"
                              },
                              "blob": {
                                "type": "string"
                              },
                              "summary": {
                                "type": "string"
                              }
                            },
                            "required": ["path", "size", "blob"]
                          }
                        }
                      },
                      "required": ["sha", "entries"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agents/{agentRef}/memory/files": {
      "get": {
        "operationId": "getAgentMemoryFiles",
        "summary": "Read memory files",
        "description": "Reads up to 20 files at once. Repeat `path` for each file. A missing file answers `missing: true`.",
        "tags": ["Workspace Agents"],
        "parameters": [
          {
            "in": "query",
            "name": "path",
            "description": "A relative file path. Repeat up to 20 times.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Read memory files",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "files": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "path": {
                                "type": "string"
                              },
                              "content": {
                                "type": "string"
                              },
                              "blob": {
                                "type": "string"
                              },
                              "missing": {
                                "type": "boolean",
                                "const": true
                              }
                            },
                            "required": ["path"]
                          }
                        }
                      },
                      "required": ["sha", "files"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putAgentMemoryFile",
        "summary": "Save a memory file",
        "description": "Creates or replaces one file. `expectBlob` is the blob you read (null for a new file), so a concurrent edit answers 409 instead of being overwritten.",
        "tags": ["Workspace Agents"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  },
                  "content": {
                    "type": "string",
                    "maxLength": 262144
                  },
                  "expectBlob": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9a-f]{40}$"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The blob you read, or null to create a new file. Stale values answer 409."
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": ["path", "content", "expectBlob"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Nothing changed; the unchanged head",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "201": {
            "description": "The new version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`expect_failed` (`paths`) — the file changed since you read it; `stale_parent` or `conflict` — the history moved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`lint_failed` — `violations` lists each file rule the change broke.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteAgentMemoryFile",
        "summary": "Delete a memory file",
        "description": "Deletes one file. `expectBlob` is the blob you read; a changed file answers 409.",
        "tags": ["Workspace Agents"],
        "parameters": [
          {
            "in": "query",
            "name": "path",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            },
            "required": true
          },
          {
            "in": "query",
            "name": "expectBlob",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Nothing changed; the unchanged head",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "201": {
            "description": "The new version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`expect_failed` (`paths`) — the file changed since you read it; `stale_parent` or `conflict` — the history moved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`lint_failed` — `violations` lists each file rule the change broke.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agents/{agentRef}/memory/history": {
      "get": {
        "operationId": "listAgentMemoryHistory",
        "summary": "List memory history",
        "description": "Lists saved versions, newest first, optionally for one file. Pass `nextCursor` back as `cursor` for the next page.",
        "tags": ["Workspace Agents"],
        "parameters": [
          {
            "in": "query",
            "name": "path",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "List memory history",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "sha": {
                            "type": "string"
                          },
                          "parents": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "author": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "time": {
                            "type": "number"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": ["sha", "parents", "author", "email", "time", "message"]
                      }
                    },
                    "nextCursor": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["data", "nextCursor"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agents/{agentRef}/memory/history/{sha}": {
      "get": {
        "operationId": "getAgentMemoryCommit",
        "summary": "Get one memory version",
        "description": "Returns one saved version with the per-file changes it made.",
        "tags": ["Workspace Agents"],
        "responses": {
          "200": {
            "description": "Get one memory version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sha",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      }
    },
    "/agents/{agentRef}/memory/history/{sha}/revert": {
      "post": {
        "operationId": "revertAgentMemoryCommit",
        "summary": "Revert a memory version",
        "description": "Saves a new version that undoes the given one. A later edit to the same files answers 409 `conflict`.",
        "tags": ["Workspace Agents"],
        "responses": {
          "200": {
            "description": "Nothing changed; the unchanged head",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "201": {
            "description": "The new version",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "sha": {
                          "type": ["string", "null"]
                        },
                        "branch": {
                          "type": "string"
                        },
                        "changed": {
                          "type": "number",
                          "description": "How many files the version changed."
                        }
                      },
                      "required": ["sha", "branch", "changed"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`expect_failed` (`paths`) — the file changed since you read it; `stale_parent` or `conflict` — the history moved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`lint_failed` — `violations` lists each file rule the change broke.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "sha",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{40}$"
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      }
    },
    "/agents/{agentRef}/memory/proposals": {
      "get": {
        "operationId": "listAgentMemoryProposals",
        "summary": "List memory proposals",
        "description": "Lists proposed memory changes that wait for your review, newest first.",
        "tags": ["Workspace Agents"],
        "parameters": [
          {
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string",
              "enum": ["open", "merged", "closed", "all"]
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "List memory proposals",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "number": {
                            "type": "number"
                          },
                          "from": {
                            "type": "string"
                          },
                          "into": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string",
                            "enum": ["open", "merged", "closed"]
                          },
                          "title": {
                            "type": "string"
                          },
                          "author": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              }
                            },
                            "required": ["name", "email"]
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "mergedSha": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "number",
                          "from",
                          "into",
                          "state",
                          "title",
                          "author",
                          "createdAt"
                        ]
                      }
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/agents/{agentRef}/memory/proposals/{n}": {
      "get": {
        "operationId": "getAgentMemoryProposal",
        "summary": "Get a memory proposal",
        "description": "Returns one proposal with its file changes.",
        "tags": ["Workspace Agents"],
        "responses": {
          "200": {
            "description": "Get a memory proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "number"
                        },
                        "from": {
                          "type": "string"
                        },
                        "into": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "enum": ["open", "merged", "closed"]
                        },
                        "title": {
                          "type": "string"
                        },
                        "author": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            }
                          },
                          "required": ["name", "email"]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "mergedSha": {
                          "type": "string"
                        },
                        "compare": {
                          "anyOf": [
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The proposed file changes; null when the proposed branch is gone."
                        }
                      },
                      "required": [
                        "number",
                        "from",
                        "into",
                        "state",
                        "title",
                        "author",
                        "createdAt",
                        "compare"
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "n",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      }
    },
    "/agents/{agentRef}/memory/proposals/{n}/approve": {
      "post": {
        "operationId": "approveAgentMemoryProposal",
        "summary": "Approve a memory proposal",
        "description": "Applies the proposed changes to the saved memory as you. A file changed on both sides answers 409 `conflict` and leaves the proposal open.",
        "tags": ["Workspace Agents"],
        "responses": {
          "200": {
            "description": "Approve a memory proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "number"
                        },
                        "from": {
                          "type": "string"
                        },
                        "into": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "const": "merged"
                        },
                        "title": {
                          "type": "string"
                        },
                        "author": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            }
                          },
                          "required": ["name", "email"]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "mergedSha": {
                          "type": "string"
                        },
                        "sha": {
                          "type": ["string", "null"]
                        }
                      },
                      "required": [
                        "number",
                        "from",
                        "into",
                        "state",
                        "title",
                        "author",
                        "createdAt",
                        "sha"
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`conflict` or `not_open` — the proposal stays as it was.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "n",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      }
    },
    "/agents/{agentRef}/memory/proposals/{n}/reject": {
      "post": {
        "operationId": "rejectAgentMemoryProposal",
        "summary": "Reject a memory proposal",
        "description": "Closes the proposal without applying it.",
        "tags": ["Workspace Agents"],
        "responses": {
          "200": {
            "description": "Reject a memory proposal",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "number"
                        },
                        "from": {
                          "type": "string"
                        },
                        "into": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "enum": ["open", "merged", "closed"]
                        },
                        "title": {
                          "type": "string"
                        },
                        "author": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            }
                          },
                          "required": ["name", "email"]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "mergedSha": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "number",
                        "from",
                        "into",
                        "state",
                        "title",
                        "author",
                        "createdAt"
                      ]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`not_open` — the proposal was already applied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "n",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      }
    },
    "/agents/{agentRef}/memory/forget": {
      "post": {
        "operationId": "forgetAgentMemory",
        "summary": "Forget memory content",
        "description": "Removes the matching files, or every file version that contains `text`, from all saved history. This cannot be undone.",
        "tags": ["Workspace Agents"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paths": {
                    "description": "Exact paths or globs (`**` spans folders) to drop from every version.",
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    }
                  },
                  "text": {
                    "description": "Drop every file version whose content contains this text.",
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 1000
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Forget memory content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "rewritten": {
                          "type": "number"
                        },
                        "refs": {
                          "type": "number"
                        }
                      },
                      "required": ["rewritten", "refs"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`personal_account_required` — only the owner may open this memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`memory_not_available` — this memory does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "agentRef",
            "required": true
          }
        ]
      }
    },
    "/agent-components": {
      "get": {
        "operationId": "listAgentComponents",
        "summary": "Search organization components",
        "tags": ["Agent components"],
        "responses": {
          "200": {
            "description": "Search organization components",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ]
      },
      "post": {
        "operationId": "createAgentComponent",
        "summary": "Create an organization component as an administrator",
        "tags": ["Agent components"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9-]{0,63}$"
                  },
                  "definition": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": ["slug", "definition"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Create an organization component as an administrator",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        }
      }
    },
    "/agent-components/{slug}": {
      "get": {
        "operationId": "getAgentComponent",
        "summary": "Read a component and its versions",
        "tags": ["Agent components"],
        "responses": {
          "200": {
            "description": "Read a component and its versions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            },
            "required": true
          }
        ]
      },
      "put": {
        "operationId": "updateAgentComponent",
        "summary": "Edit an unlocked organization component as an administrator",
        "tags": ["Agent components"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedRevision": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "definition": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": ["expectedRevision", "definition"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Edit an unlocked organization component as an administrator",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            },
            "required": true
          }
        ]
      }
    },
    "/agent-components/{slug}/lock": {
      "put": {
        "operationId": "lockAgentComponent",
        "summary": "Lock or unlock a component as an administrator",
        "tags": ["Agent components"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedRevision": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "locked": {
                    "type": "boolean"
                  }
                },
                "required": ["expectedRevision", "locked"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lock or unlock a component as an administrator",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {}
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,63}$"
            },
            "required": true
          }
        ]
      }
    },
    "/network-policies": {
      "get": {
        "operationId": "listNetworkPolicies",
        "summary": "List the organization’s network policies",
        "tags": ["Network policies"],
        "description": "Lists the live (non-revoked) policies of the caller’s organization, oldest id first. Query: `cursor` (the `nextCursor` of the previous page) and `limit` (1–100, default 50). Authorization: any member of the organization.",
        "responses": {
          "200": {
            "description": "One page of policies.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkPolicyList"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "pattern": "^net_[0-9A-HJKMNP-TV-Z]{26}$"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ]
      },
      "post": {
        "operationId": "createNetworkPolicy",
        "summary": "Create a network policy",
        "tags": ["Network policies"],
        "description": "Creates an immutable policy: the set of hosts an agent version carrying it may reach, the connection whose credential is injected per host, and whether a request to a host parks as a human approval first. Model traffic is NOT egress: the sandbox loop calls the platform model relay, which runs the call on the platform’s own inference binding, so the platform’s own model host is refused as a policy host. Authorization: org admin.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkPolicyBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkPolicyEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` — writing a network policy is an org-admin action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_network_policy` — a host is not an exact public DNS name, or the policy lists more than 50 of them. The sentence names the offending host.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/network-policies/{policyId}": {
      "get": {
        "operationId": "getNetworkPolicy",
        "summary": "Read one network policy",
        "tags": ["Network policies"],
        "description": "Reads a policy by id, revoked ones included — a published agent version keeps pointing at the policy it was published with, so history stays readable. Authorization: any member.",
        "responses": {
          "200": {
            "description": "The policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkPolicyEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "`network_policy_not_found` — no such policy in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "policyId",
            "schema": {
              "type": "string",
              "pattern": "^net_[0-9A-HJKMNP-TV-Z]{26}$"
            },
            "required": true
          }
        ]
      },
      "put": {
        "operationId": "replaceNetworkPolicy",
        "summary": "Replace a network policy",
        "tags": ["Network policies"],
        "description": "Mints a NEW policy id from this body. The named policy and every published version using it stay exactly as they were — save the new id on the agent draft and publish it for the change to take effect. Authorization: org admin.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkPolicyBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The replacement policy, under a new id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkPolicyEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` — writing a network policy is an org-admin action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`network_policy_not_found` — no such policy in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`invalid_network_policy` — a host is not an exact public DNS name, or the policy lists more than 50 of them. The sentence names the offending host.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "policyId",
            "schema": {
              "type": "string",
              "pattern": "^net_[0-9A-HJKMNP-TV-Z]{26}$"
            },
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "revokeNetworkPolicy",
        "summary": "Revoke a network policy",
        "tags": ["Network policies"],
        "description": "Revokes the policy immediately: every subsequent egress request under it is denied, on every version that carries it. It stays readable for history. Authorization: org admin.",
        "responses": {
          "200": {
            "description": "The revoked policy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkPolicyEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` — writing a network policy is an org-admin action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`network_policy_not_found` — no such policy in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "policyId",
            "schema": {
              "type": "string",
              "pattern": "^net_[0-9A-HJKMNP-TV-Z]{26}$"
            },
            "required": true
          }
        ]
      }
    },
    "/style-profiles/fonts": {
      "get": {
        "operationId": "listStyleProfileFonts",
        "summary": "List the font families a style profile may use",
        "tags": ["Style profiles"],
        "description": "The renderer’s own curated allowlist, relayed live from `typst-render` — never a copy. A family absent from this list fails a render, so a font picker reads this route and a profile naming anything else is refused at the write. Authorization: any member.",
        "responses": {
          "200": {
            "description": "The families and the engine defaults.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StyleProfileFontCatalog"
                }
              }
            }
          }
        }
      }
    },
    "/style-profiles": {
      "get": {
        "operationId": "listStyleProfiles",
        "summary": "List the organization’s style profiles",
        "tags": ["Style profiles"],
        "description": "Every style profile of the caller’s organization, oldest first. At most one carries `isDefault`. Authorization: any member.",
        "responses": {
          "200": {
            "description": "The organization’s profiles.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StyleProfileList"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createStyleProfile",
        "summary": "Create a style profile",
        "tags": ["Style profiles"],
        "description": "Creates a profile: logo, colours, fonts, page, heading and table rules. Every field but `name` has a default, so the smallest legal body is `{\"name\": \"House style\"}` and it already composes. `isDefault: true` clears the flag on every other profile. Authorization: org admin.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StyleProfileBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new profile.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StyleProfileEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a field is outside its allowed value space.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` — changing the organization’s brand is an admin action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`unknown_font_family` — the family is not one the renderer carries (the sentence lists the legal ones); `logo_too_large` / `logo_unavailable` — the logo file is over 2 MiB or has no stored bytes; `template_render_failed` — the profile does not compile, with the typst diagnostic.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/style-profiles/{profileId}": {
      "get": {
        "operationId": "getStyleProfile",
        "summary": "Read one style profile",
        "tags": ["Style profiles"],
        "description": "Reads a profile by id. Authorization: any member.",
        "responses": {
          "200": {
            "description": "The profile.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StyleProfileEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such style profile in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "profileId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateStyleProfile",
        "summary": "Update a style profile",
        "tags": ["Style profiles"],
        "description": "Replaces the top-level fields the body names — a nested object it names is replaced whole, never deep-merged, so a partial `colors` re-defaults the colours it omits. Any change drops the compiled template so the next composition re-caches. Authorization: org admin.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchStyleProfileBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated profile.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StyleProfileEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a field is outside its allowed value space.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` — changing the organization’s brand is an admin action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such style profile in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`unknown_font_family` — the family is not one the renderer carries (the sentence lists the legal ones); `logo_too_large` / `logo_unavailable` — the logo file is over 2 MiB or has no stored bytes; `template_render_failed` — the profile does not compile, with the typst diagnostic.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "profileId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteStyleProfile",
        "summary": "Delete a style profile",
        "tags": ["Style profiles"],
        "description": "Deletes the profile. Documents already composed keep their PDF — the profile is the recipe, not the output. Authorization: org admin.",
        "responses": {
          "200": {
            "description": "The deleted profile.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StyleProfileEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` — changing the organization’s brand is an admin action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such style profile in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "profileId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          }
        ]
      }
    },
    "/style-profiles/{profileId}/sample": {
      "post": {
        "operationId": "renderStyleProfileSample",
        "summary": "Render a sample PDF in this style profile",
        "tags": ["Style profiles"],
        "description": "Composes a fixed sample document — heading, prose, a list, a table and a quote — through the profile’s typst template and answers the PDF bytes (`application/pdf`). It is what the Brand page previews. Authorization: any member.",
        "responses": {
          "200": {
            "description": "The sample PDF.",
            "content": {
              "application/pdf": {}
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such style profile in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`unknown_font_family` — the family is not one the renderer carries (the sentence lists the legal ones); `logo_too_large` / `logo_unavailable` — the logo file is over 2 MiB or has no stored bytes; `template_render_failed` — the profile does not compile, with the typst diagnostic.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "profileId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions": {
      "post": {
        "operationId": "openWorkspaceSession",
        "summary": "Open a work session",
        "tags": ["Workspace Sessions"],
        "description": "Opens a work session (`ws_`) with a description, the agents to invite, the spaces it is linked to and its working set of files. **Authorization:** any authenticated member. With no `spaceIds` the session lands on the caller’s own private desk, created on demand — a desk session is private BY IDENTITY and can never be shared, so name a real space (here, or later with `PATCH`) for anything a colleague must see. Every named space must EXIST and is re-checked for `space:contribute` as the caller — either denial is 404, so a space’s existence is never leaked; an explicit `me:*` id is 400 `cannot_target_desk` (a desk is never a named target). An entry in `spaceIds` is a bare id or `{ spaceId, access }`, where `access` is `read` or `commit` (default). Every id in `fileIds` is resolved the same way — it must exist and the caller must hold `space:read` on the space it lives in, otherwise 404. EVERY turn is scoped to this working set, so an id that cannot be read would refuse every later turn. The set is repairable: `PATCH { fileIds }` replaces it. Each agent must be published and not archived — a session pins its `publishedVersionId` — otherwise 422 `agent_not_published`. On success the caller is granted the `work-session-owner` role on the new `work_session` FGA resource.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpenWorkspaceSessionBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The opened work session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionDetail"
                }
              }
            }
          },
          "400": {
            "description": "`cannot_target_desk` — a `me:*` id was named explicitly."
          },
          "404": {
            "description": "A named space the caller cannot contribute to, or a file that does not exist or the caller cannot read."
          },
          "422": {
            "description": "`agent_not_published` — an agent is unpublished or archived."
          }
        }
      },
      "get": {
        "operationId": "listWorkspaceSessions",
        "summary": "List the work sessions the caller can see",
        "tags": ["Workspace Sessions"],
        "description": "One keyset page of work sessions, MOST RECENTLY ACTIVE first (`lastActivityAt`, which is also what `nextCursor` carries), read from the `work_sessions` projection with a single query. **Authorization:** a session is listed when the caller holds `work_session:read`, or when it is linked to a space the caller holds `space:contribute` on — the SAME permission the detail route is gated on, so the list never advertises a session every other route answers 404 on; administrators see every session EXCEPT other people’s desk sessions, which are private by identity. Optional `filter` is `mine`, `shared`, `space:<spaceId>` or `agent:<agentId>`; `status` narrows by derived status and `workStatus` by the status a person set; `limit` is 1-50 (default 25) and `starting_after` takes the previous page’s `nextCursor`. Every one of them is ENFORCED — an unknown `filter`, a `limit` outside 1-50 or a status outside the enum is 400 `validation_failed`, never a quietly unfiltered page (R7-03 / R7C-04). The projection is best-effort, so a session opened seconds ago may take a moment to appear.",
        "responses": {
          "200": {
            "description": "One page of work sessions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionList"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a bad `filter`, `status` or `limit`."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "filter",
            "schema": {
              "example": "mine",
              "anyOf": [
                {
                  "type": "string",
                  "enum": ["mine", "shared"]
                },
                {
                  "type": "string",
                  "pattern": "^space:[\\s\\S]{1,}$"
                },
                {
                  "type": "string",
                  "pattern": "^agent:[\\s\\S]{1,}$"
                }
              ]
            },
            "description": "One of `mine` (opened by the caller), `shared` (the caller is a participant on someone else’s session), `space:<spaceId>` or `agent:<agentId>`. Any other value is 400 `validation_failed`."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": ["open", "working", "waiting", "done", "archived"]
            },
            "description": "Only sessions in this derived status."
          },
          {
            "in": "query",
            "name": "workStatus",
            "schema": {
              "type": "string",
              "enum": ["active", "ready_for_review", "done"]
            },
            "description": "Only sessions a person has set to this work status."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "description": "Page size, 1-50 (default 25)."
          },
          {
            "in": "query",
            "name": "starting_after",
            "schema": {
              "type": "string"
            },
            "description": "The previous page’s `nextCursor` — `<ISO-8601 timestamp>|<row id>` (a bare timestamp is still accepted). Anything else is 400 `validation_failed`."
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}": {
      "get": {
        "operationId": "getWorkspaceSession",
        "summary": "Read one work session",
        "tags": ["Workspace Sessions"],
        "description": "The authoritative session — read live, never from the list projection, so status and counts are always fresh. `counts.unread` is the CALLER’s own open `inbox_items` rows on this session (spec §6) — per viewer, so it is resolved here rather than held on the session record. **Authorization:** `work_session:read` on the session, OR `space:contribute` on one of its linked spaces; a desk session is readable only by its owner, even by an administrator. Any denial is 404. A caller who may read but not WRITE the session reads the SANITIZED view, the same one its live socket and its `/entries` page get: url-ish keys and url-ish values are redacted.",
        "responses": {
          "200": {
            "description": "The work session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionDetail"
                }
              }
            }
          },
          "404": {
            "description": "No such session, or the caller may not see it."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "patchWorkspaceSession",
        "summary": "Retitle, relink, invite into, set the work status of or archive a work session",
        "tags": ["Workspace Sessions"],
        "description": "Changes the title, description, linked spaces, participants or work status, or archives the session. `workStatus` (`active`, `ready_for_review`, `done`) needs only `work_session:comment`, but `done` must come from a person: an org API key, a trigger delivery is 403 `work_status_needs_person`, and so is `archive: true` from any of them, since archiving marks the work `done`. Archiving sets `done`, a reopen `active`, and a new agent turn moves it back to `active`. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session is writable only by its owner. Any denial is 404. `spaces`, `removeHumans` and `archive` need MORE than that: they are the owner’s (`work_session:manage`, spec §8.1), so a participant or a space contributor gets 403 `forbidden` on those three fields and keeps `title`, `description` and `addHumans`. Every id in `spaces` is re-checked as the caller exactly as `POST /workspace/sessions` checks `spaceIds`: a `me:*` desk the session is not ALREADY on is 400 `cannot_target_desk` (moving a session onto a desk would hide it from its own opener) and a space that does not exist or the caller cannot contribute to is 404, so a relay can never move a session somewhere its owner loses it. Each entry is `{ spaceId, access }` (`access` defaults to `commit`) or a bare id string, and `spaces` replaces the whole set, so it needs at least one entry — a session with no space cannot host a turn, and an empty array left it un-mentionable with no way back. `fileIds` replaces the working set the same way — every id is resolved as the caller (404 for an unknown or unreadable one) and `[]` empties it, so a session whose set carries a file nobody can read is repairable instead of permanently un-mentionable. A relink is checked against the working set it MOVES: every file the session already runs on must live in the new turn space, so a `spaces` patch that would leave the session un-mentionable is 404 — send `fileIds` in the same call (`[]` empties the set) to move and refill at once. The body is STRICT: an unknown key is 400 `validation_failed`, never a 200 that changed nothing. Every id in `addHumans` must be an active member of the caller’s organization: an id from another organization, or one that names nobody, is 404, so the roster never lists a person who could not open the session. `addHumans` also grants each member the `work-session-participant` FGA role, and `removeHumans` revokes it — agents are never FGA subjects (a turn runs as the human who mentioned it). A DESK session cannot be shared: the gate authorizes it by identity alone, so `addHumans` on one is 400 `cannot_share_desk` — relink it to a real space first. (A session opened with no `spaceIds` lands on the desk, so this is the default create path’s sharing story.)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchWorkspaceSessionBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated work session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionDetail"
                }
              }
            }
          },
          "400": {
            "description": "`cannot_target_desk` — a `me:*` id the session is not already linked to; `cannot_share_desk` — `addHumans` on a desk session; `validation_failed` — an unknown key in the body."
          },
          "403": {
            "description": "`forbidden` — `spaces`, `removeHumans` or `archive` without `work_session:manage`. `work_status_needs_person` — `workStatus: done` or `archive: true` from anything but a person."
          },
          "404": {
            "description": "No such session, the caller may not write it, no such space, a file in the working set that does not exist, the caller cannot read, or that does not live in the turn space this patch leaves the session in, or an `addHumans` id that is not a member of this organization."
          },
          "409": {
            "description": "`session_has_live_turn` — a turn is still running, so the session cannot be archived. Cancel it first. `session_archived` — the title, description or work status of archived work cannot change; reopen it (`archive: false`) in the same or an earlier call."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/entries": {
      "get": {
        "operationId": "listWorkspaceSessionEntries",
        "summary": "List a work session’s timeline entries",
        "tags": ["Workspace Sessions"],
        "description": "Timeline entries ordered by `seq`, which is gapless and monotonic, so a client pages forward with `afterSeq`. This is the ONLY way to read a timeline in full: the live socket replays at most the last 200 entries, so a client that needs the whole history pages here and then attaches. `seq` is WRITE order, not cause order: a mention starts its turns before the comment that asked for them is written (a refused turn must leave no orphan message behind), so a `turn_started` sits just ABOVE its comment. The comment names them — `startedTurnIds` on the entry — so a reader that wants cause order renders those `turn_started` entries directly below the comment that claims them. `afterSeq` and `limit` are ENFORCED: `afterSeq` is an integer ≥ 0 and `limit` is 1-200 (default 50), and anything else is 400 `validation_failed` — never a silent page one, which is how a client with a corrupted cursor used to loop forever (R9-02 / R9C-04). **Authorization:** `work_session:read` on the session, OR `space:contribute` on one of its linked spaces; a desk session is readable only by its owner. Any denial is 404. A caller who may read but not WRITE the session reads the SANITIZED view, the same one its live socket gets: a tool part keeps its name and loses its `input`, `output` and `errorText`, and url-ish values are redacted.",
        "responses": {
          "200": {
            "description": "One page of entries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionEntryList"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a bad `afterSeq` or `limit`."
          },
          "404": {
            "description": "No such session, or the caller may not see it."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "afterSeq",
            "schema": {
              "example": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "description": "Return only entries with a `seq` GREATER than this. `seq` is gapless and monotonic, so the last entry of a page is the next page’s `afterSeq`."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "example": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "description": "Page size, 1-200 (default 50)."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      },
      "post": {
        "operationId": "appendWorkspaceSessionEntry",
        "summary": "Comment on a work session, waking any agent it mentions",
        "tags": ["Workspace Sessions"],
        "description": "Starts one turn per mentioned agent, then appends the caller’s `comment` entry to the timeline — in that order, so `turn_started` holds the lower `seq`. The comment is appended WHATEVER the turns answer: a human’s message is always an entry (spec §5.4). An agent that refuses is named in `refused` with its reason, and a `system` entry below the comment says so on the timeline; the call still answers 201, with `turns` carrying only the turns that started (`[]` when none did). A refused agent still joins the session’s roster, so it shows in the right rail. A turn is scoped to the SESSION’s working set plus whatever this comment attaches in `fileIds`, so a caller never re-sends the session’s own files. An attachment JOINS that working set for good — it appears in the session’s `files`, in the right rail and in every later turn’s scope, instead of living for one turn and vanishing (R9-05). A session file that was deleted is left out of the turn’s scope but stays in the session’s `files`; a `system` entry names the agents that work without it. The appended `comment` carries `startedTurnIds` naming every turn it started, because those turns are written first and therefore hold a LOWER `seq` — that field is the causal link a timeline reader orders by. Every id in `fileIds` must exist and be readable by the caller (`space:read` on the space it lives in), otherwise 404. A mention of an agent that is still working steers its live turn when the scope is unchanged, and starts a SECOND turn (its own frozen snapshot) when it adds a file. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session is writable only by its owner. Any denial is 404. `mentions` mixes agent ids, agent handles and member user ids, and each is RESOLVED: a member (confirmed against the org directory) gets an inbox row, a published agent takes a turn whose capability belt (space type, creatable space types, delegable agents, resolved connectors) is resolved HERE as the caller and frozen into that turn’s run snapshot — one grant per turn. A mention that is neither is dropped and returned in `unresolvedMentions` so the composer can flag an unknown `@name`; a mention of a real but unpublished or archived agent is 422 `agent_not_published`. Responds 201 `{ data: { entry, turns, unresolvedMentions, refused } }`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppendWorkspaceEntryBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The appended entry and the turns it started.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppendWorkspaceEntryResult"
                }
              }
            }
          },
          "400": {
            "description": "`cannot_share_desk` — a desk session is private by identity, so a human mention on one cannot take effect. Relink it to a shared space first."
          },
          "404": {
            "description": "No such session, the caller may not write it, or an attached file does not exist or cannot be read by the caller."
          },
          "409": {
            "description": "`session_has_no_space` — the session is linked to no space, so a mentioned agent has nowhere to run; relink it first. `session_archived` — the session is archived, so it takes no new work; reopen it with `PATCH { archive: false }` first."
          },
          "422": {
            "description": "`agent_not_published` — a mentioned agent is unpublished or archived."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns": {
      "get": {
        "operationId": "listWorkspaceSessionTurns",
        "summary": "List a work session’s turns",
        "tags": ["Workspace Sessions"],
        "description": "Every turn the session has run, newest state included — the HTTP counterpart of the turn frames the live socket pushes, so a client that missed a frame reads the truth here instead of guessing. Pages: `limit` is 1-200 (default 50) and `starting_after` takes the previous page’s last id; `hasMore` says whether another page follows (RKO-761 R9C-07). **Authorization:** `work_session:read` on the session, OR `space:contribute` on one of its linked spaces; a desk session is readable only by its owner. Any denial is 404. A read-only caller reads the SANITIZED view, the same one its live socket gets.",
        "responses": {
          "200": {
            "description": "The session’s turns.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionTurnList"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a bad `limit` or `starting_after`."
          },
          "404": {
            "description": "No such session, or the caller may not see it."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "example": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "description": "Page size, 1-200 (default 50). Enforced: a bad value is 400 `validation_failed`."
          },
          {
            "in": "query",
            "name": "starting_after",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "The previous page’s last id."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/artifacts": {
      "get": {
        "operationId": "listWorkspaceSessionArtifacts",
        "summary": "List a work session’s artifacts",
        "tags": ["Workspace Sessions"],
        "description": "Every artifact produced in the session, `draft` until it is committed into a space, with the turn that produced it and the version it is on. Pages: `limit` is 1-200 (default 50) and `starting_after` takes the previous page’s last id; `hasMore` says whether another page follows (RKO-761 R9C-07). **Authorization:** `work_session:read` on the session, OR `space:contribute` on one of its linked spaces; a desk session is readable only by its owner. Any denial is 404. A read-only caller reads the SANITIZED view, the same one its live socket gets.",
        "responses": {
          "200": {
            "description": "The session’s artifacts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionArtifactList"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a bad `limit` or `starting_after`."
          },
          "404": {
            "description": "No such session, or the caller may not see it."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "example": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "description": "Page size, 1-200 (default 50). Enforced: a bad value is 400 `validation_failed`."
          },
          {
            "in": "query",
            "name": "starting_after",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "The previous page’s last id."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/artifacts/{artifactId}/commit": {
      "post": {
        "operationId": "commitWorkspaceArtifact",
        "summary": "Copy an artifact into a space",
        "tags": ["Workspace Sessions"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "spaceId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": ["spaceId"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The committed artifact."
          },
          "400": {
            "description": "`cannot_target_desk` — a desk is never a commit target."
          },
          "403": {
            "description": "`forbidden` — the caller reads the target space but holds no `space:contribute` on it."
          },
          "404": {
            "description": "`not_found` — no such session for the caller, or no such target space; `artifact_not_found` — no such artifact in this session."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "artifactId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/questions/{questionId}": {
      "post": {
        "operationId": "answerWorkspaceQuestion",
        "summary": "Answer a question from a turn",
        "tags": ["Workspace Sessions"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "answer": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 8000
                  }
                },
                "required": ["answer"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The answered question."
          },
          "400": {
            "description": "`validation_failed` — a malformed body."
          },
          "404": {
            "description": "No such session, turn, or question for the caller."
          },
          "409": {
            "description": "`run_not_running` — the question can no longer be answered."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "turnId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "questionId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/threads": {
      "get": {
        "operationId": "listWorkspaceSessionThreads",
        "summary": "List a work session’s threads",
        "tags": ["Workspace Sessions"],
        "description": "Every thread opened on the session, each rooted at the timeline `seq` it replies to — the set of `threadId` values an entry or a turn may name. Pages: `limit` is 1-200 (default 50) and `starting_after` takes the previous page’s last id; `hasMore` says whether another page follows (RKO-761 R9C-07). **Authorization:** `work_session:read` on the session, OR `space:contribute` on one of its linked spaces; a desk session is readable only by its owner. Any denial is 404. A read-only caller reads the SANITIZED view, the same one its live socket gets.",
        "responses": {
          "200": {
            "description": "The session’s threads.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionThreadList"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a bad `limit` or `starting_after`."
          },
          "404": {
            "description": "No such session, or the caller may not see it."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "example": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "description": "Page size, 1-200 (default 50). Enforced: a bad value is 400 `validation_failed`."
          },
          {
            "in": "query",
            "name": "starting_after",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "description": "The previous page’s last id."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      },
      "post": {
        "operationId": "openWorkspaceSessionThread",
        "summary": "Open a thread on a timeline entry",
        "tags": ["Workspace Sessions"],
        "description": "A reply opens a thread (spec §4.4/W6): the thread is rooted at an existing entry’s `seq`, and a later comment or turn carries the returned `thd_` id as its `threadId`. A `threadId` that is not a thread of this session is refused 404 wherever it is used, so nothing unvalidated lands on a permanent timeline. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session only for its owner. Any denial is 404.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpenWorkspaceThreadBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The opened thread.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceThread"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a malformed body, e.g. a missing `rootSeq`."
          },
          "404": {
            "description": "No such session, or the caller may not write it; `entry_not_found` — no entry at that `rootSeq`."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/steer": {
      "post": {
        "operationId": "steerWorkspaceTurn",
        "summary": "Steer a running turn",
        "tags": ["Workspace Sessions"],
        "description": "Hands a running turn a mid-flight instruction. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session is writable only by its owner. Any denial is 404.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SteerWorkspaceTurnBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The engine’s own result for the turn.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionTurnResult"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a malformed body."
          },
          "404": {
            "description": "No such session or turn, or the caller may not write it."
          },
          "409": {
            "description": "`run_not_running` — the turn is already terminal."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/pause": {
      "post": {
        "operationId": "pauseWorkspaceTurn",
        "summary": "Pause a running turn",
        "tags": ["Workspace Sessions"],
        "description": "Pauses a running turn; `resume` picks it back up. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session is writable only by its owner. Any denial is 404.",
        "responses": {
          "200": {
            "description": "The engine’s own result for the turn.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionTurnResult"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a malformed body."
          },
          "404": {
            "description": "No such session or turn, or the caller may not write it."
          },
          "409": {
            "description": "`run_not_running` — the turn is already terminal."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/resume": {
      "post": {
        "operationId": "resumeWorkspaceTurn",
        "summary": "Resume a paused turn",
        "tags": ["Workspace Sessions"],
        "description": "Resumes a paused turn. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session is writable only by its owner. Any denial is 404.",
        "responses": {
          "200": {
            "description": "The engine’s own result for the turn.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionTurnResult"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a malformed body."
          },
          "404": {
            "description": "No such session or turn, or the caller may not write it."
          },
          "409": {
            "description": "`run_not_running` — the turn is already terminal."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/cancel": {
      "post": {
        "operationId": "cancelWorkspaceTurn",
        "summary": "Cancel a turn",
        "tags": ["Workspace Sessions"],
        "description": "Cancels a turn, with an optional reason for the timeline. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session is writable only by its owner. Any denial is 404.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelWorkspaceTurnBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The engine’s own result for the turn.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionTurnResult"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a malformed body."
          },
          "404": {
            "description": "No such session or turn, or the caller may not write it."
          },
          "409": {
            "description": "`run_not_running` — the turn is already terminal."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/approvals/{approvalId}": {
      "post": {
        "operationId": "decideWorkspaceApproval",
        "summary": "Decide an approval raised by a turn",
        "tags": ["Workspace Sessions"],
        "description": "Approves or rejects an action a turn proposed, optionally with edited parameters. The platform executes; the agent never holds the credential (spec §11). Every decision writes an audit row. An EGRESS approval — a parked request to an `approval: true` host in the version’s network policy — is decided only by an approver the agent version declares (`approvals.approvers`; empty means any member who can write the session), and its card is `editable: false`, so `editedParams` is refused. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session is writable only by its owner. Any denial is 404.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecideWorkspaceApprovalBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The engine’s own result for the turn.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionTurnResult"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a malformed body."
          },
          "403": {
            "description": "`not_an_approver` — the agent version does not name this caller among the approvers of its egress requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such session or turn, or the caller may not write it."
          },
          "409": {
            "description": "`run_not_running` — the turn is already terminal."
          },
          "422": {
            "description": "`egress_not_editable` — an egress approval releases the request the agent already made; its parameters cannot be edited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "`approval_owner_unavailable` — approval ownership could not be resolved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "turnId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "approvalId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/tasks/{taskId}/claim": {
      "post": {
        "operationId": "claimWorkspaceTask",
        "summary": "Claim a human task raised by a turn",
        "tags": ["Workspace Sessions"],
        "description": "Claims a ready human task for the caller. Claiming is optional. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session is writable only by its owner. Any denial is 404.",
        "responses": {
          "200": {
            "description": "The engine’s own result for the turn.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionTurnResult"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a malformed body."
          },
          "404": {
            "description": "No such session or turn, or the caller may not write it."
          },
          "409": {
            "description": "`run_not_running` — the turn is already terminal."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "turnId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "taskId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/tasks/{taskId}/complete": {
      "post": {
        "operationId": "completeWorkspaceTask",
        "summary": "Complete a human task raised by a turn",
        "tags": ["Workspace Sessions"],
        "description": "Completes a human task, optionally with a note and files. Every id in `fileIds` must exist and be readable by the caller (`space:read` on the space it lives in), otherwise 404 — a task result the agent cannot open is not a result. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session is writable only by its owner. Any denial is 404.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompleteWorkspaceTaskBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The engine’s own result for the turn.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionTurnResult"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a malformed body."
          },
          "404": {
            "description": "No such session or turn, or the caller may not write it."
          },
          "409": {
            "description": "`run_not_running` — the turn is already terminal."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "turnId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "taskId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/tasks/{taskId}/skip": {
      "post": {
        "operationId": "skipWorkspaceTask",
        "summary": "Skip a human task, with a reason",
        "tags": ["Workspace Sessions"],
        "description": "Skips a human task; the reason is required and lands on the timeline. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session is writable only by its owner. Any denial is 404.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkipWorkspaceTaskBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The engine’s own result for the turn.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionTurnResult"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a malformed body."
          },
          "404": {
            "description": "No such session or turn, or the caller may not write it."
          },
          "409": {
            "description": "`run_not_running` — the turn is already terminal."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "turnId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "taskId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/sandbox": {
      "get": {
        "operationId": "getWorkspaceSessionSandbox",
        "summary": "Read the session’s sandbox container state",
        "tags": ["Workspace Sessions"],
        "description": "Answers `{ state, sbxId?, lastSeenAt?, backupAt? }`. `none` — no container and no backup yet; `queued` — a turn is waiting for one of the organization’s container slots; `provisioning` / `ready` — a turn is live; `sleeping` — nothing is running and the last `/workspace` backup is what the next turn restores. A pure read: it never provisions a container. **Authorization:** the session read gate; any denial is 404.",
        "responses": {
          "200": {
            "description": "The container state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceSandboxState"
                }
              }
            }
          },
          "404": {
            "description": "No such session, or the caller may not see it."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/sandbox/kill": {
      "post": {
        "operationId": "killWorkspaceSessionSandbox",
        "summary": "Stop the session’s sandbox container now",
        "tags": ["Workspace Sessions"],
        "description": "Destroys the container and releases the organization’s container slot and any credit hold the turn was holding. The next sandbox turn provisions a fresh container and restores the last `/workspace` backup into it, so nothing that was backed up is lost. Safe to call when no container is running. Answers `204`. **Authorization:** `work_session:manage` — the OWNER relation (spec §8.1), not the `comment` every participant holds. A session the caller cannot see answers 404; one they can see but do not own answers 403.",
        "responses": {
          "204": {
            "description": "The container is stopped."
          },
          "403": {
            "description": "`forbidden` — only a session owner may destroy its container.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such session, or the caller may not see it."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/ws-ticket": {
      "post": {
        "operationId": "mintWorkspaceSessionWsTicket",
        "summary": "Mint a live WebSocket ticket for a work session",
        "tags": ["Workspace Sessions"],
        "description": "Mints a single-use, 60-second ticket for `GET /workspace/sessions/{sessionId}/ws` (the upgrade itself is not an API operation — a browser socket cannot carry a bearer, so the ticket IS the capability). **Authorization:** `work_session:read` on the session, OR `space:contribute` on one of its linked spaces; a desk session only for its owner. Any denial is 404. The ticket carries a capability view: `full` when the caller could also WRITE the session, otherwise `sanitized`, and only full sockets receive live frames. A read-only principal is one holding `work_session:read` without `work_session:comment` — the `work-session-viewer` role; participants, owners and space contributors all read `full`. The SAME view is applied to the HTTP reads (`/entries`, `/turns`, `/artifacts`), so the fallback path can never hand back what the socket withheld. The socket’s opening replay frame carries at most the LAST 200 entries, so a client that needs an older timeline pages `GET /workspace/sessions/{sessionId}/entries` with `afterSeq` and treats the socket as the live tail.",
        "responses": {
          "200": {
            "description": "A ticket and its expiry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkSessionWsTicketResult"
                }
              }
            }
          },
          "404": {
            "description": "No such session, or the caller may not see it."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      }
    },
    "/workspace/inbox": {
      "get": {
        "operationId": "listWorkspaceInbox",
        "summary": "The caller’s inbox",
        "tags": ["Inbox"],
        "description": "One page of the caller’s own inbox rows — mentions, approvals, human tasks and unattended parks, plus `connector` rows for connections whose authorization broke — newest first, read from the `inbox_items` projection and the `connections` scan. That pair is ONE reader, shared with `GET /me/work`, so a broken connection is the same item with the same id on both surfaces (R6-A1); its id is the connection id and `POST /workspace/inbox/{itemId}/read` dismisses it. `connector` rows ride the first page only — they are synthesized, so they take no part in the cursor walk — but they always count toward `totalCount` and `unreadCount`. **Authorization:** no per-row check exists or is needed: a row is written FOR one user, so the `userId` filter IS the scope. `status` is `open` (the default) or `all`, and `open` means NOT DONE, not unread: a `mention` leaves it the moment it is read, while an `approval`, `task` or `parked` row that has been read stays until the work behind it closes; `limit` is 1-50 (default 25); `starting_after` takes the previous page’s `nextCursor`. Both are ENFORCED: a bad value is 400 `validation_failed`, not a silent fallback to the defaults (R7C-04).",
        "responses": {
          "200": {
            "description": "One page of inbox items.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceInboxList"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a bad `status` or `limit`."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": ["open", "all"]
            },
            "description": "`open` (default) or `all`. `open` means NOT DONE, not unread: reading a `mention` resolves it and drops it from this listing, while a read `approval`, `task` or `parked` row stays until the work behind it closes."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "example": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "description": "Page size, 1-50 (default 25). Page one leads with the caller’s broken-connection rows (`kind: connector`), which are synthesized rather than stored, and the stored page shrinks to keep the total inside `limit` — at least one stored row always comes through, so a caller whose broken connections alone fill the page receives them plus that row."
          },
          {
            "in": "query",
            "name": "starting_after",
            "schema": {
              "type": "string"
            },
            "description": "The previous page’s `nextCursor` — `<ISO-8601 timestamp>|<row id>` (a bare timestamp is still accepted). Anything else is 400 `validation_failed`."
          }
        ]
      }
    },
    "/workspace/inbox/{itemId}/read": {
      "post": {
        "operationId": "markWorkspaceInboxItemRead",
        "summary": "Mark one inbox item read",
        "tags": ["Inbox"],
        "description": "Resolves one inbox row, and what that MEANS depends on the row’s `kind` (R8-07). A `mention` is resolved outright — nothing else ever closes one, so reading it is finishing it: the row becomes `done` and leaves the default `status=open` listing and the badge. An `approval`, a `task` or a `parked` row becomes `read` and STAYS open — it is still the caller’s blocking work, and only the work behind it closing resolves it. A `connector` row is neither: it is dismissed until the connection FAILS A CHECK again, at which point it comes back unread — the breakage, not the reading, owns its lifetime. **Authorization:** the API verifies the personal recipient or fresh shared-space read access, including task assignment, before relaying the write. Another user’s personal row and inaccessible shared rows return 404. `itemId` is the row id both readers publish (`id` here, `itemId` on `GET /api/me/work`) or, for a `connector` row, the connection id. A `refId` is NOT accepted: it names the approval / task / question, which repeats across sessions, so it can never identify one row.",
        "responses": {
          "200": {
            "description": "The updated item.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceInboxItemEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such inbox item for this caller."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "itemId",
            "required": true
          }
        ]
      }
    },
    "/workspace/agents": {
      "get": {
        "operationId": "listWorkspaceAgents",
        "summary": "The published agent directory",
        "tags": ["Workspace Agents"],
        "description": "The agents a member can actually mention in a session: PUBLISHED and non-archived only. **Authorization:** any authenticated member; a `private` agent is listed only for its owner, which `work-sessions` scopes by the relayed identity. `limit` is 1-200 (default 100) and `cursor` takes the previous page’s `nextCursor`. Both are ENFORCED: a `limit` outside 1-200 or a non-numeric one is 400 `validation_failed`, never a quietly defaulted page (R8-05).",
        "responses": {
          "200": {
            "description": "One page of published agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceAgentDirectory"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a `limit` outside 1-200."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "example": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "description": "Page size, 1-200 (default 100)."
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string"
            },
            "description": "The previous page’s `nextCursor` — `<ISO-8601 timestamp>|<row id>` (a bare timestamp is still accepted). Anything else is 400 `validation_failed`."
          }
        ]
      }
    },
    "/workspace/document-discussions": {
      "get": {
        "operationId": "listWorkspaceDocumentDiscussions",
        "summary": "Open discussions on followed documents or mentions",
        "tags": ["Documents"],
        "responses": {
          "200": {
            "description": "Accessible open discussions.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "sessionId": {
                            "type": "string"
                          },
                          "artifactId": {
                            "type": "string"
                          },
                          "threadId": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "body": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "_id",
                          "sessionId",
                          "artifactId",
                          "threadId",
                          "title",
                          "body",
                          "createdAt"
                        ]
                      }
                    },
                    "nextCursor": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["data", "nextCursor"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "after",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/artifacts/{artifactId}/review": {
      "get": {
        "operationId": "readWorkspaceDocumentReview",
        "summary": "Read document following and resolved discussions",
        "tags": ["Documents"],
        "responses": {
          "200": {
            "description": "Review state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "following": {
                          "type": "boolean"
                        },
                        "threads": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "resolvedAt": {
                                "type": ["string", "null"]
                              }
                            },
                            "required": ["id", "resolvedAt"]
                          }
                        }
                      },
                      "required": ["following", "threads"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "404": {
            "description": "No such session or artifact, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "artifactId",
            "required": true
          }
        ]
      },
      "post": {
        "operationId": "updateWorkspaceDocumentReview",
        "summary": "Follow a document or resolve a discussion",
        "tags": ["Documents"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "following": {
                    "type": "boolean"
                  },
                  "threadId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "resolved": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated review state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "following": {
                          "type": "boolean"
                        },
                        "threads": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "resolvedAt": {
                                "type": ["string", "null"]
                              }
                            },
                            "required": ["id", "resolvedAt"]
                          }
                        }
                      },
                      "required": ["following", "threads"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "No such session or artifact, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "artifactId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/artifacts/{artifactId}/content": {
      "get": {
        "operationId": "readWorkspaceDocument",
        "summary": "Read a markdown document",
        "tags": ["Documents"],
        "description": "The markdown behind a `text/markdown` artifact, at its current version — what the editor opens at `/documents/:artifactId`. `readOnly` is true for a caller who may read the session but not write it, so the editor can say so instead of failing a save. **Authorization:** the same gate as every session route — `work_session:read` (or `comment` to write) on the session, OR `space:contribute` on one of its linked spaces; a desk session only for its owner. Any denial is 404.",
        "responses": {
          "200": {
            "description": "The document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceDocumentContent"
                }
              }
            }
          },
          "404": {
            "description": "No such session or artifact, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`artifact_not_ready` — the bytes are not stored or parsed yet (retryable); `document_version_conflict` — a save whose `baseVersion` is behind the current version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`artifact_not_markdown` — the artifact is not a document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "artifactId",
            "required": true
          }
        ]
      },
      "put": {
        "operationId": "saveWorkspaceDocument",
        "summary": "Save a markdown document",
        "tags": ["Documents"],
        "description": "Writes new bytes and bumps the SAME artifact to the next version — `/documents/:id` keeps its address — and puts one `artifact` entry on the timeline carrying `summary`. Send `baseVersion` — the version you edited — and a save that would overwrite a newer one answers 409 `document_version_conflict` instead. Without a `summary` the platform generates `+N/−M lines` from the diff. **Authorization:** the same gate as every session route — `work_session:read` (or `comment` to write) on the session, OR `space:contribute` on one of its linked spaces; a desk session only for its owner. Any denial is 404.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveWorkspaceDocumentBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new version of the artifact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceDocumentArtifact"
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed` — a malformed body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such session or artifact, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`artifact_not_ready` — the bytes are not stored or parsed yet (retryable); `document_version_conflict` — a save whose `baseVersion` is behind the current version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`artifact_not_markdown` — the artifact is not a document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "artifactId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/artifacts/{artifactId}/file": {
      "get": {
        "operationId": "readWorkspaceArtifactFile",
        "summary": "Download an artifact",
        "tags": ["Documents"],
        "description": "The stored bytes of ANY artifact of this session, under their own content type — the composed PDF the Workspace viewer opens, the redlined `.docx` the export produced, the markdown itself. Nothing is minted: the response IS the file. **Authorization:** the same gate as every session route — `work_session:read` (or `comment` to write) on the session, OR `space:contribute` on one of its linked spaces; a desk session only for its owner. Any denial is 404.",
        "responses": {
          "200": {
            "description": "The artifact bytes.",
            "content": {
              "application/octet-stream": {}
            }
          },
          "404": {
            "description": "No such session or artifact, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`artifact_not_ready` — the bytes are not stored or parsed yet (retryable); `document_version_conflict` — a save whose `baseVersion` is behind the current version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "artifactId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/artifacts/{artifactId}/compose": {
      "post": {
        "operationId": "composeWorkspaceDocument",
        "summary": "Compose a document into a branded PDF",
        "tags": ["Documents"],
        "description": "Renders the markdown through a style profile and files the PDF back onto the session as its own artifact, beside the markdown it came from. `styleProfileId` picks a Brand profile, `configId` a `/v1` compose template; with neither, the org default profile is used, or the platform's plain layout when the org has none. **Authorization:** the same gate as every session route — `work_session:read` (or `comment` to write) on the session, OR `space:contribute` on one of its linked spaces; a desk session only for its owner. Any denial is 404.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeWorkspaceDocumentBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The composed PDF artifact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceDocumentArtifact"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "No such session or artifact, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`artifact_not_ready` — the bytes are not stored or parsed yet (retryable); `document_version_conflict` — a save whose `baseVersion` is behind the current version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`compose_target_ambiguous` — `configId` and `styleProfileId` together; `artifact_not_markdown` — the artifact is not a document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "artifactId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/artifacts/{artifactId}/preview": {
      "post": {
        "operationId": "previewWorkspaceDocument",
        "summary": "Preview a document as a PDF",
        "tags": ["Documents"],
        "description": "The same render as `compose`, streamed back as raw `application/pdf` bytes. It stores NOTHING: no file, no artifact, no timeline entry — the editor debounces this on every keystroke and a session must not fill up with drafts. **Authorization:** the same gate as every session route — `work_session:read` (or `comment` to write) on the session, OR `space:contribute` on one of its linked spaces; a desk session only for its owner. Any denial is 404.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewWorkspaceDocumentBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The rendered PDF.",
            "content": {
              "application/pdf": {}
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "No such session or artifact, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`artifact_not_ready` — the bytes are not stored or parsed yet (retryable); `document_version_conflict` — a save whose `baseVersion` is behind the current version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`artifact_not_markdown` — the artifact is not a document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "artifactId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/artifacts/{artifactId}/export": {
      "post": {
        "operationId": "exportWorkspaceDocument",
        "summary": "Export a document as a Word file with tracked changes",
        "tags": ["Documents"],
        "description": "Writes the difference between the ORIGINAL `.docx` this document was imported from and its current markdown into that Word file as tracked changes, and files the result as a `<name>.redlined.docx` artifact. Remaining CriticMarkup comments become Word comments. A document that was not imported from a Word file answers 409 `no_source_document`. **Authorization:** the same gate as every session route — `work_session:read` (or `comment` to write) on the session, OR `space:contribute` on one of its linked spaces; a desk session only for its owner. Any denial is 404.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExportWorkspaceDocumentBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The redlined Word artifact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceDocumentArtifact"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "No such session or artifact, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`no_source_document` — the document came from no Word file; `artifact_not_ready`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`redline_anchor_not_found` — the original no longer contains a paragraph the diff edits; nothing was written.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "artifactId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/documents": {
      "post": {
        "operationId": "importWorkspaceDocument",
        "summary": "Turn a parsed file into a session document",
        "tags": ["Documents"],
        "description": "Takes a `.docx` or PDF the session can read and files its parsed markdown as a `text/markdown` artifact — the working form every agent and the editor share. Word comments arrive as CriticMarkup (`{>> @author: … <<}`). While the file is still being parsed this answers 409 `artifact_not_ready`; retry. **Authorization:** the same gate as every session route — `work_session:read` (or `comment` to write) on the session, OR `space:contribute` on one of its linked spaces; a desk session only for its owner. Any denial is 404.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportWorkspaceDocumentBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The markdown artifact.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceDocumentArtifact"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "No such session or file for the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`artifact_not_ready` — the file is still being parsed (retryable).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/browser": {
      "get": {
        "operationId": "getWorkspaceBrowser",
        "tags": ["Workspace Sessions"],
        "summary": "Get this turn’s browser",
        "responses": {
          "200": {
            "description": "Safe browser state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/browser/screenshot": {
      "get": {
        "operationId": "getWorkspaceBrowserScreenshot",
        "tags": ["Workspace Sessions"],
        "summary": "Get a live browser frame",
        "responses": {
          "200": {
            "description": "Ephemeral JPEG frame."
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/browser/takeover": {
      "post": {
        "operationId": "workspaceBrowsertakeover",
        "tags": ["Workspace Sessions"],
        "summary": "takeover this turn’s browser",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["controlGeneration"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Safe browser state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "JSON required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/browser/input": {
      "post": {
        "operationId": "workspaceBrowserinput",
        "tags": ["Workspace Sessions"],
        "summary": "input this turn’s browser",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "callId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "input": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "click"
                          },
                          "x": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 10000
                          },
                          "y": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 10000
                          }
                        },
                        "required": ["type", "x", "y"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "text"
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 8192
                          }
                        },
                        "required": ["type", "text"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "key"
                          },
                          "key": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          }
                        },
                        "required": ["type", "key"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "scroll"
                          },
                          "deltaX": {
                            "type": "number",
                            "minimum": -10000,
                            "maximum": 10000
                          },
                          "deltaY": {
                            "type": "number",
                            "minimum": -10000,
                            "maximum": 10000
                          }
                        },
                        "required": ["type", "deltaX", "deltaY"],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": ["controlGeneration", "callId", "input"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Safe browser state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "JSON required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/browser/handback": {
      "post": {
        "operationId": "workspaceBrowserhandback",
        "tags": ["Workspace Sessions"],
        "summary": "handback this turn’s browser",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "handoffId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  }
                },
                "required": ["controlGeneration", "handoffId"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Safe browser state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "JSON required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/browser/close": {
      "post": {
        "operationId": "workspaceBrowserclose",
        "tags": ["Workspace Sessions"],
        "summary": "close this turn’s browser",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["controlGeneration"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Safe browser state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "JSON required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/browser/forget": {
      "post": {
        "operationId": "workspaceBrowserforget",
        "tags": ["Workspace Sessions"],
        "summary": "forget this turn’s browser",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["controlGeneration"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Safe browser state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "JSON required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/turns/{turnId}/browser/connect-site": {
      "post": {
        "operationId": "workspaceBrowserconnect-site",
        "tags": ["Workspace Sessions"],
        "summary": "connect-site this turn’s browser",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "controlGeneration": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "policy": {
                    "type": "object",
                    "properties": {
                      "allowedDomains": {
                        "minItems": 1,
                        "maxItems": 30,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 253,
                          "pattern": "^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z]{2,63}$"
                        }
                      },
                      "persist": {
                        "type": "boolean"
                      }
                    },
                    "required": ["allowedDomains", "persist"],
                    "additionalProperties": false
                  }
                },
                "required": ["controlGeneration", "policy"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Safe browser state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "viewport": {
                              "type": "object",
                              "properties": {
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                },
                                "height": {
                                  "type": "number",
                                  "exclusiveMinimum": 0
                                }
                              },
                              "required": ["width", "height"]
                            },
                            "browserId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "starting",
                                "agent_active",
                                "handoff_requested",
                                "human_active",
                                "returning",
                                "closing",
                                "closed",
                                "expired",
                                "failed"
                              ]
                            },
                            "generation": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "controlGeneration": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "sessionId": {
                              "type": "string"
                            },
                            "turnId": {
                              "type": "string"
                            },
                            "agentId": {
                              "type": "string"
                            },
                            "visibility": {
                              "type": "string",
                              "enum": ["private", "shared"]
                            },
                            "url": {
                              "type": ["string", "null"]
                            },
                            "title": {
                              "type": ["string", "null"]
                            },
                            "updatedAt": {
                              "type": "number"
                            },
                            "expiresAt": {
                              "type": "number"
                            },
                            "handoffId": {
                              "type": ["string", "null"]
                            },
                            "handoffReason": {
                              "type": ["string", "null"]
                            },
                            "controllerUserId": {
                              "type": ["string", "null"]
                            },
                            "screenshotAvailable": {
                              "type": "boolean"
                            },
                            "savedLogins": {
                              "type": "boolean"
                            },
                            "allowedDomains": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "error": {
                              "type": ["string", "null"]
                            }
                          },
                          "required": [
                            "viewport",
                            "browserId",
                            "status",
                            "generation",
                            "controlGeneration",
                            "sessionId",
                            "turnId",
                            "agentId",
                            "visibility",
                            "url",
                            "title",
                            "updatedAt",
                            "expiresAt",
                            "handoffId",
                            "handoffReason",
                            "controllerUserId",
                            "screenshotAvailable",
                            "savedLogins",
                            "allowedDomains",
                            "error"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "browserQuestionId": {
                      "type": ["string", "null"]
                    },
                    "successorTurnId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "required": ["data", "browserQuestionId"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No authorized browser.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Browser control changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "JSON required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "Browser temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "turnId",
            "required": true
          }
        ]
      }
    },
    "/workspace/sessions/{sessionId}/artifacts/{artifactId}/discussion": {
      "post": {
        "operationId": "openWorkspaceDocumentDiscussion",
        "summary": "Open a discussion anchored to this document",
        "tags": ["Documents"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "requestId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "anchor": {
                    "type": "object",
                    "properties": {
                      "from": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "to": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "quote": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      }
                    },
                    "required": ["from", "to"],
                    "additionalProperties": false
                  }
                },
                "required": ["requestId"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The document discussion thread id. Retrying the same request reuses it."
          },
          "400": {
            "description": "Invalid request id or anchor range."
          },
          "403": {
            "description": "The caller must be a human participant."
          },
          "404": {
            "description": "The session or document is unavailable to this caller."
          },
          "409": {
            "description": "The anchor no longer matches the document."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "sessionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "artifactId",
            "required": true
          }
        ]
      }
    },
    "/meeting-notes/templates": {
      "get": {
        "operationId": "listMeetingTemplates",
        "tags": ["Meeting notes"],
        "summary": "listMeetingTemplates",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/meeting-notes/templates/{templateId}": {
      "put": {
        "operationId": "putMeetingTemplate",
        "tags": ["Meeting notes"],
        "summary": "putMeetingTemplate",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16000
                  }
                },
                "required": ["name", "prompt"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "templateId",
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9-]{1,100}$"
            },
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteMeetingTemplate",
        "tags": ["Meeting notes"],
        "summary": "deleteMeetingTemplate",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "templateId",
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9-]{1,100}$"
            },
            "required": true
          }
        ]
      }
    },
    "/meeting-notes": {
      "get": {
        "operationId": "listMeetingNotes",
        "tags": ["Meeting notes"],
        "summary": "listMeetingNotes",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ]
      },
      "post": {
        "operationId": "createMeetingNote",
        "tags": ["Meeting notes"],
        "summary": "createMeetingNote",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^mnt_[a-zA-Z0-9-]{16,64}$"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": ["id", "title"]
              }
            }
          }
        }
      }
    },
    "/meeting-notes/{noteId}": {
      "get": {
        "operationId": "getMeetingNote",
        "tags": ["Meeting notes"],
        "summary": "getMeetingNote",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "noteId",
            "schema": {
              "type": "string",
              "pattern": "^mnt_[a-zA-Z0-9-]{16,64}$"
            },
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateMeetingNote",
        "tags": ["Meeting notes"],
        "summary": "updateMeetingNote",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "noteId",
            "schema": {
              "type": "string",
              "pattern": "^mnt_[a-zA-Z0-9-]{16,64}$"
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "revision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "thoughts": {
                    "type": "string",
                    "maxLength": 100000
                  },
                  "speakerNames": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "additionalProperties": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    }
                  }
                },
                "required": ["revision", "title", "thoughts"]
              }
            }
          }
        }
      }
    },
    "/meeting-notes/{noteId}/process": {
      "post": {
        "operationId": "processMeetingNote",
        "tags": ["Meeting notes"],
        "summary": "processMeetingNote",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "requestId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "operation": {
                    "type": "string",
                    "enum": ["finish", "cleanup", "summary"]
                  },
                  "audioFileId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "durationMs": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 86400000
                  },
                  "localTranscript": {
                    "type": "string",
                    "maxLength": 400000
                  },
                  "templateId": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "generateSummary": {
                    "type": "boolean"
                  }
                },
                "required": ["requestId", "revision", "operation"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "noteId",
            "schema": {
              "type": "string",
              "pattern": "^mnt_[a-zA-Z0-9-]{16,64}$"
            },
            "required": true
          }
        ]
      }
    },
    "/meeting-notes/{noteId}/ask": {
      "post": {
        "operationId": "askMeetingNote",
        "tags": ["Meeting notes"],
        "summary": "askMeetingNote",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "noteId",
            "schema": {
              "type": "string",
              "pattern": "^mnt_[a-zA-Z0-9-]{16,64}$"
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "question": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  },
                  "liveTranscript": {
                    "type": "string",
                    "maxLength": 400000
                  },
                  "thoughts": {
                    "type": "string",
                    "maxLength": 100000
                  }
                },
                "required": ["question"]
              }
            }
          }
        }
      }
    },
    "/meeting-notes/{noteId}/trigger": {
      "post": {
        "operationId": "runMeetingTrigger",
        "tags": ["Meeting notes"],
        "summary": "runMeetingTrigger",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "noteId",
            "schema": {
              "type": "string",
              "pattern": "^mnt_[a-zA-Z0-9-]{16,64}$"
            },
            "required": true
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "triggerId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^trg_[a-zA-Z0-9_-]+$"
                  },
                  "requestId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": ["triggerId", "requestId"]
              }
            }
          }
        }
      }
    },
    "/meeting-notes/{noteId}/live": {
      "post": {
        "operationId": "startMeetingLiveTranscript",
        "tags": ["Meeting notes"],
        "summary": "startMeetingLiveTranscript",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "noteId",
            "schema": {
              "type": "string",
              "pattern": "^mnt_[a-zA-Z0-9-]{16,64}$"
            },
            "required": true
          }
        ]
      }
    },
    "/meeting-notes/{noteId}/live/{liveId}/tickets": {
      "post": {
        "operationId": "createMeetingLiveTicket",
        "tags": ["Meeting notes"],
        "summary": "createMeetingLiveTicket",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "noteId",
            "schema": {
              "type": "string",
              "pattern": "^mnt_[a-zA-Z0-9-]{16,64}$"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "liveId",
            "schema": {
              "type": "string",
              "pattern": "^rtt_[0-9A-HJKMNP-TV-Z]{26}$"
            },
            "required": true
          }
        ]
      }
    },
    "/meeting-notes/{noteId}/live/{liveId}/stop": {
      "post": {
        "operationId": "stopMeetingLiveTranscript",
        "tags": ["Meeting notes"],
        "summary": "stopMeetingLiveTranscript",
        "description": "Personal meeting notes require the owning member. Organization template changes require an administrator.",
        "responses": {
          "200": {
            "description": "Meeting note response."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "403": {
            "description": "Member access required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The note changed. Refresh and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Invalid meeting input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "noteId",
            "schema": {
              "type": "string",
              "pattern": "^mnt_[a-zA-Z0-9-]{16,64}$"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "liveId",
            "schema": {
              "type": "string",
              "pattern": "^rtt_[0-9A-HJKMNP-TV-Z]{26}$"
            },
            "required": true
          }
        ]
      }
    },
    "/triggers": {
      "get": {
        "operationId": "listTriggers",
        "summary": "List visible triggers",
        "tags": ["Workspace Triggers"],
        "responses": {
          "200": {
            "description": "One page of triggers.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80
                          },
                          "enabled": {
                            "default": true,
                            "type": "boolean"
                          },
                          "when": {
                            "anyOf": [
                              {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "schedule"
                                      },
                                      "schedule": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "cron"
                                              },
                                              "expression": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 200
                                              },
                                              "timezone": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 100
                                              }
                                            },
                                            "required": ["kind", "expression", "timezone"],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "once"
                                              },
                                              "at": {
                                                "type": "string",
                                                "format": "date-time",
                                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                              }
                                            },
                                            "required": ["kind", "at"],
                                            "additionalProperties": false
                                          }
                                        ]
                                      }
                                    },
                                    "required": ["kind", "schedule"],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "email"
                                      },
                                      "address": {
                                        "type": "string",
                                        "maxLength": 254,
                                        "format": "email",
                                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                                      },
                                      "from": {
                                        "maxItems": 50,
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "format": "email",
                                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                                        }
                                      }
                                    },
                                    "required": ["kind", "address"],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "webhook"
                                      },
                                      "slug": {
                                        "type": "string",
                                        "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
                                      }
                                    },
                                    "required": ["kind", "slug"],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "manual"
                                      }
                                    },
                                    "required": ["kind"],
                                    "additionalProperties": false
                                  }
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "webhook"
                                  },
                                  "slug": {
                                    "type": "string"
                                  },
                                  "secretPreview": {
                                    "type": "string"
                                  }
                                },
                                "required": ["kind", "slug", "secretPreview"]
                              }
                            ]
                          },
                          "open": {
                            "type": "object",
                            "properties": {
                              "agentIds": {
                                "maxItems": 20,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                }
                              },
                              "spaces": {
                                "maxItems": 20,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "spaceId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 128
                                    },
                                    "access": {
                                      "type": "string",
                                      "enum": ["read", "commit"]
                                    }
                                  },
                                  "required": ["spaceId", "access"],
                                  "additionalProperties": false
                                }
                              },
                              "instruction": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 4000
                              },
                              "threadPolicy": {
                                "type": "string",
                                "enum": ["new", "reuse"]
                              },
                              "title": {
                                "type": "string",
                                "maxLength": 200
                              },
                              "filesFrom": {
                                "type": "string",
                                "enum": ["payload", "none"]
                              }
                            },
                            "required": [
                              "agentIds",
                              "spaces",
                              "instruction",
                              "threadPolicy",
                              "filesFrom"
                            ],
                            "additionalProperties": false
                          },
                          "permissions": {
                            "type": "object",
                            "properties": {
                              "runAsUserId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "required": ["runAsUserId"],
                            "additionalProperties": false
                          },
                          "id": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^trg_[A-Za-z0-9_-]+$"
                          },
                          "lastRun": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string",
                                "enum": ["opened", "busy", "needs_input", "blocked", "error"]
                              },
                              "sessionId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              },
                              "message": {
                                "type": "string",
                                "maxLength": 1000
                              },
                              "at": {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              }
                            },
                            "required": ["status", "at"]
                          },
                          "nextRunAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "triggerRef": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "legacy": {
                            "type": "object",
                            "properties": {
                              "channelId": {
                                "type": "string"
                              },
                              "channelType": {
                                "type": "string",
                                "enum": ["email", "webhook"]
                              },
                              "automationId": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "required": [
                          "name",
                          "when",
                          "open",
                          "permissions",
                          "id",
                          "nextRunAt",
                          "triggerRef",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["data", "nextCursor"]
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed`: a request parameter or body field is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ]
      },
      "post": {
        "operationId": "createTrigger",
        "summary": "Create a trigger",
        "tags": ["Workspace Triggers"],
        "responses": {
          "201": {
            "description": "The trigger and its one-time secret.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "enabled": {
                          "default": true,
                          "type": "boolean"
                        },
                        "when": {
                          "anyOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "schedule"
                                    },
                                    "schedule": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "cron"
                                            },
                                            "expression": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200
                                            },
                                            "timezone": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 100
                                            }
                                          },
                                          "required": ["kind", "expression", "timezone"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "once"
                                            },
                                            "at": {
                                              "type": "string",
                                              "format": "date-time",
                                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                            }
                                          },
                                          "required": ["kind", "at"],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  },
                                  "required": ["kind", "schedule"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "email"
                                    },
                                    "address": {
                                      "type": "string",
                                      "maxLength": 254,
                                      "format": "email",
                                      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                                    },
                                    "from": {
                                      "maxItems": 50,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "format": "email",
                                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                                      }
                                    }
                                  },
                                  "required": ["kind", "address"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "webhook"
                                    },
                                    "slug": {
                                      "type": "string",
                                      "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
                                    }
                                  },
                                  "required": ["kind", "slug"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "manual"
                                    }
                                  },
                                  "required": ["kind"],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "slug": {
                                  "type": "string"
                                },
                                "secretPreview": {
                                  "type": "string"
                                }
                              },
                              "required": ["kind", "slug", "secretPreview"]
                            }
                          ]
                        },
                        "open": {
                          "type": "object",
                          "properties": {
                            "agentIds": {
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "spaces": {
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "spaceId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  },
                                  "access": {
                                    "type": "string",
                                    "enum": ["read", "commit"]
                                  }
                                },
                                "required": ["spaceId", "access"],
                                "additionalProperties": false
                              }
                            },
                            "instruction": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 4000
                            },
                            "threadPolicy": {
                              "type": "string",
                              "enum": ["new", "reuse"]
                            },
                            "title": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "filesFrom": {
                              "type": "string",
                              "enum": ["payload", "none"]
                            }
                          },
                          "required": [
                            "agentIds",
                            "spaces",
                            "instruction",
                            "threadPolicy",
                            "filesFrom"
                          ],
                          "additionalProperties": false
                        },
                        "permissions": {
                          "type": "object",
                          "properties": {
                            "runAsUserId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          "required": ["runAsUserId"],
                          "additionalProperties": false
                        },
                        "id": {
                          "type": "string",
                          "maxLength": 128,
                          "pattern": "^trg_[A-Za-z0-9_-]+$"
                        },
                        "lastRun": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": ["opened", "busy", "needs_input", "blocked", "error"]
                            },
                            "sessionId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "message": {
                              "type": "string",
                              "maxLength": 1000
                            },
                            "at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": ["status", "at"]
                        },
                        "nextRunAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "triggerRef": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        "legacy": {
                          "type": "object",
                          "properties": {
                            "channelId": {
                              "type": "string"
                            },
                            "channelType": {
                              "type": "string",
                              "enum": ["email", "webhook"]
                            },
                            "automationId": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "name",
                        "when",
                        "open",
                        "permissions",
                        "id",
                        "nextRunAt",
                        "triggerRef",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    "secret": {
                      "type": "string"
                    }
                  },
                  "required": ["data", "secret"]
                }
              }
            }
          },
          "400": {
            "description": "`invalid_trigger` — the email address does not belong to this organization and environment; `invalid_schedule` — the schedule is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "`run_as_inactive` — the executing member is not active in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`space_not_found` — a named space does not exist or the executing member may not contribute to it; `agent_not_found` — a named agent does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`trigger_conflict` — that webhook address or email address is already used in this organization, or a channel key rotation is unsettled; `trigger_limit` — 50 enabled triggers is the maximum; `trigger_migration_in_progress` — a legacy transfer still owns this source.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`agent_not_published` — a named agent has no published version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "enabled": {
                    "default": true,
                    "type": "boolean"
                  },
                  "when": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "schedule"
                          },
                          "schedule": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "cron"
                                  },
                                  "expression": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200
                                  },
                                  "timezone": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 100
                                  }
                                },
                                "required": ["kind", "expression", "timezone"],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "once"
                                  },
                                  "at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                  }
                                },
                                "required": ["kind", "at"],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": ["kind", "schedule"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "email"
                          },
                          "address": {
                            "type": "string",
                            "maxLength": 254,
                            "format": "email",
                            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                          },
                          "from": {
                            "maxItems": 50,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "format": "email",
                              "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                            }
                          }
                        },
                        "required": ["kind", "address"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "webhook"
                          },
                          "slug": {
                            "type": "string",
                            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
                          }
                        },
                        "required": ["kind", "slug"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "manual"
                          }
                        },
                        "required": ["kind"],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "open": {
                    "type": "object",
                    "properties": {
                      "agentIds": {
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        }
                      },
                      "spaces": {
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "spaceId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "access": {
                              "type": "string",
                              "enum": ["read", "commit"]
                            }
                          },
                          "required": ["spaceId", "access"],
                          "additionalProperties": false
                        }
                      },
                      "instruction": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 4000
                      },
                      "threadPolicy": {
                        "type": "string",
                        "enum": ["new", "reuse"]
                      },
                      "title": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "filesFrom": {
                        "type": "string",
                        "enum": ["payload", "none"]
                      }
                    },
                    "required": ["agentIds", "spaces", "instruction", "threadPolicy", "filesFrom"],
                    "additionalProperties": false
                  },
                  "permissions": {
                    "type": "object",
                    "properties": {
                      "runAsUserId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": ["runAsUserId"],
                    "additionalProperties": false
                  }
                },
                "required": ["name", "when", "open", "permissions"],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/triggers/options": {
      "get": {
        "operationId": "getTriggerOptions",
        "summary": "List eligible trigger spaces",
        "tags": ["Workspace Triggers"],
        "responses": {
          "200": {
            "description": "Trigger options.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "emailDomain": {
                          "type": "string"
                        },
                        "spaces": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              }
                            },
                            "required": ["id", "title"]
                          }
                        }
                      },
                      "required": ["emailDomain", "spaces"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed`: a request parameter or body field is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "`run_as_inactive` — the executing member is not active in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "`trigger_configuration_unavailable` — trigger intake is not configured yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "runAsUserId",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "required": true
          }
        ]
      }
    },
    "/triggers/legacy-channels": {
      "get": {
        "operationId": "listLegacyChannels",
        "summary": "List the legacy channels of this organization",
        "description": "One keyset page of the surviving `channels` rows. Each row names the outcome it reached: `triggerId` once it became a trigger, `refusal` once it was archived instead, neither while it is still waiting. `limit` is 1-50 (default 25), `cursor` takes the previous response's `nextCursor`, and `status` narrows to `active` or `archived`.",
        "tags": ["Workspace Triggers"],
        "responses": {
          "200": {
            "description": "The producer page, proxied unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "channelId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "name": {
                                "type": "string"
                              },
                              "slug": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "address": {
                                "type": "string"
                              },
                              "createdAt": {
                                "type": "string"
                              },
                              "archivedAt": {
                                "nullable": true,
                                "type": "string"
                              },
                              "triggerId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^trg_[A-Za-z0-9_-]+$"
                              },
                              "refusal": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "channelId",
                              "name",
                              "slug",
                              "type",
                              "status",
                              "address",
                              "createdAt",
                              "archivedAt"
                            ]
                          }
                        },
                        "nextCursor": {
                          "nullable": true,
                          "type": "string"
                        }
                      },
                      "required": ["rows", "nextCursor"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed`: a query parameter is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` — organization administrators only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": ["active", "archived", "all"]
            }
          }
        ]
      }
    },
    "/triggers/{triggerId}": {
      "get": {
        "operationId": "getTrigger",
        "summary": "Read a trigger",
        "tags": ["Workspace Triggers"],
        "responses": {
          "200": {
            "description": "The trigger.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "enabled": {
                          "default": true,
                          "type": "boolean"
                        },
                        "when": {
                          "anyOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "schedule"
                                    },
                                    "schedule": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "cron"
                                            },
                                            "expression": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200
                                            },
                                            "timezone": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 100
                                            }
                                          },
                                          "required": ["kind", "expression", "timezone"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "once"
                                            },
                                            "at": {
                                              "type": "string",
                                              "format": "date-time",
                                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                            }
                                          },
                                          "required": ["kind", "at"],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  },
                                  "required": ["kind", "schedule"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "email"
                                    },
                                    "address": {
                                      "type": "string",
                                      "maxLength": 254,
                                      "format": "email",
                                      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                                    },
                                    "from": {
                                      "maxItems": 50,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "format": "email",
                                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                                      }
                                    }
                                  },
                                  "required": ["kind", "address"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "webhook"
                                    },
                                    "slug": {
                                      "type": "string",
                                      "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
                                    }
                                  },
                                  "required": ["kind", "slug"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "manual"
                                    }
                                  },
                                  "required": ["kind"],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "slug": {
                                  "type": "string"
                                },
                                "secretPreview": {
                                  "type": "string"
                                }
                              },
                              "required": ["kind", "slug", "secretPreview"]
                            }
                          ]
                        },
                        "open": {
                          "type": "object",
                          "properties": {
                            "agentIds": {
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "spaces": {
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "spaceId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  },
                                  "access": {
                                    "type": "string",
                                    "enum": ["read", "commit"]
                                  }
                                },
                                "required": ["spaceId", "access"],
                                "additionalProperties": false
                              }
                            },
                            "instruction": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 4000
                            },
                            "threadPolicy": {
                              "type": "string",
                              "enum": ["new", "reuse"]
                            },
                            "title": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "filesFrom": {
                              "type": "string",
                              "enum": ["payload", "none"]
                            }
                          },
                          "required": [
                            "agentIds",
                            "spaces",
                            "instruction",
                            "threadPolicy",
                            "filesFrom"
                          ],
                          "additionalProperties": false
                        },
                        "permissions": {
                          "type": "object",
                          "properties": {
                            "runAsUserId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          "required": ["runAsUserId"],
                          "additionalProperties": false
                        },
                        "id": {
                          "type": "string",
                          "maxLength": 128,
                          "pattern": "^trg_[A-Za-z0-9_-]+$"
                        },
                        "lastRun": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": ["opened", "busy", "needs_input", "blocked", "error"]
                            },
                            "sessionId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "message": {
                              "type": "string",
                              "maxLength": 1000
                            },
                            "at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": ["status", "at"]
                        },
                        "nextRunAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "triggerRef": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        "legacy": {
                          "type": "object",
                          "properties": {
                            "channelId": {
                              "type": "string"
                            },
                            "channelType": {
                              "type": "string",
                              "enum": ["email", "webhook"]
                            },
                            "automationId": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "name",
                        "when",
                        "open",
                        "permissions",
                        "id",
                        "nextRunAt",
                        "triggerRef",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed`: a request parameter or body field is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — No such trigger, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "triggerId",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^trg_[A-Za-z0-9_-]+$"
            },
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateTrigger",
        "summary": "Update a trigger",
        "tags": ["Workspace Triggers"],
        "responses": {
          "200": {
            "description": "The updated trigger.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "enabled": {
                          "default": true,
                          "type": "boolean"
                        },
                        "when": {
                          "anyOf": [
                            {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "schedule"
                                    },
                                    "schedule": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "cron"
                                            },
                                            "expression": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200
                                            },
                                            "timezone": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 100
                                            }
                                          },
                                          "required": ["kind", "expression", "timezone"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "once"
                                            },
                                            "at": {
                                              "type": "string",
                                              "format": "date-time",
                                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                            }
                                          },
                                          "required": ["kind", "at"],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  },
                                  "required": ["kind", "schedule"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "email"
                                    },
                                    "address": {
                                      "type": "string",
                                      "maxLength": 254,
                                      "format": "email",
                                      "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                                    },
                                    "from": {
                                      "maxItems": 50,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "format": "email",
                                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                                      }
                                    }
                                  },
                                  "required": ["kind", "address"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "webhook"
                                    },
                                    "slug": {
                                      "type": "string",
                                      "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
                                    }
                                  },
                                  "required": ["kind", "slug"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "manual"
                                    }
                                  },
                                  "required": ["kind"],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "webhook"
                                },
                                "slug": {
                                  "type": "string"
                                },
                                "secretPreview": {
                                  "type": "string"
                                }
                              },
                              "required": ["kind", "slug", "secretPreview"]
                            }
                          ]
                        },
                        "open": {
                          "type": "object",
                          "properties": {
                            "agentIds": {
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 128
                              }
                            },
                            "spaces": {
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "spaceId": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  },
                                  "access": {
                                    "type": "string",
                                    "enum": ["read", "commit"]
                                  }
                                },
                                "required": ["spaceId", "access"],
                                "additionalProperties": false
                              }
                            },
                            "instruction": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 4000
                            },
                            "threadPolicy": {
                              "type": "string",
                              "enum": ["new", "reuse"]
                            },
                            "title": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "filesFrom": {
                              "type": "string",
                              "enum": ["payload", "none"]
                            }
                          },
                          "required": [
                            "agentIds",
                            "spaces",
                            "instruction",
                            "threadPolicy",
                            "filesFrom"
                          ],
                          "additionalProperties": false
                        },
                        "permissions": {
                          "type": "object",
                          "properties": {
                            "runAsUserId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            }
                          },
                          "required": ["runAsUserId"],
                          "additionalProperties": false
                        },
                        "id": {
                          "type": "string",
                          "maxLength": 128,
                          "pattern": "^trg_[A-Za-z0-9_-]+$"
                        },
                        "lastRun": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": ["opened", "busy", "needs_input", "blocked", "error"]
                            },
                            "sessionId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "message": {
                              "type": "string",
                              "maxLength": 1000
                            },
                            "at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": ["status", "at"]
                        },
                        "nextRunAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "triggerRef": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        "legacy": {
                          "type": "object",
                          "properties": {
                            "channelId": {
                              "type": "string"
                            },
                            "channelType": {
                              "type": "string",
                              "enum": ["email", "webhook"]
                            },
                            "automationId": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": [
                        "name",
                        "when",
                        "open",
                        "permissions",
                        "id",
                        "nextRunAt",
                        "triggerRef",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "`invalid_trigger` — the email address does not belong to this organization and environment; `invalid_schedule` — the schedule is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "`run_as_inactive` — the executing member is not active in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`space_not_found` — a named space does not exist or the executing member may not contribute to it; `agent_not_found` — a named agent does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`trigger_conflict` — that webhook address or email address is already used in this organization, or a channel key rotation is unsettled; `trigger_limit` — 50 enabled triggers is the maximum; `trigger_migration_in_progress` — a legacy transfer still owns this source.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`agent_not_published` — a named agent has no published version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "when": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "schedule"
                          },
                          "schedule": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "cron"
                                  },
                                  "expression": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200
                                  },
                                  "timezone": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 100
                                  }
                                },
                                "required": ["kind", "expression", "timezone"],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "once"
                                  },
                                  "at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                  }
                                },
                                "required": ["kind", "at"],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": ["kind", "schedule"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "email"
                          },
                          "address": {
                            "type": "string",
                            "maxLength": 254,
                            "format": "email",
                            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                          },
                          "from": {
                            "maxItems": 50,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "format": "email",
                              "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                            }
                          }
                        },
                        "required": ["kind", "address"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "webhook"
                          },
                          "slug": {
                            "type": "string",
                            "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
                          }
                        },
                        "required": ["kind", "slug"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "manual"
                          }
                        },
                        "required": ["kind"],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "open": {
                    "type": "object",
                    "properties": {
                      "agentIds": {
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        }
                      },
                      "spaces": {
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "spaceId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 128
                            },
                            "access": {
                              "type": "string",
                              "enum": ["read", "commit"]
                            }
                          },
                          "required": ["spaceId", "access"],
                          "additionalProperties": false
                        }
                      },
                      "instruction": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 4000
                      },
                      "threadPolicy": {
                        "type": "string",
                        "enum": ["new", "reuse"]
                      },
                      "title": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "filesFrom": {
                        "type": "string",
                        "enum": ["payload", "none"]
                      }
                    },
                    "required": ["agentIds", "spaces", "instruction", "threadPolicy", "filesFrom"],
                    "additionalProperties": false
                  },
                  "permissions": {
                    "type": "object",
                    "properties": {
                      "runAsUserId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      }
                    },
                    "required": ["runAsUserId"],
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "triggerId",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^trg_[A-Za-z0-9_-]+$"
            },
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteTrigger",
        "summary": "Delete a trigger",
        "tags": ["Workspace Triggers"],
        "responses": {
          "204": {
            "description": "The trigger was deleted."
          },
          "400": {
            "description": "`validation_failed`: a request parameter or body field is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — No such trigger, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`trigger_conflict` — that webhook address or email address is already used in this organization, or a channel key rotation is unsettled; `trigger_limit` — 50 enabled triggers is the maximum; `trigger_migration_in_progress` — a legacy transfer still owns this source.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "triggerId",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^trg_[A-Za-z0-9_-]+$"
            },
            "required": true
          }
        ]
      }
    },
    "/triggers/{triggerId}/rotate-secret": {
      "post": {
        "operationId": "rotateTriggerSecret",
        "summary": "Rotate a trigger secret",
        "tags": ["Workspace Triggers"],
        "responses": {
          "200": {
            "description": "The one-time replacement secret.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "secret": {
                          "type": "string"
                        },
                        "secretPreview": {
                          "type": "string"
                        }
                      },
                      "required": ["secret", "secretPreview"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed`: a request parameter or body field is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — No such trigger, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`trigger_conflict` — that webhook address or email address is already used in this organization, or a channel key rotation is unsettled; `trigger_limit` — 50 enabled triggers is the maximum; `trigger_migration_in_progress` — a legacy transfer still owns this source.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "requestId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": ["requestId"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "triggerId",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^trg_[A-Za-z0-9_-]+$"
            },
            "required": true
          }
        ]
      }
    },
    "/triggers/{triggerId}/runs": {
      "get": {
        "operationId": "listTriggerRuns",
        "summary": "Read trigger history",
        "tags": ["Workspace Triggers"],
        "responses": {
          "200": {
            "description": "One page of trigger runs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "status": {
                            "type": "string",
                            "enum": ["opened", "busy", "needs_input", "blocked", "error"]
                          },
                          "sessionId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          },
                          "message": {
                            "type": "string",
                            "maxLength": 1000
                          },
                          "id": {
                            "type": "string"
                          },
                          "triggerId": {
                            "type": "string",
                            "maxLength": 128,
                            "pattern": "^trg_[A-Za-z0-9_-]+$"
                          },
                          "kind": {
                            "type": "string",
                            "enum": ["schedule", "webhook", "email", "manual"]
                          },
                          "receivedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "completedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "status",
                          "id",
                          "triggerId",
                          "kind",
                          "receivedAt",
                          "completedAt"
                        ]
                      }
                    },
                    "nextCursor": {
                      "type": ["string", "null"]
                    }
                  },
                  "required": ["data", "nextCursor"]
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed`: a request parameter or body field is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — No such trigger, or the caller may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "triggerId",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^trg_[A-Za-z0-9_-]+$"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ]
      }
    },
    "/triggers/{triggerId}/fire": {
      "post": {
        "operationId": "fireTrigger",
        "summary": "Run a trigger",
        "tags": ["Workspace Triggers"],
        "responses": {
          "200": {
            "description": "The existing delivery outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["queued", "opened", "busy", "needs_input", "blocked", "error"]
                        },
                        "sessionId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        },
                        "message": {
                          "type": "string",
                          "maxLength": 1000
                        },
                        "deliveryId": {
                          "type": "string"
                        }
                      },
                      "required": ["status", "deliveryId"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "202": {
            "description": "The queued delivery.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["queued", "opened", "busy", "needs_input", "blocked", "error"]
                        },
                        "sessionId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        },
                        "message": {
                          "type": "string",
                          "maxLength": 1000
                        },
                        "deliveryId": {
                          "type": "string"
                        }
                      },
                      "required": ["status", "deliveryId"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed`: a request parameter or body field is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "`credits_exhausted` — the organization has no run credit left.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "`run_as_inactive` — the executing member is not active in this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`space_not_found` — a named space does not exist or the executing member may not contribute to it; `agent_not_found` — a named agent does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`trigger_conflict` — that webhook address or email address is already used in this organization, or a channel key rotation is unsettled; `trigger_limit` — 50 enabled triggers is the maximum; `trigger_migration_in_progress` — a legacy transfer still owns this source.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`agent_not_published` — a named agent has no published version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "requestId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "input": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": ["requestId"],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "triggerId",
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^trg_[A-Za-z0-9_-]+$"
            },
            "required": true
          }
        ]
      }
    },
    "/triggers/legacy-handoff": {
      "post": {
        "operationId": "markLegacyAutomationHandoff",
        "summary": "Record the deployed revision that holds legacy ownership",
        "description": "Stores the readiness record a real (non-dry-run) automation transfer requires: the deployed 40-character revision plus one settled fire claim and one settled write claim observed against it.",
        "tags": ["Workspace Triggers"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "gatewayRevision": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{40}$"
                  },
                  "verifiedClaimId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^tlc_[A-Za-z0-9_-]+$"
                  },
                  "verifiedWriteClaimId": {
                    "type": "string",
                    "maxLength": 128,
                    "pattern": "^tlc_[A-Za-z0-9_-]+$"
                  }
                },
                "required": ["gatewayRevision", "verifiedClaimId", "verifiedWriteClaimId"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The producer record, proxied unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "gatewayRevision": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{40}$"
                        },
                        "verifiedClaimId": {
                          "type": "string",
                          "maxLength": 128,
                          "pattern": "^tlc_[A-Za-z0-9_-]+$"
                        },
                        "verifiedWriteClaimId": {
                          "type": "string",
                          "maxLength": 128,
                          "pattern": "^tlc_[A-Za-z0-9_-]+$"
                        },
                        "verifiedAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": [
                        "gatewayRevision",
                        "verifiedClaimId",
                        "verifiedWriteClaimId",
                        "verifiedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed`: a request body field is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` — organization administrators only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`handoff_incomplete` — no readiness record covers this transfer yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`source_changed` — the legacy source moved under the expected hash.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/triggers/migrate-legacy": {
      "post": {
        "operationId": "migrateLegacyAutomations",
        "summary": "Preview or transfer one page of legacy automations",
        "description": "Walks the legacy automations one keyset page at a time. `dryRun: true` reports what each row would become and never writes; `dryRun: false` transfers the page and requires a stored readiness record. `limit` is 1-25 (default from the producer) and `cursor` takes the previous response's `nextCursor`.",
        "tags": ["Workspace Triggers"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dryRun": {
                    "type": "boolean"
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 25
                  },
                  "cursor": {
                    "type": "string",
                    "maxLength": 128
                  }
                },
                "required": ["dryRun"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The producer record, proxied unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "dryRun": {
                          "type": "boolean"
                        },
                        "handoffReady": {
                          "type": "boolean"
                        },
                        "readiness": {
                          "nullable": true,
                          "type": "object",
                          "properties": {
                            "gatewayRevision": {
                              "type": "string",
                              "pattern": "^[a-f0-9]{40}$"
                            },
                            "verifiedClaimId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^tlc_[A-Za-z0-9_-]+$"
                            },
                            "verifiedWriteClaimId": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^tlc_[A-Za-z0-9_-]+$"
                            },
                            "verifiedAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "gatewayRevision",
                            "verifiedClaimId",
                            "verifiedWriteClaimId",
                            "verifiedAt"
                          ],
                          "additionalProperties": false
                        },
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "automationId": {
                                "type": "string"
                              },
                              "triggerId": {
                                "type": "string",
                                "maxLength": 128,
                                "pattern": "^trg_[A-Za-z0-9_-]+$"
                              },
                              "status": {
                                "type": "string",
                                "enum": ["ready", "migrated", "blocked", "archived"]
                              },
                              "message": {
                                "type": "string"
                              },
                              "nextRunAt": {
                                "nullable": true,
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              }
                            },
                            "required": ["automationId", "status"]
                          }
                        },
                        "nextCursor": {
                          "nullable": true,
                          "type": "string"
                        }
                      },
                      "required": ["dryRun", "handoffReady", "readiness", "rows", "nextCursor"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed`: a request body field is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` — organization administrators only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`handoff_incomplete` — no readiness record covers this transfer yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`source_changed` — the legacy source moved under the expected hash.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/triggers/legacy-channel-handoff": {
      "post": {
        "operationId": "markLegacyChannelHandoff",
        "summary": "Record the deployed revisions that hold channel ownership",
        "description": "The channel equivalent of the automation readiness record: both deployed revisions, plus a settled fire, write or create claim observed against them where one exists. Every legacy channel producer is retired, so a claim id is optional — omit it and the producer records readiness once no legacy channel operation is in flight.",
        "tags": ["Workspace Triggers"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "gatewayRevision": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{40}$"
                  },
                  "centerRevision": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{40}$"
                  },
                  "verifiedFireClaimId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "verifiedWriteClaimId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "verifiedCreateClaimId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": ["gatewayRevision", "centerRevision"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The producer record, proxied unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "gatewayRevision": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{40}$"
                        },
                        "centerRevision": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{40}$"
                        },
                        "verifiedFireClaimId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "verifiedWriteClaimId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "verifiedCreateClaimId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "verifiedAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": ["gatewayRevision", "centerRevision", "verifiedAt"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed`: a request body field is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` — organization administrators only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`handoff_incomplete` — no readiness record covers this transfer yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`source_changed` — the legacy source moved under the expected hash.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/triggers/migrate-legacy-channels": {
      "post": {
        "operationId": "migrateLegacyChannel",
        "summary": "Preview, transfer or archive one legacy channel",
        "description": "Transfers ONE channel, named by `channelId`. `dryRun: true` reports the outcome without writing. Optional `expectedSourceHash` (64 hex characters) makes the transfer refuse a source that changed since it was read. `archive: true` takes the other exit: it archives a channel the producer REFUSES to transfer, storing that refusal on the row, and is itself refused for a channel that could still migrate.",
        "tags": ["Workspace Triggers"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "channelId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "dryRun": {
                    "type": "boolean"
                  },
                  "expectedSourceHash": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "archive": {
                    "type": "boolean"
                  }
                },
                "required": ["channelId", "dryRun"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The producer record, proxied unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "channelId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "triggerId": {
                          "type": "string",
                          "maxLength": 128,
                          "pattern": "^trg_[A-Za-z0-9_-]+$"
                        },
                        "status": {
                          "type": "string",
                          "enum": ["ready", "migrated", "blocked", "archived"]
                        },
                        "sourceHash": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "message": {
                          "type": "string"
                        },
                        "handoffReady": {
                          "type": "boolean"
                        },
                        "trigger": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            },
                            "enabled": {
                              "default": true,
                              "type": "boolean"
                            },
                            "when": {
                              "anyOf": [
                                {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": ["schedule"]
                                        },
                                        "schedule": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "enum": ["cron"]
                                                },
                                                "expression": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                },
                                                "timezone": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 100
                                                }
                                              },
                                              "required": ["kind", "expression", "timezone"],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "enum": ["once"]
                                                },
                                                "at": {
                                                  "type": "string",
                                                  "format": "date-time",
                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                                }
                                              },
                                              "required": ["kind", "at"],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      },
                                      "required": ["kind", "schedule"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": ["email"]
                                        },
                                        "address": {
                                          "type": "string",
                                          "maxLength": 254,
                                          "format": "email",
                                          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                                        },
                                        "from": {
                                          "maxItems": 50,
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "format": "email",
                                            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                                          }
                                        }
                                      },
                                      "required": ["kind", "address"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": ["webhook"]
                                        },
                                        "slug": {
                                          "type": "string",
                                          "pattern": "^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"
                                        }
                                      },
                                      "required": ["kind", "slug"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": ["manual"]
                                        }
                                      },
                                      "required": ["kind"],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": ["webhook"]
                                    },
                                    "slug": {
                                      "type": "string"
                                    },
                                    "secretPreview": {
                                      "type": "string"
                                    }
                                  },
                                  "required": ["kind", "slug", "secretPreview"]
                                }
                              ]
                            },
                            "open": {
                              "type": "object",
                              "properties": {
                                "agentIds": {
                                  "maxItems": 20,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 128
                                  }
                                },
                                "spaces": {
                                  "maxItems": 20,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "spaceId": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 128
                                      },
                                      "access": {
                                        "type": "string",
                                        "enum": ["read", "commit"]
                                      }
                                    },
                                    "required": ["spaceId", "access"],
                                    "additionalProperties": false
                                  }
                                },
                                "instruction": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 4000
                                },
                                "threadPolicy": {
                                  "type": "string",
                                  "enum": ["new", "reuse"]
                                },
                                "title": {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                "filesFrom": {
                                  "type": "string",
                                  "enum": ["payload", "none"]
                                }
                              },
                              "required": [
                                "agentIds",
                                "spaces",
                                "instruction",
                                "threadPolicy",
                                "filesFrom"
                              ],
                              "additionalProperties": false
                            },
                            "permissions": {
                              "type": "object",
                              "properties": {
                                "runAsUserId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                }
                              },
                              "required": ["runAsUserId"],
                              "additionalProperties": false
                            },
                            "id": {
                              "type": "string",
                              "maxLength": 128,
                              "pattern": "^trg_[A-Za-z0-9_-]+$"
                            },
                            "lastRun": {
                              "type": "object",
                              "properties": {
                                "status": {
                                  "type": "string",
                                  "enum": ["opened", "busy", "needs_input", "blocked", "error"]
                                },
                                "sessionId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128
                                },
                                "message": {
                                  "type": "string",
                                  "maxLength": 1000
                                },
                                "at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                }
                              },
                              "required": ["status", "at"]
                            },
                            "nextRunAt": {
                              "nullable": true,
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            "triggerRef": {
                              "type": "string"
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            "legacy": {
                              "type": "object",
                              "properties": {
                                "channelId": {
                                  "type": "string"
                                },
                                "channelType": {
                                  "type": "string",
                                  "enum": ["email", "webhook"]
                                },
                                "automationId": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "required": [
                            "name",
                            "when",
                            "open",
                            "permissions",
                            "id",
                            "nextRunAt",
                            "triggerRef",
                            "createdAt",
                            "updatedAt"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": ["channelId", "status", "handoffReady"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "`validation_failed`: a request body field is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden` — organization administrators only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "`handoff_incomplete` — no readiness record covers this transfer yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "`source_changed` — the legacy source moved under the expected hash.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/onboarding/default-space": {
      "post": {
        "operationId": "ensureOnboardingDefaultSpace",
        "tags": ["Onboarding"],
        "summary": "Ensure the caller's organization has its default space",
        "description": "Creates the default space if it does not already exist. Idempotent — safe to call repeatedly, including for organizations that predate automatic default-space seeding (RKO-486). Open to any org member: this repairs a fixed, no-input data gap rather than creating an arbitrary new space. Seeds no files — samples arrive from `/onboarding/sample-document` once step 2 is known (RKO-741).",
        "responses": {
          "200": {
            "description": "The default space id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingDefaultSpace"
                }
              }
            }
          }
        }
      }
    },
    "/onboarding/sample-document": {
      "post": {
        "operationId": "seedOnboardingPresetDocument",
        "tags": ["Onboarding"],
        "summary": "Seed the sample document matching step 2's installed preset",
        "description": "Seeds a sample file into the default space matching the given preset, so a run against it demos meaningfully instead of using the generic sample W-9. `industry` only matters for `fill-form-from-records`, `base-redact-pdf`, and `base-redact-audio`, whose samples are industry-keyed. Idempotent: seeds nothing if a file with that name already exists. Given `installId`, a Fill install is also pointed at the blank form this seeds, so its first run has a template (RKO-784).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeedPresetDocumentBody"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Seeded (or already present)."
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        }
      }
    },
    "/onboarding/profile": {
      "post": {
        "operationId": "saveOnboardingProfile",
        "tags": ["Onboarding"],
        "summary": "Save the onboarding answers of the caller's organization",
        "description": "Saves the answers of the onboarding wizard for the organization of the session. `product` is required. Each other answer is optional, and an answer that is not sent keeps its earlier value. An unknown key answers 400. Authorization: organization administrators only (denied, 403).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OnboardingProfileBody"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "The answers are saved."
          },
          "400": {
            "description": "The body is not valid, or it holds an unknown key."
          },
          "403": {
            "description": "The caller is not an administrator of the organization."
          }
        }
      }
    },
    "/space-types": {
      "get": {
        "operationId": "listSpaceTypes",
        "tags": ["Workspace Spaces"],
        "summary": "List space types",
        "description": "Lists all of the organization's space types — reads are open to every authenticated member. Each entry includes `viewerCanContribute`, which is true when the caller is an administrator or explicitly holds `spacetype:contribute` on that type.",
        "responses": {
          "200": {
            "description": "The organization's space types and the caller's creation capability.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceTypeList"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createSpaceType",
        "tags": ["Workspace Spaces"],
        "summary": "Create a space type",
        "description": "Creates a space type at the organization root. Authorization: organization administrators only — other callers get 403. Body: `title` (1–120 chars) and `identifier`, a lowercase slug (starts with a letter, then letters/digits/hyphens, no trailing hyphen, 2–40 chars). The identifier is the permanent key and cannot be reused — a duplicate returns 409 `identifier_taken`.",
        "responses": {
          "201": {
            "description": "The created space type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceTypeEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "409": {
            "description": "`identifier_taken` — a space type with this identifier already exists."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "example": "Legal"
                  },
                  "identifier": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9-]{0,38}[a-z0-9]$",
                    "example": "legal"
                  }
                },
                "required": ["title", "identifier"]
              }
            }
          }
        }
      }
    },
    "/space-types/{spaceTypeId}": {
      "patch": {
        "operationId": "updateSpaceType",
        "tags": ["Workspace Spaces"],
        "summary": "Update a space type",
        "description": "Updates a space type's ontology extraction configuration: `ontology.prompt` (freeform guidance appended to the extraction instructions, max 4000 chars), `ontology.entities` (allowed entity types as `{ key, description? }` — when non-empty this list replaces the built-in types and extracted entities are validated against it), and `ontology.includeDateTime` (includes the current date and time for relative-date normalization). Configuration takes effect on future ingests only — re-ingest files to apply it. Authorization: organization administrators only — other callers get 403. Returns 200 `{ spaceType }`; 404 if the space type does not exist.",
        "responses": {
          "200": {
            "description": "The updated space type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceTypeEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — the space type does not exist."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ontology": {
                    "type": "object",
                    "properties": {
                      "prompt": {
                        "description": "Freeform guidance appended to the extraction instructions.",
                        "type": "string",
                        "maxLength": 4000
                      },
                      "entities": {
                        "description": "Allowed entity types. When non-empty this list REPLACES the built-in types; extracted entities are validated against these keys.",
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_-]{0,63}$",
                              "example": "vendor"
                            },
                            "description": {
                              "example": "A supplier organization",
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": ["key"]
                        }
                      },
                      "includeDateTime": {
                        "description": "Include the current date and time during extraction.",
                        "type": "boolean"
                      }
                    }
                  }
                },
                "required": ["ontology"]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceTypeId",
            "required": true
          }
        ]
      }
    },
    "/spaces": {
      "get": {
        "operationId": "listSpaces",
        "tags": ["Workspace Spaces"],
        "summary": "List spaces",
        "description": "Lists non-archived spaces across all space types. Authorization: any authenticated organization member. Organization administrators see every space; other members see only the spaces they hold `space:read` on. Archived spaces are excluded. No pagination — returns the full visible set. Each entry has `id` (uuid), `title`, `spaceType` (the parent space-type identifier), `createdAt`, `updatedAt`, and `createdBy`.",
        "responses": {
          "200": {
            "description": "The non-archived spaces visible to the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceList"
                }
              }
            }
          }
        }
      }
    },
    "/spaces/{spaceId}": {
      "get": {
        "operationId": "getSpace",
        "tags": ["Workspace Spaces"],
        "summary": "Get a space",
        "description": "Fetches a single space by id. Authorization: requires `space:read` on the space; organization administrators bypass this check. A caller lacking the grant gets 404, not 403, so a space's existence is never leaked; a genuinely missing or archived space also returns 404. Success returns `{ space }` with `id`, `title`, `spaceType`, `createdAt`, `updatedAt`, and `createdBy`.",
        "responses": {
          "200": {
            "description": "The space.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — the space does not exist, is archived, or the caller lacks `space:read`."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateSpace",
        "tags": ["Workspace Spaces"],
        "summary": "Rename a space",
        "description": "Renames a space. Body: `title` (1–120 chars after trimming whitespace). The space id does not change, so its files, runs, and links stay attached. Authorization: requires `space:contribute` on the space; organization administrators bypass this check. A caller lacking the grant gets 403. Returns 200 `{ space }`; 404 if the space does not exist, is archived, or is a desk (`me:…`).",
        "responses": {
          "200": {
            "description": "The renamed space.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — the space does not exist, is archived, or is a desk."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "example": "Legal"
                  }
                },
                "required": ["title"]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/archive": {
      "post": {
        "operationId": "archiveSpace",
        "tags": ["Workspace Spaces"],
        "summary": "Archive a space",
        "description": "Soft-archives a space by stamping `archivedAt`; it then disappears from list and get. Authorization: requires `space:archive` on the space; organization administrators bypass this check. A caller lacking the grant gets 403. Returns 204 No Content on success; 404 if the space does not exist or is already archived.",
        "responses": {
          "204": {
            "description": "Archived — no content."
          },
          "404": {
            "description": "`not_found` — the space does not exist or is already archived."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/space-types/{spaceTypeId}/spaces": {
      "post": {
        "operationId": "createSpace",
        "tags": ["Workspace Spaces"],
        "summary": "Create a space",
        "description": "Creates a space under the space type named in the path. Authorization: requires `spacetype:contribute` on the parent space type; organization administrators bypass this check. A caller lacking the grant gets 403. Body: `title` (1–120 chars); the space id is a server-generated uuid. Returns 201 `{ space }`; 404 if the parent space type does not exist.",
        "responses": {
          "201": {
            "description": "The created space.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — the parent space type does not exist."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "example": "Legal"
                  }
                },
                "required": ["title"]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceTypeId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/participants": {
      "get": {
        "operationId": "listSpaceParticipants",
        "tags": ["Workspace Spaces"],
        "summary": "Who can see this space",
        "description": "Lists the people who can read the space, each marked `canWrite` (they hold `space:contribute`) with a display `role`, plus `viewerCanWrite` and `viewerCanShare` for the caller. Access inherited through a team is listed as the individual members who hold it. Authorization: requires `space:read`; a caller lacking it gets 404, so existence is never leaked. A desk (`me:…`) answers with its owner alone — who may always share their own thread — and is 404 for anyone else.",
        "responses": {
          "200": {
            "description": "The space’s participants.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Participants"
                }
              }
            }
          },
          "404": {
            "description": "`not_found` — no such space, or the caller lacks `space:read`."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/objects/definitions": {
      "get": {
        "operationId": "listObjectDefinitions",
        "tags": ["Data Objects"],
        "summary": "List data-object definitions",
        "description": "Lists the org-level data-object definitions (the schemas that objects conform to: fields, types, groups, labels). Authorization: any authenticated org member (no role gate). Query: `archived` — pass `true` to include soft-archived definitions; omitted or `false` returns only active ones. Returns `{ definitions: [...] }`; each definition carries `_id`, `nameSingular`/`namePlural`, labels, `fields[]`, `fieldGroups[]`, and `version`.",
        "parameters": [
          {
            "in": "query",
            "name": "archived",
            "description": "Pass `true` to include soft-archived definitions. Omitted or `false` returns only active ones.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["true", "false"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The definitions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectDefinitionList"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createObjectDefinition",
        "tags": ["Data Objects"],
        "summary": "Create a data-object definition",
        "description": "Creates a new organization-level definition. Authorization: organization administrators only — other callers get 403. Body describes the schema: `nameSingular`/`namePlural`, labels, `fields[]` (13 field types, plus composites), `fieldGroups[]`, `labelFieldKey`, `icon`/`color`. Invalid schema returns 422 `validation_failed` (with `issues`). Returns 201 with `{ definition }`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "nameSingular": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "example": "contract"
                  },
                  "labelSingular": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "labelPlural": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "namePlural": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "description": {
                    "description": "Free-form description of the definition. Omitted means empty.",
                    "type": "string",
                    "maxLength": 2000
                  },
                  "icon": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "color": {
                    "nullable": true,
                    "type": "string"
                  },
                  "labelFieldKey": {
                    "type": "string",
                    "minLength": 1
                  },
                  "fields": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "description": "Field descriptors. Each names a `key`, a `type` and its type-specific options."
                  },
                  "fieldGroups": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": {}
                    }
                  }
                },
                "required": [
                  "nameSingular",
                  "labelSingular",
                  "labelPlural",
                  "namePlural",
                  "icon",
                  "labelFieldKey",
                  "fields"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectDefinitionEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Caller is not an org admin."
          },
          "422": {
            "description": "`validation_failed` — the definition body is invalid (see `issues`)."
          }
        }
      }
    },
    "/objects/definitions/{definitionId}": {
      "get": {
        "operationId": "getObjectDefinition",
        "tags": ["Data Objects"],
        "summary": "Get a data-object definition",
        "description": "Fetches one org-level definition by id, including its full field list, groups, labels, and current `version`. Authorization: any authenticated org member. Unknown id returns 404.",
        "responses": {
          "200": {
            "description": "The definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectDefinitionEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No definition with that id."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateObjectDefinition",
        "tags": ["Data Objects"],
        "summary": "Update a data-object definition",
        "description": "Applies a field-by-key diff to a definition. Authorization: organization administrators only — other callers get 403. Body is strict (immutable `name`/field keys rejected). Fields present are upserted; **omitting an active field soft-archives it** (archive-on-omit). Changing a field type while live objects exist returns 409 `type_change_blocked` (with `fieldKey`); the `version` bumps only on a schema-affecting change. Unknown id → 404, invalid body → 422 `validation_failed`. Returns `{ definition }`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "labelSingular": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "labelPlural": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "namePlural": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "icon": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "color": {
                    "nullable": true,
                    "type": "string"
                  },
                  "labelFieldKey": {
                    "type": "string",
                    "minLength": 1
                  },
                  "fields": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "description": "Field descriptors. Each names a `key`, a `type` and its type-specific options."
                  },
                  "fieldGroups": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": {}
                    }
                  }
                },
                "additionalProperties": false,
                "description": "Strict: `nameSingular` and unknown keys are rejected. Fields present are upserted; omitting an active field soft-archives it."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectDefinitionEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Caller is not an org admin."
          },
          "404": {
            "description": "No definition with that id."
          },
          "409": {
            "description": "`type_change_blocked` — a field type change is blocked by live objects."
          },
          "422": {
            "description": "`validation_failed` — the patch body is invalid."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteObjectDefinition",
        "tags": ["Data Objects"],
        "summary": "Archive (or purge) a data-object definition",
        "description": "Soft-archives a definition. Authorization: organization administrators only — other callers get 403. Query: `purge=true` forces removal even when live objects exist; without it, a definition that still has live objects returns 409 `objects_exist` (with `count`). Unknown id → 404. Returns the archived `{ definition }`.",
        "parameters": [
          {
            "in": "query",
            "name": "purge",
            "description": "Pass `true` to archive even when live objects still exist (they are left untouched).",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["true", "false"]
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The archived definition.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectDefinitionEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Caller is not an org admin."
          },
          "404": {
            "description": "No definition with that id."
          },
          "409": {
            "description": "`objects_exist` — live objects remain and `purge` was not set."
          }
        }
      }
    },
    "/objects/definitions/{definitionId}/schema": {
      "get": {
        "operationId": "getObjectDefinitionSchema",
        "tags": ["Data Objects"],
        "summary": "Get a definition compiled to JSON Schema",
        "description": "Returns the definition compiled to a JSON Schema (`{ schema }`) describing the shape objects of this definition must satisfy — useful for validating object `data` before a create/patch. Authorization: any authenticated org member. Unknown id returns 404.",
        "responses": {
          "200": {
            "description": "The compiled JSON Schema.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectDefinitionSchemaEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No definition with that id."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/objects": {
      "get": {
        "operationId": "countSpaceObjects",
        "tags": ["Data Objects"],
        "summary": "Count objects per definition in a space",
        "description": "Groups a space's live (non-deleted) objects by definition — one row per definition that has at least one object in the space (backs the Data tab's type list). Authorization: requires `space:read` on `:spaceId` — a caller who lacks it gets **404** (leak-guard, not 403). Definition ids are not joined against the definitions catalog; archived definitions with leftover objects still appear. Returns `{ counts: [{ definitionId, count }] }`.",
        "responses": {
          "200": {
            "description": "Per-definition object counts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataObjectCounts"
                }
              }
            }
          },
          "404": {
            "description": "Missing `space:read`."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/objects/{definitionId}": {
      "get": {
        "operationId": "listObjects",
        "tags": ["Data Objects"],
        "summary": "List objects of a definition in a space",
        "description": "Lists the objects (records) of a definition within a space. Authorization: requires `space:read` on `:spaceId` — a caller who lacks it gets **404** (leak-guard, not 403). Query params: `filter` — a JSON array of filter entries (`{ fieldKey, subField?, operand, value }`, 14 operands); `sort` — a JSON array of sort entries (`{ fieldKey, direction: asc|desc }`); `view` — a saved-view id whose stored filters/sorts are applied instead, **mutually exclusive with `filter`/`sort`** (400 `invalid_request`); `limit` (1–200, default 50) and `offset` (default 0) for pagination. Default sort is `createdAt` desc. Unknown/archived field or a `$`-injection in filter/sort → 422; an unknown/wrong-scope `view` → 404 `view_not_found`. Returns `{ objects, nextOffset }` — `nextOffset` is the offset of the next page or `null` when exhausted; each object carries inline `data`, `fieldMeta`, (when AI-imported) `provenance`/`review`, and (when produced by an action run) an `origin` `{ actionRunId?, playbookRunId? }`.",
        "parameters": [
          {
            "in": "query",
            "name": "filter",
            "description": "Ad-hoc filter: a JSON array of `{ fieldKey, subField?, operand, value }` entries.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort",
            "description": "Ad-hoc sort: a JSON array of `{ fieldKey, direction }` entries.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "view",
            "description": "A saved-view id whose stored filters and sorts are applied instead. Mutually exclusive with `filter` and `sort`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Page size, 1–200.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "description": "Row offset.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "A page of objects.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataObjectList"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request` — `view` combined with `filter`/`sort`."
          },
          "404": {
            "description": "Missing `space:read`, or an unknown `view` id."
          },
          "422": {
            "description": "The `filter`/`sort` references an unknown/archived field or is malformed."
          }
        }
      },
      "post": {
        "operationId": "createObject",
        "tags": ["Data Objects"],
        "summary": "Create an object",
        "description": "Creates one object of a definition within a space. Authorization: requires `space:contribute` on `:spaceId` — lacking it gives **403** (no `space:read` → 404). Body: `{ data, fieldMeta? }` — `data` is field values keyed by field key (validated against the definition via JSON Schema; defaults applied); optional `fieldMeta` accepts only `source`/`locked` per key. A `unique`-field collision returns 409 `duplicate_value` (with `fieldKey`); invalid data → 422 `validation_failed`. Returns 201 with `{ object }`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "object",
                    "additionalProperties": {},
                    "description": "Field values keyed by field key."
                  },
                  "fieldMeta": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "description": "Per-field metadata keyed by field key. Only `source` and `locked` are accepted."
                  }
                },
                "required": ["data"]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataObjectEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing `space:contribute`."
          },
          "409": {
            "description": "`duplicate_value` — a unique-field collision."
          },
          "422": {
            "description": "`validation_failed` — `data` fails the definition schema."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/objects/{definitionId}/views": {
      "get": {
        "operationId": "listObjectViews",
        "tags": ["Data Objects"],
        "summary": "List saved views for a definition in a space",
        "description": "Lists the saved table views (stored filters/sorts/column layout) for a definition within a space. Authorization: requires `space:read` on `:spaceId` — lacking it gives **404** (leak-guard). A per-space default view is lazily seeded on first read, so the response `{ default, views }` always contains a `default`; `views` is the full list (including the default).",
        "responses": {
          "200": {
            "description": "The saved views, including the seeded default.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectViewList"
                }
              }
            }
          },
          "404": {
            "description": "Missing `space:read`."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ]
      },
      "post": {
        "operationId": "createObjectView",
        "tags": ["Data Objects"],
        "summary": "Create a saved view",
        "description": "Creates a saved table view for a definition within a space. Authorization: requires `space:contribute` on `:spaceId` — lacking it gives **403** (a caller without even `space:read` gets 404 first). Body: `name` (required), and optional `fields[]` (`{ fieldKey, isVisible, width, position }`), `filters[]` (`{ fieldKey, subField?, operand, value }`), `sorts[]` (`{ fieldKey, direction }`), `filterLogic`. Server sets `isDefault`/`spaceId`/`definitionId`. Invalid name/fields/operands → 422 `validation_failed`. Returns 201 with `{ view }`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "fieldKey": {
                          "type": "string",
                          "minLength": 1
                        },
                        "isVisible": {
                          "type": "boolean"
                        },
                        "width": {
                          "type": "number",
                          "minimum": 1
                        },
                        "position": {
                          "type": "number"
                        }
                      },
                      "required": ["fieldKey"]
                    }
                  },
                  "filters": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "fieldKey": {
                          "type": "string",
                          "minLength": 1
                        },
                        "subField": {
                          "type": "string"
                        },
                        "operand": {
                          "type": "string",
                          "minLength": 1,
                          "description": "One of the 14 supported operands."
                        },
                        "value": {}
                      },
                      "required": ["fieldKey", "operand"]
                    }
                  },
                  "sorts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "fieldKey": {
                          "type": "string",
                          "minLength": 1
                        },
                        "subField": {
                          "type": "string"
                        },
                        "direction": {
                          "type": "string",
                          "enum": ["asc", "desc"]
                        }
                      },
                      "required": ["fieldKey", "direction"]
                    }
                  },
                  "filterLogic": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["name"],
                "description": "`isDefault`, `spaceId` and `definitionId` are server-set."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created view.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectViewEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing `space:contribute`."
          },
          "422": {
            "description": "`validation_failed` — invalid name/fields/filters/sorts."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/objects/{definitionId}/views/{viewId}": {
      "patch": {
        "operationId": "updateObjectView",
        "tags": ["Data Objects"],
        "summary": "Update a saved view",
        "description": "Partially updates a saved view. Authorization: requires `space:contribute` on `:spaceId` — lacking it gives **403** (no `space:read` → 404). Strict body accepting any of `name`, `fields[]`, `filters[]`, `sorts[]`, `filterLogic`. The seeded default view cannot be renamed → 400 `default_view_not_renamable`; unknown view → 404; invalid body → 422. Returns `{ view }`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "fieldKey": {
                          "type": "string",
                          "minLength": 1
                        },
                        "isVisible": {
                          "type": "boolean"
                        },
                        "width": {
                          "type": "number",
                          "minimum": 1
                        },
                        "position": {
                          "type": "number"
                        }
                      },
                      "required": ["fieldKey"]
                    }
                  },
                  "filters": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "fieldKey": {
                          "type": "string",
                          "minLength": 1
                        },
                        "subField": {
                          "type": "string"
                        },
                        "operand": {
                          "type": "string",
                          "minLength": 1,
                          "description": "One of the 14 supported operands."
                        },
                        "value": {}
                      },
                      "required": ["fieldKey", "operand"]
                    }
                  },
                  "sorts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "fieldKey": {
                          "type": "string",
                          "minLength": 1
                        },
                        "subField": {
                          "type": "string"
                        },
                        "direction": {
                          "type": "string",
                          "enum": ["asc", "desc"]
                        }
                      },
                      "required": ["fieldKey", "direction"]
                    }
                  },
                  "filterLogic": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "additionalProperties": false,
                "description": "Strict: unknown and server-controlled keys are rejected."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated view.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectViewEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "`default_view_not_renamable` — the default view cannot be renamed."
          },
          "403": {
            "description": "Missing `space:contribute`."
          },
          "404": {
            "description": "Unknown view (or missing `space:read`)."
          },
          "422": {
            "description": "`validation_failed` — invalid body."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "viewId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteObjectView",
        "tags": ["Data Objects"],
        "summary": "Delete a saved view",
        "description": "Deletes a saved view. Authorization: requires `space:contribute` on `:spaceId` — lacking it gives **403** (no `space:read` → 404). The seeded default view is undeletable → 400 `default_view_undeletable`; unknown view → 404. Returns `{ ok: true }`.",
        "responses": {
          "200": {
            "description": "Deletion acknowledged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OkEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "`default_view_undeletable` — the default view cannot be deleted."
          },
          "403": {
            "description": "Missing `space:contribute`."
          },
          "404": {
            "description": "Unknown view (or missing `space:read`)."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "viewId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/objects/{definitionId}/batch": {
      "post": {
        "operationId": "batchCreateObjects",
        "tags": ["Data Objects"],
        "summary": "Batch-import objects into a space",
        "description": "Bulk-imports up to 200 objects for a definition within a space (used by the extraction-import feed). Authorization: requires `space:contribute` on `:spaceId` — lacking it gives **403** (no `space:read` → 404). Body: `{ objects: [{ _id?, data, fieldMeta?, provenance?, origin? }] }` (1–200 rows). A caller-chosen `_id` makes the row idempotent — an existing/repeated id is `skipped`; a non-empty `provenance` (per-field citation pointers) seeds a pending review per grounded field. A row `origin` accepts only `{ actionRunId }`; any supplied `playbookRunId` is ignored because playbook provenance can only be added during playbook execution. Web imports always stay **pending**: a top-level `reviewStatus` cannot approve an import. **Always returns 200** (never a partial-failure status) with `{ results, created, skipped, failed }`; each result is `{ index, status: created|skipped|duplicate|invalid, _id?, issues? }`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "objects": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "description": "Caller-chosen id. A repeat of an existing id makes the row `skipped`.",
                          "type": "string"
                        },
                        "data": {
                          "type": "object",
                          "additionalProperties": {}
                        },
                        "fieldMeta": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "description": "Per-field metadata keyed by field key. Only `source` and `locked` are accepted."
                        },
                        "provenance": {
                          "description": "A non-empty map seeds a pending review per grounded field.",
                          "type": "object",
                          "additionalProperties": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": {}
                            }
                          }
                        },
                        "origin": {
                          "description": "Only `actionRunId` is accepted; a supplied `playbookRunId` is dropped.",
                          "type": "object",
                          "properties": {
                            "actionRunId": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "required": ["data"]
                    }
                  }
                },
                "required": ["objects"],
                "description": "A top-level `reviewStatus` is stripped — an import through this API stays pending."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-row outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchCreateObjectsResult"
                }
              }
            }
          },
          "403": {
            "description": "Missing `space:contribute`."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/objects/{definitionId}/batch-delete": {
      "post": {
        "operationId": "batchDeleteObjects",
        "tags": ["Data Objects"],
        "summary": "Permanently delete objects",
        "description": "Permanently deletes up to 200 objects of a definition in a space. The objects cannot be restored. Authorization: requires `space:contribute` on `:spaceId`. Lacking it gives **403** (no `space:read` gives 404). Body: `{ ids }` (1 to 200). An unknown id is ignored, so a retry is safe. Returns `{ deleted, ids }`: the count and the ids of the deleted objects.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": "The ids of the objects to delete permanently. An unknown id is ignored."
                  }
                },
                "required": ["ids"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The deleted count.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchDeleteObjectsResult"
                }
              }
            }
          },
          "403": {
            "description": "Missing `space:contribute`."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/objects/{definitionId}/count": {
      "get": {
        "operationId": "countObjects",
        "tags": ["Data Objects"],
        "summary": "Count objects",
        "description": "Counts the live objects of a definition in a space. With `view`, only the objects that match the filters of that saved view count. Authorization: requires `space:read` on `:spaceId`. Lacking it gives **404**.",
        "parameters": [
          {
            "in": "query",
            "name": "view",
            "description": "A saved view id. Only the objects that match its filters count.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The count.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ObjectCountResult"
                }
              }
            }
          },
          "404": {
            "description": "Missing `space:read`, or an unknown `view` id."
          },
          "422": {
            "description": "A view filter names an unknown or archived field."
          }
        }
      }
    },
    "/spaces/{spaceId}/objects/{definitionId}/delete-matching": {
      "post": {
        "operationId": "deleteMatchingObjects",
        "tags": ["Data Objects"],
        "summary": "Permanently delete all or filtered objects",
        "description": "Permanently deletes the objects of a definition in a space. The objects cannot be restored. The definition stays. Authorization: requires `space:contribute` on `:spaceId`. Lacking it gives **403** (no `space:read` gives 404). Body: `{ view? }`. With `view`, only the objects that match the filters of that saved view are deleted. One request deletes at most 2000 objects. Returns `{ deleted, more }`. When `more` is true, send the same request again.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "view": {
                    "description": "A saved view id. Only the objects that match its filters are deleted. Without it, all the objects are deleted.",
                    "type": "string",
                    "minLength": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The deleted count.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteMatchingObjectsResult"
                }
              }
            }
          },
          "403": {
            "description": "Missing `space:contribute`."
          },
          "404": {
            "description": "Missing `space:read`, or an unknown `view` id."
          },
          "422": {
            "description": "A view filter names an unknown or archived field."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/objects/{definitionId}/{objectId}": {
      "get": {
        "operationId": "getObject",
        "tags": ["Data Objects"],
        "summary": "Get one object",
        "description": "Fetches a single object by id within a space, with `data`, per-field `fieldMeta` (`modifiedBy`/`modifiedAt`, `source?`, `locked?`), when AI-imported `provenance` and `review`, and when produced by an action run an `origin` `{ actionRunId?, playbookRunId? }` — all inline. Authorization: requires `space:read` on `:spaceId` — lacking it gives **404** (leak-guard); an unknown or deleted object also 404s.",
        "responses": {
          "200": {
            "description": "The object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataObjectEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Missing `space:read`, or no such object."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "objectId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateObject",
        "tags": ["Data Objects"],
        "summary": "Update an object",
        "description": "Partially updates an object. Authorization: requires `space:contribute` on `:spaceId` — lacking it gives **403** (no `space:read` → 404). Body: `{ data?, unset?, fieldMeta? }` — `data` merges field values, `unset` clears the named field keys, `fieldMeta` sets `source`/`locked` per key (and can lock/unlock without writing). A `fieldMeta`-locked **or** review-approved/rejected field refuses a write/unset with 409 `field_locked` (unless the `fieldMeta` lock is cleared in the same request; a review-lock must be dismissed via the review routes first). Unique collision → 409 `duplicate_value`, invalid data → 422, unknown object → 404. A human edit clears that field's `provenance`. Returns `{ object }`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "description": "Field values to merge.",
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "unset": {
                    "description": "Field keys to clear.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "fieldMeta": {
                    "description": "May lock or unlock a field without writing a value.",
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "additionalProperties": {}
                    }
                  }
                },
                "description": "At least one of `data`, a non-empty `unset`, or `fieldMeta` must be present."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataObjectEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing `space:contribute`."
          },
          "404": {
            "description": "No such object (or missing `space:read`)."
          },
          "409": {
            "description": "`field_locked` (locked/review-locked field) or `duplicate_value`."
          },
          "422": {
            "description": "`validation_failed` — the merged data fails the schema."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "objectId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteObject",
        "tags": ["Data Objects"],
        "summary": "Delete an object",
        "description": "Permanently deletes an object. It cannot be restored. Authorization: requires `space:contribute` on `:spaceId` — lacking it gives **403** (no `space:read` → 404). Unknown object → 404. Returns `{ ok: true }`.",
        "responses": {
          "200": {
            "description": "Deletion acknowledged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OkEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing `space:contribute`."
          },
          "404": {
            "description": "No such object (or missing `space:read`)."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "objectId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/objects/{definitionId}/{objectId}/review": {
      "patch": {
        "operationId": "reviewObject",
        "tags": ["Data Objects"],
        "summary": "Bulk-review an object's fields",
        "description": "Sets a review status across many of an object's fields at once (the provenance/AI-import approval flow). Authorization: requires `space:contribute` on `:spaceId`; there is no more specific review permission. Lacking it gives **403** (no `space:read` → 404). Body: `{ status, note?, fieldKeys? }` where `status` is `pending`|`approved`|`rejected`; `fieldKeys` defaults to the grounded (provenance) fields, else every data field. An `approved`/`rejected` field becomes review-locked against edits. Unknown field key → 404, invalid `status` → 422 `invalid_status`. Returns the updated `{ object }`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": ["pending", "approved", "rejected"]
                  },
                  "note": {
                    "type": "string"
                  },
                  "fieldKeys": {
                    "description": "Defaults to the grounded (provenance) fields, else every data field.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": ["status"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The object with its review state updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataObjectEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing `space:contribute`."
          },
          "404": {
            "description": "Unknown object/field (or missing `space:read`)."
          },
          "422": {
            "description": "`invalid_status` — status is not pending/approved/rejected."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "objectId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/objects/{definitionId}/{objectId}/fields/{fieldKey}/review": {
      "patch": {
        "operationId": "reviewObjectField",
        "tags": ["Data Objects"],
        "summary": "Review a single object field",
        "description": "Sets the review status of one field (`:fieldKey`) on an object. Authorization: requires `space:contribute` on `:spaceId` — lacking it gives **403** (no `space:read` → 404). Body: `{ status, note? }` where `status` is `pending`|`approved`|`rejected`; `approved`/`rejected` review-locks the field against edits, `pending` dismisses the lock. Archived fields are still reviewable. Unknown field key → 404, invalid `status` → 422 `invalid_status`. Returns the updated `{ object }`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": ["pending", "approved", "rejected"]
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "required": ["status"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The object with the field's review state updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataObjectEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Missing `space:contribute`."
          },
          "404": {
            "description": "Unknown object/field (or missing `space:read`)."
          },
          "422": {
            "description": "`invalid_status` — status is not pending/approved/rejected."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "definitionId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "objectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "fieldKey",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/ontology": {
      "get": {
        "operationId": "getSpaceOntology",
        "tags": ["Ontology"],
        "summary": "Get a space's entity/relation knowledge graph",
        "description": "Returns the whole knowledge graph extracted from the documents in a space: `{ entities, edges }`. Each entity has `id`, `type` (one of organization | person | location | identifier | date | amount | other), `name`, `key`, and `mentionCount`; each edge has `sourceId`, `targetId`, `relation`, and the `fileId` it was observed in. Optional `?limit=` (1-2000) caps the number of entities returned. Requires `space:read` on `:spaceId` — a caller lacking it gets a 404 (existence is hidden).",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "description": "Maximum entities returned, 1–2000. There is no cursor.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 2000,
              "default": 500
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "The space graph.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyGraph"
                }
              }
            }
          }
        }
      }
    },
    "/spaces/{spaceId}/ontology/entities/{entityId}": {
      "get": {
        "operationId": "getSpaceOntologyEntity",
        "tags": ["Ontology"],
        "summary": "Get one entity and its grounded mentions in a space",
        "description": "Returns `{ entity, mentions }` for a single entity in a space's graph. `entity` (or `null` if the id is unknown in this space) carries `id`, `type`, `name`, `key`. `mentions` are the grounded occurrences: each has `fileId`, `text`, and best-effort grounding — `page` + `bbox` (`{x,y,width,height}`) for documents, or `startSeconds`/`endSeconds`/`speaker` for audio transcripts (fields are `null` when not applicable). Requires `space:read` on `:spaceId`; missing access surfaces as a 404.",
        "responses": {
          "200": {
            "description": "The entity (or null) and its grounded mentions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyEntityDetail"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/ontology/entities/{entityId}/related": {
      "get": {
        "operationId": "getSpaceOntologyRelatedEntities",
        "tags": ["Ontology"],
        "summary": "Walk the graph outward from an entity in a space",
        "description": "Returns the neighbourhood of an entity: `{ entities, edges }` reachable within `?depth=` hops (1-3, default 1). Each neighbour entity carries `id`, `type`, `name`, and `distance` (hop count from the seed); edges carry `sourceId`, `targetId`, `relation`, `fileId`. Use it to expand context around a match. Requires `space:read` on `:spaceId`; missing access surfaces as a 404.",
        "parameters": [
          {
            "in": "query",
            "name": "depth",
            "description": "Hops to walk, 1–3.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 3,
              "default": 1
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Neighbouring entities and the connecting edges.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyRelatedEntities"
                }
              }
            }
          }
        }
      }
    },
    "/spaces/{spaceId}/ontology/files/{fileId}/entities": {
      "get": {
        "operationId": "listFileEntities",
        "tags": ["Ontology"],
        "summary": "List the entities extracted from one file, within a space",
        "description": "Returns `{ entities }` — every entity the given `:fileId` contributes to the space graph, with its `id`, `type`, `name`, and the file-local `mentions` (each with `page` + `bbox` for documents or `startSeconds`/`endSeconds`/`speaker` for audio, `null` where inapplicable). Entities are limited to those seen in this document. Requires `space:read` on `:spaceId`; missing access surfaces as a 404.",
        "responses": {
          "200": {
            "description": "The file's entities with their in-file grounded mentions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyFileEntities"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "fileId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/ontology/files/{fileId}/related": {
      "get": {
        "operationId": "listRelatedFiles",
        "tags": ["Ontology"],
        "summary": "Find other files in the space that share entities with this one",
        "description": "Returns `{ files }` — documents in the same space connected to `:fileId` through shared entities, ranked by `score` (more or rarer shared entities score higher). Each item has `fileId`, `score`, and `shared` (the overlapping entities as `{ entityId, name, type }`). Use it for 'documents related to this one'. Requires `space:read` on `:spaceId`; missing access surfaces as a 404.",
        "responses": {
          "200": {
            "description": "Related files ranked by shared-entity overlap.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyRelatedFiles"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "fileId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/ontology/files/{fileId}/graph": {
      "get": {
        "operationId": "getFileOntologyGraph",
        "tags": ["Ontology"],
        "summary": "Get one document's own standalone knowledge graph",
        "description": "Returns `{ entities, edges }` for the document-scoped graph of a single `:fileId` — the entities and relations extracted from that one file, in the same shape as the space graph. Requires `space:read` on `:spaceId`; additionally the file must belong to `:spaceId` or the response is a 404. Missing `space:read` also surfaces as a 404.",
        "responses": {
          "200": {
            "description": "The document's own graph.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyGraph"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "fileId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/ontology/search": {
      "post": {
        "operationId": "searchSpaceOntology",
        "tags": ["Ontology"],
        "summary": "Semantic entity search within a space's graph",
        "description": "Semantic search over the entities in a space. JSON body: `text` (1-2000 chars, required — the natural-language query), optional `topK` (1-100) to cap results, optional `types` (non-empty array of organization | person | location | identifier | date | amount | other) to restrict to entity kinds. Returns `{ matches }`, each `{ id, type, name, score }` ranked by similarity (higher `score` = closer). Requires `space:read` on `:spaceId`; missing access surfaces as a 404.",
        "responses": {
          "200": {
            "description": "Ranked entity matches.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyEntitySearchResults"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000,
                    "example": "acme purchase orders"
                  },
                  "topK": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "types": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "organization",
                        "person",
                        "location",
                        "identifier",
                        "date",
                        "amount",
                        "other"
                      ]
                    }
                  }
                },
                "required": ["text"]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/ontology/ingest": {
      "post": {
        "operationId": "ingestFileOntology",
        "tags": ["Ontology"],
        "summary": "Extract a file into the ontology (doc + space + org levels)",
        "description": "Extracts entities and relations from a file once and populates the document, space, and organization graph levels together. JSON body: `fileId` (required, non-empty). The file must belong to `:spaceId` or the request returns 404. Returns `{ fileId, results }`, one `IngestNamespaceResult` per graph level with `status` (ok | error) and the `entities`/`mentions`/`edges` counts written. Idempotent — re-ingesting creates or enhances the existing graphs. Requires `space:contribute` on `:spaceId`; lacking write permission is a 403 (a missing `space:read` prerequisite would be a 404).",
        "responses": {
          "200": {
            "description": "Per-level ingestion results with the counts written.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyIngestResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileId": {
                    "type": "string",
                    "minLength": 1,
                    "example": "4f6f1c1e-1b2a-4d3c-9e8f-7a6b5c4d3e2f"
                  }
                },
                "required": ["fileId"]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      }
    },
    "/ontology": {
      "get": {
        "operationId": "getOrgOntology",
        "tags": ["Ontology"],
        "summary": "Get the org-wide aggregate knowledge graph",
        "description": "Returns the organization-wide graph that aggregates entities and relations across every space: `{ entities, edges }`, in the same shape as the space graph. Optional `?limit=` (1-2000) caps entities. Because it spans all spaces, it is available only to organization administrators; other callers get 403.",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "description": "Maximum entities returned, 1–2000. There is no cursor.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 2000,
              "default": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The organization-wide aggregate graph.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyGraph"
                }
              }
            }
          }
        }
      }
    },
    "/ontology/entities/{entityId}": {
      "get": {
        "operationId": "getOrgOntologyEntity",
        "tags": ["Ontology"],
        "summary": "Get one entity and its mentions from the org-wide graph",
        "description": "Returns `{ entity, mentions }` for an entity in the org-wide (`org`) graph. `entity` is `null` for an unknown id; otherwise `{ id, type, name, key }`. `mentions` carry `fileId`, `text`, and best-effort grounding (`page`+`bbox` for documents, `startSeconds`/`endSeconds`/`speaker` for audio). Org-admin only — requires the admin role; non-admins get a 403.",
        "responses": {
          "200": {
            "description": "The entity (or null) and its mentions across the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyEntityDetail"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ]
      }
    },
    "/ontology/entities/{entityId}/related": {
      "get": {
        "operationId": "getOrgOntologyRelatedEntities",
        "tags": ["Ontology"],
        "summary": "Walk the org-wide graph outward from an entity",
        "description": "Returns `{ entities, edges }` — the neighbourhood of an entity within the org-wide (`org`) graph, up to `?depth=` hops (1-3, default 1). Neighbour entities carry `id`, `type`, `name`, `distance`; edges carry `sourceId`, `targetId`, `relation`, `fileId`. Org-admin only — requires the admin role; non-admins get a 403.",
        "parameters": [
          {
            "in": "query",
            "name": "depth",
            "description": "Hops to walk, 1–3.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 3,
              "default": 1
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "entityId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Neighbouring entities and the connecting edges.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyRelatedEntities"
                }
              }
            }
          }
        }
      }
    },
    "/ontology/search": {
      "post": {
        "operationId": "searchOrgOntology",
        "tags": ["Ontology"],
        "summary": "Semantic entity search across the org-wide graph",
        "description": "Semantic search over entities in the organization-wide graph. JSON body: `text` (1-2000 chars, required), optional `topK` (1-100), optional `types` (non-empty array of organization | person | location | identifier | date | amount | other). Returns `{ matches }`, each `{ id, type, name, score }` ranked by similarity. Organization administrators only; other callers get 403.",
        "responses": {
          "200": {
            "description": "Ranked entity matches across the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OntologyEntitySearchResults"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000,
                    "example": "acme purchase orders"
                  },
                  "topK": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "types": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "organization",
                        "person",
                        "location",
                        "identifier",
                        "date",
                        "amount",
                        "other"
                      ]
                    }
                  }
                },
                "required": ["text"]
              }
            }
          }
        }
      }
    },
    "/spaces/{spaceId}/files": {
      "post": {
        "operationId": "createSpaceFile",
        "tags": ["Space Files"],
        "summary": "Register a file in a space and get a presigned upload URL",
        "description": "Reserves a file metadata record in the space and returns { id, uploadUrl, uploadExpiresAt, file }. `uploadUrl` is a secure PUT URL valid for 15 minutes (see `uploadExpiresAt`, ISO 8601). Two-step upload: PUT the raw file bytes to `uploadUrl` with a `Content-Type` request header EXACTLY equal to the `mimeType` you sent at create (a mismatch rejects the PUT), then poll `getFile` until `status` reaches a terminal value — `stored` (uploaded, no processing requested), `processed` (processing succeeded), or `failed` (see `processingError`); `waiting`/`processing` mean keep polling. Request body: `fileName` (required), `mimeType` (required, drives both the record and the required PUT Content-Type), `size` (bytes, optional), optional `processingKind` — one of doc-simple | doc-ocr | doc-auto | audio-transcribe | audio-transcribe-and-diarize — selecting how the stored file is post-processed; `indexVectors` and `indexOntology` (both default true) are opt-out booleans for semantic and ontology indexing — both are FORCED false for a desk (`me:<userId>`) space, whose files are never indexed. `parentType`/`parentId` in the body are ignored: the API forces the parent to this :spaceId. Authorization: requires `space:contribute` on :spaceId (missing permission → 403; org admins bypass). An invalid body returns 422.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileName": {
                    "type": "string",
                    "minLength": 1,
                    "example": "invoice.pdf"
                  },
                  "mimeType": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Drives both the record and the required upload `Content-Type`.",
                    "example": "application/pdf"
                  },
                  "size": {
                    "description": "Size in bytes.",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "processingKind": {
                    "description": "How the stored file is post-processed. Omit for automatic selection by mime.",
                    "type": "string",
                    "enum": [
                      "doc-simple",
                      "doc-ocr",
                      "doc-auto",
                      "audio-transcribe",
                      "audio-transcribe-and-diarize"
                    ]
                  },
                  "indexVectors": {
                    "default": true,
                    "description": "Semantic indexing.",
                    "type": "boolean"
                  },
                  "indexOntology": {
                    "default": true,
                    "description": "Knowledge-graph indexing.",
                    "type": "boolean"
                  }
                },
                "required": ["fileName", "mimeType"],
                "description": "`parentType` / `parentId` are ignored: the parent is forced server-side from the route."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "File record created, with its presigned upload URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedFile"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      },
      "get": {
        "operationId": "listSpaceFiles",
        "tags": ["Space Files"],
        "summary": "List a space's files",
        "description": "Returns { files: FileDoc[] } for the space, newest first. Optional `?limit` query caps the page (default 50, max 200); there is no cursor — this is a single most-recent page, not a paginated stream. Optional `?generated=false|true` keeps only uploads or only derived files, applied before `limit`. Authorization: requires `space:read` on :spaceId (missing permission → 404, which hides the space's existence; org admins bypass).",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "description": "Page size, 1–200. There is no cursor: this is one most-recent page.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "generated",
            "description": "`false` returns only files without a `parentFileId` (uploads); `true` only files derived from another file (byproducts, run outputs). Omit for both. Applied before `limit`, so a page of uploads is never crowded out by generated files.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["true", "false"]
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Files in the space, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileList"
                }
              }
            }
          }
        }
      }
    },
    "/spaces/{spaceId}/files/{fileId}": {
      "get": {
        "operationId": "getSpaceFile",
        "tags": ["Space Files"],
        "summary": "Get a file record with download URLs",
        "description": "Returns the file record plus a `urls` object of minted download links, each valid ~1 hour: `urls.file` (the stored original), and once processing has produced them, `urls.processedMd` (extracted markdown) and `urls.processedJson` (structured/grounded JSON). The record also carries `status` (waiting | stored | processing | processed | failed), `processingKind`, `processingError`, `size`, `artifacts`, and createdAt/storedAt/processedAt timestamps — poll this endpoint after uploading to watch `status`. Returns 404 if the file does not belong to :spaceId (cross-space access is hidden). Authorization: requires `space:read` on :spaceId (missing permission → 404; org admins bypass).",
        "responses": {
          "200": {
            "description": "The file record, with minted ~1h download URLs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDoc"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "fileId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteSpaceFile",
        "tags": ["Space Files"],
        "summary": "Delete a file",
        "description": "Deletes the file and its derived objects/artifacts; responds 204 with no body. Returns 404 if the file does not belong to :spaceId (cross-space deletes are hidden). Authorization: requires `space:contribute` on :spaceId (missing permission → 403; org admins bypass).",
        "responses": {
          "204": {
            "description": "File and its derived objects deleted (no body)"
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "fileId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/files/{fileId}/reprocess": {
      "post": {
        "operationId": "reprocessSpaceFile",
        "tags": ["Space Files"],
        "summary": "Retry processing for a failed file",
        "description": "Resets a `failed` file to `waiting` and re-enqueues it for processing (a fresh attempt gets the full automatic retry budget). Returns the updated file record. 409 if the file is not in the `failed` state; 404 if the file does not belong to :spaceId (cross-space access is hidden). Authorization: requires `space:contribute` on :spaceId (missing permission → 403; org admins bypass).",
        "responses": {
          "200": {
            "description": "The file, reset to `waiting` and re-enqueued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDoc"
                }
              }
            }
          },
          "409": {
            "description": "File is not in the failed state."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "fileId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/search": {
      "get": {
        "operationId": "searchSpace",
        "tags": ["Search"],
        "summary": "Semantic search over a space's indexed files",
        "description": "Runs semantic search over every indexed file in the space `:spaceId`. Authorization: the caller needs `space:read` on the space; organization administrators bypass this check. Lacking access returns **404** (existence is hidden), never 403. Query params: `q` (required) is the natural-language query text; callers never send vectors. An empty or whitespace-only `q` returns 400. `limit` (optional, default 20) is a positive integer, capped at 100; larger values are clamped to 100, and a non-integer or `< 1` returns 400. The search is always scoped to the space in the path. Returns `{ matches }`, an array ranked by relevance; each match has `id`, `namespace`, `tags[]`, `score` (higher = closer), and a `metadata` object carrying file grounding (file id, page, bbox, and/or audio timecode) when the source was indexed with it. There is no cursor pagination — bound the result count with `limit`.",
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "description": "Natural-language query text. Empty or whitespace-only returns 400. Callers never send vectors.",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "limit",
            "description": "Maximum matches, clamped to 100. A non-integer or value below 1 returns 400.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked semantic matches within the space.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResults"
                }
              }
            }
          }
        }
      }
    },
    "/spaces/{spaceId}/runs": {
      "post": {
        "operationId": "createRun",
        "tags": ["Space Runs"],
        "summary": "Start an action run in a space",
        "description": "Starts a new action run scoped to the space in the path. Requires `space:contribute` on that space (denied → 403). The space is taken from the path — a `spaceId` in the body never scopes the run. Body: `actionSlug` (installed action to run, required, non-empty), `fileIds` (1–100 file IDs from the space to feed the run, each non-empty), optional `params` (free-form object passed to the action), optional `config` (inline action config, deep-merged over the install's saved config — inline wins, a `null` deletes a key outside `schema`, and an inline `schema` replaces the saved one whole, nulls included — and snapshotted onto the run, so an action can be run without saving its config first). Returns 201 `{ data: ActionRun }`; the run starts in status `running` — poll `getRun` for `awaiting_input` / `done` / `failed` plus its `outputs` and `artifacts`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "actionSlug": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Installed action to run, by id or per-organization slug.",
                    "example": "contract-terms-extraction"
                  },
                  "fileIds": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": "Files from this space to feed the run."
                  },
                  "params": {
                    "description": "Per-run parameters for the action.",
                    "type": "object",
                    "additionalProperties": {}
                  },
                  "config": {
                    "description": "Inline action config, deep-merged over the install's saved config (inline wins; a `null` deletes a key outside `schema`; an inline `schema` replaces the saved one whole, nulls included). Snapshotted onto the run.",
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": ["actionSlug", "fileIds"],
                "description": "A `spaceId` in the body is ignored: the run is scoped by the path."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The started run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionRunEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ]
      },
      "get": {
        "operationId": "listSpaceRuns",
        "tags": ["Space Runs"],
        "summary": "List action runs in a space",
        "description": "Lists the space's action runs, newest first. Requires `space:read` (denied → 404, which also hides the space's existence). Query: `limit` (1–100), `starting_after` (a run id, cursor pagination) and `file_id` (only the runs that read this input file). Returns 200 `{ data: ActionRun[], has_more: boolean }` — keep paging with `starting_after` set to the last returned id while `has_more` is true. Callers who lack `space:contribute` get capability fields (download and storage references, plus the `artifacts` array) redacted from each run.",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "description": "Page size, 1–100.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "in": "query",
            "name": "starting_after",
            "description": "Cursor: the `id` of the last run on the previous page.",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "in": "query",
            "name": "file_id",
            "description": "Only the runs that read this input file.",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "One page of runs, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionRunList"
                }
              }
            }
          }
        }
      }
    },
    "/spaces/{spaceId}/runs/{runId}": {
      "get": {
        "operationId": "getSpaceRun",
        "tags": ["Space Runs"],
        "summary": "Get one action run",
        "description": "Fetches a single run by id within the space. Requires `space:read` (denied → 404); a `runId` belonging to another space also 404s. Returns 200 `{ data: ActionRun }` with the run's `status` (`running` | `awaiting_input` | `done` | `failed`), `error`, `output`, `documents` (input files), `outputs` (downloadable byproducts — each `fileId` streams via `getRunOutput`), `artifacts` (rendered links) and `awaitingInput`. Callers who lack `space:contribute` get capability fields (URLs, storage references, and `artifacts`) redacted.",
        "responses": {
          "200": {
            "description": "The run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionRunEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/runs/{runId}/cancel": {
      "post": {
        "operationId": "cancelSpaceRun",
        "tags": ["Space Runs"],
        "summary": "Cancel an action run",
        "description": "Requests cancellation of a run in the space. Requires `space:contribute` (denied → 403). No request body. Returns 200 `{ data: ActionRun }` with the run's updated state (typically transitioning toward `failed`). Canceling a `sign-document` run also voids its pending envelope, so signers can no longer sign. A `runId` from another space returns 404.",
        "responses": {
          "200": {
            "description": "The run, with its updated state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionRunEnvelope"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/runs/{runId}/outputs/{fileId}": {
      "get": {
        "operationId": "getSpaceRunOutput",
        "tags": ["Space Runs"],
        "summary": "Download a run output file",
        "description": "Streams the raw bytes of a stored run byproduct — pass a `fileId` from the run's `outputs[]`. Requires `space:read` (denied → 404); a missing, unknown, or cross-space output also 404s. This is a binary byte stream, not JSON; its `content-type`, status, and headers are preserved.",
        "responses": {
          "200": {
            "description": "The output file bytes.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "fileId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/runs/{runId}/result": {
      "get": {
        "operationId": "getSpaceRunResult",
        "tags": ["Space Runs"],
        "summary": "Get a run result",
        "description": "Fetches the durable, grounded result of a terminal extract-structured run: one entry per source document with extracted `data`, per-field `evidence` (source citations), envelope (`unit`, `fieldKeys`, `schema`) and per-document status. Requires `space:read` (denied → 404, which also hides the space's existence). Returns 404 while the run is still `running` or when no result exists. Response status and headers are preserved.",
        "responses": {
          "200": {
            "description": "The durable, grounded run result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunResult"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/runs/{runId}/docs/{docId}": {
      "patch": {
        "operationId": "patchSpaceRunDoc",
        "tags": ["Space Runs"],
        "summary": "Edit an extracted document of a run",
        "description": "Overwrites extracted field values on one document of a terminal extract run. Body: `{ fields: { <fieldKey>: <value> } }`. A field whose value changes LOSES its source citation (the evidence no longer backs a human-supplied value); untouched fields keep theirs. Requires `space:contribute` (denied → 403). A run stays editable for **7 days** after it starts; after that an edit answers 404 `state_gone` and the results stay readable through `getRunResult`. 409 `rows_edit_bulk_only` for a table-rows run: those store their values in rows, so edit one with `patchSpaceRunDocRow`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fields": {
                    "type": "object",
                    "additionalProperties": {},
                    "description": "Field key → new value. A field whose value changes loses its source citation; untouched fields keep theirs."
                  }
                },
                "required": ["fields"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The edited document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatchRunDocResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "The run has no editable result, or it is past its 7-day edit window."
          },
          "409": {
            "description": "A table-rows document is not field-addressable."
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "spaceId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "runId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "docId",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/runs/{runId}/docs/{docId}/rows/{rowIndex}": {
      "patch": {
        "operationId": "patchSpaceRunDocRow",
        "tags": ["Space Runs"],
        "summary": "Edit one row of an extracted document",
        "description": "Overwrites extracted field values on ONE row of a terminal `rows_per_document` extract run. Body: `{ fields: { <fieldKey>: <value> } }`, the same shape the document edit takes. A field whose value changes LOSES its source citation (the evidence no longer backs a human-supplied value); untouched fields, and every other row, keep theirs. Rows are addressed by their zero-based index in the extracted order, which is stable for a finished run. Requires `space:contribute` (denied → 403). A run stays editable for **7 days** after it starts; after that an edit answers 404 `state_gone`. The same 404 covers a document that is not a table-rows one and an index out of range. Results stay readable through `getRunResult`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fields": {
                    "type": "object",
                    "additionalProperties": {},
                    "description": "Field key → new value. A field whose value changes loses its source citation; untouched fields keep theirs."
                  }
                },
                "required": ["fields"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The edited row.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatchRunDocRowResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "No editable result, past the 7-day edit window, not a table-rows document, or no such row."
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "spaceId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "runId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "docId",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "rowIndex",
            "schema": {
              "type": "string",
              "pattern": "^\\d+$"
            },
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/runs/{runId}/task": {
      "get": {
        "operationId": "getSpaceRunTask",
        "tags": ["Space Runs"],
        "summary": "Get the pending Fill Form review task",
        "description": "The in-app review payload for a paused `fill-form` run: the drafted field values, the curated field inventory, and the template's page geometry (`FillTask` — `{ runId, docName, templateFileId, outputMode, fields, values, pageBoxes, pageCount }`). Requires `space:read` (denied → 404). 404 once the task is consumed/expired or for a run of any other action. The render bytes come from `getRunTaskPdf`.",
        "responses": {
          "200": {
            "description": "The pending review task.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FillTask"
                }
              }
            }
          },
          "404": {
            "description": "No open review task for this run (consumed, expired, or not fill-form)."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      },
      "post": {
        "operationId": "submitSpaceRunTask",
        "tags": ["Space Runs"],
        "summary": "Submit the Fill Form review",
        "description": "Submits the reviewed field values for a paused `fill-form` run. Body `{ values }` (by field name); unknown or invalid values are discarded, then the filled PDF is uploaded to the space and the run finishes as `done`. Requires `space:contribute` (denied → 403). Returns 404 or 410 when the review is no longer open, or 500 if production fails (the run then reads `failed`).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "values": {
                    "type": "object",
                    "additionalProperties": {},
                    "description": "Reviewed values keyed by field name. Unknown or ill-typed values are dropped."
                  }
                },
                "required": ["values"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The review was produced and the run finished.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitFillTaskResult"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/runs/{runId}/task/pdf": {
      "get": {
        "operationId": "getSpaceRunTaskPdf",
        "tags": ["Space Runs"],
        "summary": "Download the Fill Form review template PDF",
        "description": "Streams the prepared template PDF bytes for a paused `fill-form` run's in-app review canvas — the field boxes in `getRunTask` were measured on exactly these bytes. Requires `space:read` (denied → 404); a consumed or expired task, or a non-fill-form run, also returns 404. This is a binary byte stream, not JSON; its `content-type`, status, and headers are preserved.",
        "responses": {
          "200": {
            "description": "The prepared template PDF bytes.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/runs/{runId}/envelope": {
      "get": {
        "operationId": "getSpaceRunEnvelope",
        "tags": ["Space Runs"],
        "summary": "Get the e-signature envelope for a sign-document run",
        "description": "The sender's view of a `sign-document` run: the envelope (status, document, mode), the signer roster with per-signer status (`pending`/`signed`, email-verified and signed timestamps), and the full audit trail. Requires `space:read` (denied → 404). Returns 404 for a run of any other action. **Never contains signer signing links** — those are bearer capabilities held only by the signers.",
        "responses": {
          "200": {
            "description": "The envelope, its signer roster and its audit trail.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignEnvelopeView"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/runs/{runId}/signers/{signerId}/resend": {
      "post": {
        "operationId": "resendSpaceRunSigner",
        "tags": ["Space Runs"],
        "summary": "Re-send a signer their invitation",
        "description": "Emails a pending signer a **new** signing link. The previous link stops working (the raw token is never stored — only its hash). Requires `space:contribute` (denied → 403). 409 if the signer already signed or the envelope is no longer pending.",
        "responses": {
          "200": {
            "description": "A new invitation was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResendSignerResult"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "signerId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/runs/{runId}/void": {
      "post": {
        "operationId": "voidSpaceRunEnvelope",
        "tags": ["Space Runs"],
        "summary": "Void an e-signature envelope",
        "description": "Cancels a pending envelope: every signing link dies immediately and the run terminates as `failed` with `Voided by sender`. Requires `space:contribute` (denied → 403). Optional body `{ reason }`. 409 once the envelope is finalizing/completed/failed — there is no safe abort mid-seal.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "description": "Recorded on the audit trail.",
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The envelope was voided.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoidEnvelopeResult"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/spaces/{spaceId}/runs/{runId}/audit": {
      "get": {
        "operationId": "getSpaceRunAuditTrail",
        "tags": ["Space Runs"],
        "summary": "Download the signature audit trail",
        "description": "Streams the machine-readable audit trail (`application/json`, `content-disposition: attachment`) — the same envelope, signer roster, and event log the signed PDF carries as its `audit-trail.json` attachment. It also reports `status` and omits the PDF page count. Requires `space:read` (denied → 404) and is available before completion. This is a byte stream; its content type, status, and headers are preserved.",
        "responses": {
          "200": {
            "description": "The audit trail, served as an attachment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignAuditTrail"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "spaceId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "runId",
            "required": true
          }
        ]
      }
    },
    "/process": {
      "post": {
        "operationId": "startProcess",
        "summary": "Start a processing pipeline",
        "tags": ["Process"],
        "description": "Multipart upload of one or more files plus a JSON `options` part (declared files, actions, webhook URL, TTL). Files are sent as repeated parts named `files` (matched to `options.files[].field` by filename; undeclared ones get default processing), or — outside the generated SDKs — as one part per `options.files[].field`. The platform parses the files, runs the requested actions, emits signed webhooks, and holds the result until the TTL expires.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "options": {
                    "type": "object",
                    "properties": {
                      "files": {
                        "description": "Per-file processing declarations. Optional when every file is sent as a repeated `files` part and default processing is fine.",
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "minLength": 1,
                              "description": "Multipart part name of the file (named-part layout), or its filename when the file is sent as a repeated `files` part."
                            },
                            "processingKind": {
                              "description": "How to preprocess this file; omitted = automatic by mime type.",
                              "type": "string",
                              "enum": [
                                "doc-simple",
                                "doc-ocr",
                                "doc-auto",
                                "audio-transcribe",
                                "audio-transcribe-and-diarize"
                              ]
                            }
                          },
                          "required": ["field"]
                        }
                      },
                      "actions": {
                        "description": "Installed-action slugs (or ids) to run once preprocessing completes.",
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "callbackUrl": {
                        "description": "Webhook URL. Deliveries are signed: `x-rk1-signature` is a compact ES256 JWT (claims processingId, eventId, type, bodySha256) verifiable against GET /process/jwks.json.",
                        "type": "string",
                        "format": "uri"
                      },
                      "durationSeconds": {
                        "default": 86400,
                        "description": "Retention TTL in seconds before auto-purge. Max 604800 (7d).",
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 604800
                      }
                    },
                    "description": "The JSON-encoded `options` multipart part."
                  },
                  "files": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary",
                      "contentEncoding": "binary"
                    },
                    "description": "The files to process, one multipart part each (part name `files`)."
                  }
                },
                "required": ["options", "files"]
              },
              "encoding": {
                "options": {
                  "contentType": "application/json"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Pipeline accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateProcessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed multipart body or options."
          },
          "403": {
            "description": "Caller is neither an org admin nor an org API key."
          }
        }
      }
    },
    "/process/{id}": {
      "get": {
        "operationId": "getProcess",
        "summary": "Get processing status / results",
        "tags": ["Process"],
        "description": "Returns the pipeline status and, via `?include=content,results,evidence` and `?format=json|markdown`, the inlined parsed content, action results and grounding evidence. 410 once the TTL has expired (grace window), 404 after grace or for an unknown id.",
        "responses": {
          "200": {
            "description": "Current status (and requested includes).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcessStatus"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [false]
                    },
                    "error": {
                      "type": "array",
                      "items": {}
                    },
                    "data": {}
                  },
                  "required": ["success", "error", "data"]
                }
              }
            }
          },
          "404": {
            "description": "Unknown processing id."
          },
          "410": {
            "description": "Processing expired (within grace window)."
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "include",
            "schema": {
              "example": "content,results",
              "type": "string"
            },
            "description": "Comma-separated: `content`, `results`, `evidence`."
          },
          {
            "in": "query",
            "name": "format",
            "schema": {
              "default": "json",
              "type": "string",
              "enum": ["json", "markdown"]
            },
            "description": "Content representation for `include=content` (audio files have no markdown)."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "purgeProcess",
        "summary": "Purge a processing pipeline",
        "tags": ["Process"],
        "description": "Cancels any in-flight work and purges the files, runs and stored results.",
        "responses": {
          "204": {
            "description": "Purged."
          },
          "404": {
            "description": "Unknown processing id."
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    }
  }
}
