{
  "openapi": "3.1.0",
  "info": {
    "title": "Covara API",
    "description": "Integrating with Covara API for policy extraction, document ingestion, Vara agent turns, and usage reporting.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.covara.ai",
      "description": "Production"
    },
    {
      "url": "http://localhost:8888",
      "description": "Local development"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Health",
      "description": "Public service health checks."
    },
    {
      "name": "Policies",
      "description": "Policy type discovery and schema lookup."
    },
    {
      "name": "Extraction",
      "description": "Synchronous policy extraction requests."
    },
    {
      "name": "Jobs",
      "description": "Asynchronous extraction jobs."
    },
    {
      "name": "Documents",
      "description": "Document ingestion and processing status."
    },
    {
      "name": "Agent",
      "description": "Vara assistant conversations and tool requests."
    },
    {
      "name": "Usage",
      "description": "Token usage, cost, and job statistics."
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "tags": ["Health"],
        "summary": "Health check",
        "operationId": "getHealth",
        "security": [],
        "responses": {
          "200": {
            "description": "The API service is healthy.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["status", "service"],
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "service": {
                      "type": "string",
                      "example": "covara-api"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/ping": {
      "get": {
        "tags": ["Health"],
        "summary": "Authenticated ping",
        "operationId": "getV1Ping",
        "responses": {
          "200": {
            "description": "Authenticated API key metadata and timestamp.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PingResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/policies": {
      "get": {
        "tags": ["Policies"],
        "summary": "List policy types",
        "operationId": "listPolicyTypes",
        "description": "Returns all policy types available in the Covara schema registry.",
        "responses": {
          "200": {
            "description": "Available policy types.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PoliciesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/policies/{type}/schema": {
      "get": {
        "tags": ["Policies"],
        "summary": "Get a policy schema",
        "operationId": "getPolicySchema",
        "description": "Returns the JSON Schema representation for a policy type's structured extraction result.",
        "parameters": [
          {
            "$ref": "#/components/parameters/PolicyType"
          }
        ],
        "responses": {
          "200": {
            "description": "Policy JSON Schema.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicySchemaResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/extract/{policyType}": {
      "post": {
        "tags": ["Extraction"],
        "summary": "Run synchronous extraction",
        "operationId": "runSynchronousExtraction",
        "description": "Creates a high-priority extraction job for a non-batched policy type, waits for completion, and returns the structured result inline.",
        "parameters": [
          {
            "name": "policyType",
            "in": "path",
            "required": true,
            "description": "Policy type to extract. Batched policy types must use the Jobs API instead.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExtractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Extraction completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExtractResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "408": {
            "$ref": "#/components/responses/Timeout"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/jobs": {
      "post": {
        "tags": ["Jobs"],
        "summary": "Create an extraction job",
        "operationId": "createExtractionJob",
        "description": "Creates an asynchronous extraction job. This endpoint supports all policy types, including types that require batching.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateJobRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "An idempotency key matched an existing job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobCreatedResponse"
                }
              }
            }
          },
          "202": {
            "description": "Job accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobCreatedResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/jobs/{jobId}": {
      "get": {
        "tags": ["Jobs"],
        "summary": "Get extraction job status",
        "operationId": "getExtractionJob",
        "parameters": [
          {
            "$ref": "#/components/parameters/JobId"
          }
        ],
        "responses": {
          "200": {
            "description": "Job status and result data when available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobStatusResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/documents": {
      "get": {
        "tags": ["Documents"],
        "summary": "List documents",
        "operationId": "listDocuments",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": false,
            "description": "Optional search query.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum documents to return.",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Documents for the authenticated account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/documents/{documentId}/status": {
      "get": {
        "tags": ["Documents"],
        "summary": "Get document status",
        "operationId": "getDocumentStatus",
        "parameters": [
          {
            "$ref": "#/components/parameters/DocumentId"
          }
        ],
        "responses": {
          "200": {
            "description": "Document processing status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/documents/uploads": {
      "post": {
        "tags": ["Documents"],
        "summary": "Prepare a document upload",
        "operationId": "prepareDocumentUpload",
        "description": "Creates a document record and upload instructions for a client-side PDF upload.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrepareUploadRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Upload instructions created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrepareUploadResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/documents/uploads/complete": {
      "post": {
        "tags": ["Documents"],
        "summary": "Complete a document upload",
        "operationId": "completeDocumentUpload",
        "description": "Marks a prepared upload complete and queues extraction processing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompleteUploadRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Upload completion accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompleteUploadResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v1/documents/from-url": {
      "post": {
        "tags": ["Documents"],
        "summary": "Create a document from a URL",
        "operationId": "createDocumentFromUrl",
        "description": "Creates a document from a publicly accessible URL and queues extraction processing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFromUrlRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Document ingestion accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompleteUploadResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/agent/messages": {
      "post": {
        "tags": ["Agent"],
        "summary": "Run a Vara agent turn",
        "operationId": "runAgentTurn",
        "description": "Starts or continues a Vara assistant conversation and can optionally attach documents or request tools.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentMessageRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Agent turn completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentMessageResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          }
        }
      }
    },
    "/v1/agent/sessions/{sessionId}/messages": {
      "post": {
        "tags": ["Agent"],
        "summary": "Send a message to an existing Vara session",
        "operationId": "runAgentTurnInSession",
        "parameters": [
          {
            "$ref": "#/components/parameters/SessionId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentMessageRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Agent turn completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentMessageResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          }
        }
      },
      "get": {
        "tags": ["Agent"],
        "summary": "List Vara session messages",
        "operationId": "listAgentSessionMessages",
        "parameters": [
          {
            "$ref": "#/components/parameters/SessionId"
          }
        ],
        "responses": {
          "200": {
            "description": "Messages in the Vara session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentMessagesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "tags": ["Usage"],
        "summary": "Get API usage",
        "operationId": "getUsage",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "ISO 8601 start timestamp.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "ISO 8601 end timestamp.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "keyId",
            "in": "query",
            "required": false,
            "description": "Filter usage to a specific API key ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Usage totals and job statistics.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "vara API key"
      }
    },
    "parameters": {
      "DocumentId": {
        "name": "documentId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "JobId": {
        "name": "jobId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "PolicyType": {
        "name": "type",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "SessionId": {
        "name": "sessionId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The request could not be validated.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Forbidden": {
        "description": "The API key is valid but does not have access to this resource or scope.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "NotFound": {
        "description": "The requested resource was not found.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "RateLimited": {
        "description": "The API key has exceeded quota or rate limits.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Timeout": {
        "description": "The synchronous extraction request timed out.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "The Authorization header is missing or contains an invalid API key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Unprocessable": {
        "description": "The request was accepted but could not be processed successfully.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "AgentMessage": {
        "type": "object",
        "required": ["role", "content"],
        "properties": {
          "role": {
            "type": "string",
            "enum": ["user", "assistant"]
          },
          "content": {
            "type": "string"
          }
        }
      },
      "AgentMessageRequest": {
        "type": "object",
        "required": ["message"],
        "properties": {
          "agent": {
            "type": "string",
            "const": "vara"
          },
          "sessionId": {
            "type": "string",
            "format": "uuid"
          },
          "externalThreadId": {
            "type": "string"
          },
          "externalUserId": {
            "type": "string"
          },
          "idempotencyKey": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          },
          "message": {
            "type": "string",
            "minLength": 1
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentMessage"
            }
          },
          "documentIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "default": []
          },
          "searchScope": {
            "type": "string",
            "enum": ["none", "selected_documents", "account"]
          },
          "toolRequests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ToolRequest"
            }
          },
          "title": {
            "type": "string"
          }
        }
      },
      "AgentMessageResponse": {
        "type": "object",
        "description": "Vara agent turn result.",
        "additionalProperties": true
      },
      "AgentMessagesResponse": {
        "type": "object",
        "required": ["sessionId", "messages"],
        "properties": {
          "sessionId": {
            "type": "string",
            "format": "uuid"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "CompleteUploadRequest": {
        "type": "object",
        "required": ["documentId"],
        "properties": {
          "documentId": {
            "type": "string",
            "format": "uuid"
          },
          "jobId": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "CompleteUploadResponse": {
        "type": "object",
        "additionalProperties": true
      },
      "CreateFromUrlRequest": {
        "type": "object",
        "required": ["url", "documentType"],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "documentType": {
            "type": "string"
          },
          "coverageType": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "idempotencyKey": {
            "type": "string"
          }
        }
      },
      "CreateJobRequest": {
        "type": "object",
        "required": ["policyType"],
        "properties": {
          "policyType": {
            "type": "string"
          },
          "document": {
            "$ref": "#/components/schemas/DocumentInput"
          },
          "documentUrl": {
            "type": "string",
            "format": "uri",
            "description": "Legacy URL input. Prefer document.type=url."
          },
          "idempotencyKey": {
            "type": "string"
          },
          "webhook": {
            "type": "object",
            "required": ["url"],
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "secret": {
                "type": "string"
              }
            }
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "default": 0
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "Document": {
        "type": "object",
        "additionalProperties": true
      },
      "DocumentInput": {
        "type": "object",
        "required": ["type", "content"],
        "properties": {
          "type": {
            "type": "string",
            "enum": ["url", "base64"]
          },
          "content": {
            "type": "string",
            "description": "A public document URL or a base64-encoded PDF, depending on type."
          }
        }
      },
      "DocumentsResponse": {
        "type": "object",
        "required": ["documents"],
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Document"
            }
          }
        }
      },
      "DocumentStatus": {
        "type": "object",
        "additionalProperties": true
      },
      "ErrorResponse": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "required": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": true
      },
      "ExtractRequest": {
        "type": "object",
        "required": ["document"],
        "properties": {
          "document": {
            "$ref": "#/components/schemas/DocumentInput"
          },
          "options": {
            "type": "object",
            "properties": {
              "citationLevel": {
                "type": "string",
                "enum": ["full", "minimal", "none"],
                "default": "full"
              }
            }
          }
        }
      },
      "ExtractResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "additionalProperties": true
          },
          "metadata": {
            "type": "object",
            "properties": {
              "policyType": {
                "type": "string"
              },
              "jobId": {
                "type": "string",
                "format": "uuid"
              },
              "durationMs": {
                "type": ["integer", "null"]
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "JobCreatedResponse": {
        "type": "object",
        "required": ["jobId", "status", "idempotencyKey"],
        "properties": {
          "jobId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string"
          },
          "idempotencyKey": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "workflowId": {
            "type": "string"
          }
        }
      },
      "JobStatusResponse": {
        "type": "object",
        "required": ["jobId", "status", "policyType"],
        "properties": {
          "jobId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": ["pending", "processing", "completed", "failed"]
          },
          "policyType": {
            "type": "string"
          },
          "priority": {
            "type": "integer"
          },
          "attempts": {
            "type": "integer"
          },
          "maxAttempts": {
            "type": "integer"
          },
          "timestamps": {
            "type": "object",
            "additionalProperties": true
          },
          "progress": {
            "type": "object",
            "additionalProperties": true
          },
          "result": {
            "type": "object",
            "additionalProperties": true
          },
          "error": {
            "type": "object",
            "additionalProperties": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "PingResponse": {
        "type": "object",
        "required": ["message", "user", "timestamp"],
        "properties": {
          "message": {
            "type": "string",
            "example": "pong"
          },
          "user": {
            "type": "object",
            "additionalProperties": true
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PoliciesResponse": {
        "type": "object",
        "required": ["policies"],
        "properties": {
          "policies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Policy"
            }
          }
        }
      },
      "Policy": {
        "type": "object",
        "required": ["type", "label", "category", "requiresBatching"],
        "properties": {
          "type": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "complexityRating": {
            "type": ["string", "number", "null"]
          },
          "requiresBatching": {
            "type": "boolean"
          },
          "estimatedTokens": {
            "type": ["object", "null"],
            "properties": {
              "prompt": {
                "type": "integer"
              },
              "completion": {
                "type": "integer"
              }
            },
            "additionalProperties": true
          }
        }
      },
      "PolicySchemaResponse": {
        "type": "object",
        "required": ["type", "schema"],
        "properties": {
          "type": {
            "type": "string"
          },
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "PrepareUploadRequest": {
        "type": "object",
        "required": ["fileName", "documentType"],
        "properties": {
          "fileName": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "documentType": {
            "type": "string"
          },
          "coverageType": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "documentSize": {
            "type": "integer",
            "minimum": 0
          },
          "idempotencyKey": {
            "type": "string"
          }
        }
      },
      "PrepareUploadResponse": {
        "type": "object",
        "additionalProperties": true
      },
      "ToolRequest": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": {
            "type": "string"
          },
          "input": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "UsageResponse": {
        "type": "object",
        "required": ["usage", "bySource", "jobs", "period"],
        "properties": {
          "usage": {
            "type": "object",
            "additionalProperties": true
          },
          "bySource": {
            "type": "object",
            "properties": {
              "web": {
                "type": "integer"
              },
              "api": {
                "type": "integer"
              }
            },
            "additionalProperties": true
          },
          "jobs": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": ["string", "null"],
                "format": "date-time"
              },
              "to": {
                "type": ["string", "null"],
                "format": "date-time"
              }
            }
          }
        }
      }
    }
  }
}
