{
  "name": "docanalyzer-ai-api",
  "version": "2025-01-16",
  "description": "The docAnalyzer.ai REST API. See the quick start and guide.",
  "server": {
    "baseUrl": "https://api.docanalyzer.ai/api/v1",
    "auth": {
      "kind": "bearer",
      "in": "header",
      "name": "Authorization",
      "prefix": "Bearer ",
      "envVar": "API_TOKEN"
    }
  },
  "tools": [
    {
      "name": "get_models",
      "description": "List all models",
      "inputSchema": {
        "type": "object",
        "properties": {}
      }
    },
    {
      "name": "get_models_options",
      "description": "List models filtered by options",
      "inputSchema": {
        "type": "object",
        "properties": {
          "options": {
            "type": "string",
            "description": "Comma-separated options (e.g., byok) that get an optional models list. If byok, the server returns the byok models."
          }
        },
        "required": [
          "options"
        ]
      }
    },
    {
      "name": "get_credits",
      "description": "List credits usage for the API key",
      "inputSchema": {
        "type": "object",
        "properties": {
          "start": {
            "type": "string",
            "format": "date-time",
            "description": "ISO start timestamp (inclusive). Defaults to the first day of the current month when omitted."
          },
          "end": {
            "type": "string",
            "format": "date-time",
            "description": "ISO end timestamp (exclusive). Defaults to the end of the month for the start date when omitted; max 31 days."
          },
          "reason": {
            "enum": [
              "chat",
              "chatbot",
              "api",
              "other"
            ],
            "type": "string",
            "description": "Filter by reason group. If omitted or invalid, returns all reasons."
          },
          "workspace": {
            "minimum": 0,
            "maximum": 32767,
            "type": "integer",
            "format": "int32",
            "description": "Filter by workspace id."
          },
          "limit": {
            "default": 100,
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "format": "int32",
            "description": "Maximum number of ledger entries to return."
          },
          "cursor": {
            "type": "string",
            "format": "date-time",
            "description": "Cursor for pagination. Use nextCursor from the previous response."
          }
        }
      }
    },
    {
      "name": "get_doc",
      "description": "List all documents in a given workspace",
      "inputSchema": {
        "type": "object",
        "properties": {
          "offset": {
            "default": 0,
            "type": "integer",
            "format": "int32"
          },
          "limit": {
            "default": 100,
            "type": "integer",
            "format": "int32"
          },
          "da-workspace": {
            "default": 0,
            "minimum": 0,
            "maximum": 32767,
            "type": "integer",
            "description": "The workspace to use"
          }
        }
      }
    },
    {
      "name": "post_doc",
      "description": "Create a document from a URL",
      "inputSchema": {
        "type": "object",
        "properties": {
          "da-workspace": {
            "default": 0,
            "minimum": 0,
            "maximum": 32767,
            "type": "integer",
            "description": "The workspace to use"
          },
          "body": {
            "type": "object",
            "properties": {
              "url": {
                "description": "Publicly accessible URL to fetch the file from",
                "type": "string",
                "format": "uri"
              },
              "name": {
                "description": "Display name to use for the created document. If omitted, the URL will be used.",
                "type": "string"
              }
            },
            "required": [
              "url"
            ],
            "description": "Request body"
          }
        },
        "required": [
          "body"
        ]
      }
    },
    {
      "name": "post_doc_upload_options",
      "description": "Upload document(s)",
      "inputSchema": {
        "type": "object",
        "properties": {
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Comma-separated options (e.g.,sync) that modify upload behavior. If sync, the server wait document(s) analysis is ready to return."
          },
          "da-workspace": {
            "default": 0,
            "minimum": 0,
            "maximum": 32767,
            "type": "integer",
            "description": "The workspace to use"
          },
          "body": {
            "type": "object",
            "properties": {
              "file": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "description": "Request body"
          }
        },
        "required": [
          "options"
        ]
      }
    },
    {
      "name": "get_doc_docid",
      "description": "Get document information",
      "inputSchema": {
        "type": "object",
        "properties": {
          "docid": {
            "type": "string",
            "description": "The unique identifier of the document to retrieve"
          }
        },
        "required": [
          "docid"
        ]
      }
    },
    {
      "name": "put_doc_docid",
      "description": "Update document",
      "inputSchema": {
        "type": "object",
        "properties": {
          "docid": {
            "type": "string",
            "description": "The unique identifier of the document to update"
          },
          "body": {
            "type": "object",
            "properties": {
              "name": {
                "description": "The new display name for the document",
                "type": "string"
              },
              "metadata": {
                "description": "You can use this field to attach key-value data to a label/document. Up to 20 keys; keys up to 40 characters; values up to 200 characters; keys and values must be strings; keys may contain only letters and numbers.",
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": {
                  "maxLength": 200,
                  "type": "string"
                }
              }
            },
            "description": "Request body"
          }
        },
        "required": [
          "docid",
          "body"
        ]
      }
    },
    {
      "name": "delete_doc_docid",
      "description": "Delete document",
      "inputSchema": {
        "type": "object",
        "properties": {
          "docid": {
            "type": "string",
            "description": "The unique identifier of the document to delete"
          }
        },
        "required": [
          "docid"
        ]
      }
    },
    {
      "name": "get_doc_docid_link",
      "description": "Get a document link",
      "inputSchema": {
        "type": "object",
        "properties": {
          "docid": {
            "type": "string",
            "description": "The unique identifier of the document to retrieve"
          }
        },
        "required": [
          "docid"
        ]
      }
    },
    {
      "name": "post_doc_docid_chat",
      "description": "Chat with a document\n\nEach call starts a new conversation thread by default; concurrent calls do not interfere with each other. To continue an earlier conversation, capture the tid returned in the response and pass it back as tid in the next request. Only one chat may be in flight per tid at a time — a concurrent call on the same tid returns HTTP 423.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "docid": {
            "type": "string",
            "description": "The unique identifier of the document to chat with."
          },
          "body": {
            "type": "object",
            "properties": {
              "prompt": {
                "description": "The question for the AI.",
                "type": "string"
              },
              "tid": {
                "description": "Optional. Continue a previous conversation by passing the tid returned by an earlier call to this endpoint. Must belong to the same document. Omit to start a fresh thread (recommended for stateless / event-driven integrations).",
                "type": "string"
              },
              "dryrun": {
                "description": "If true, estimates the maximum credits the request might consume without processing it.",
                "default": false,
                "type": "boolean"
              },
              "model": {
                "description": "Specifies the AI model for generating the response. Default: 'gpt-4.1-mini'. Retrieve available model IDs via GET /models. Supports various providers and Bring Your Own Key (BYOK) models configured in your account.",
                "default": "gpt-4.1-mini",
                "type": "string"
              },
              "budget": {
                "description": "Maximum number of context tokens (from the prompt and document) to use for the prompt. Defaults and maximums vary by model (see GET /models).",
                "type": "number"
              },
              "pcap": {
                "description": "Maximum fraction of the context budget that the prompt (input) tokens are allowed to consume. From 5% to 60%.",
                "default": 0.1,
                "minimum": 0.05,
                "maximum": 0.6,
                "type": "number"
              },
              "thinking": {
                "description": "Specifies the reasoning process for compatible models. Refer to GET /models for valid values specific to each model.",
                "type": "string"
              },
              "page": {
                "description": "Indicates whether page number references from the source document should be included in the answer.",
                "default": true,
                "type": "boolean"
              },
              "ocap": {
                "description": "Sets the maximum number of tokens for the generated answer (output capacity). Defaults and maximums vary by model (see GET /models).",
                "default": 1024,
                "type": "number"
              },
              "adherence": {
                "description": "Controls how strictly the AI's response must adhere to the provided document's content.",
                "enum": [
                  "strict",
                  "high",
                  "balanced",
                  "low",
                  "free"
                ],
                "default": "balanced",
                "type": "string"
              },
              "lang": {
                "description": "Specifies the desired language for the AI's answer.",
                "enum": [
                  "English",
                  "Arabic",
                  "Chinese (Simplified)",
                  "Dutch",
                  "French",
                  "German",
                  "Hindi",
                  "Italian",
                  "Japanese",
                  "Korean",
                  "Portuguese",
                  "Russian",
                  "Spanish",
                  "Swedish",
                  "Turkish"
                ],
                "type": "string"
              },
              "byok": {
                "description": "Set to true to use a Bring Your Own Key (BYOK) model configured in your account.",
                "default": false,
                "type": "boolean"
              }
            },
            "required": [
              "prompt"
            ],
            "description": "Request body"
          }
        },
        "required": [
          "docid",
          "body"
        ]
      }
    },
    {
      "name": "post_doc_docid_ocr",
      "description": "Perform OCR (Optical Character Recognition).",
      "inputSchema": {
        "type": "object",
        "properties": {
          "docid": {
            "type": "string",
            "description": "The unique identifier of the document to perform ocr on"
          }
        },
        "required": [
          "docid"
        ]
      }
    },
    {
      "name": "get_label",
      "description": "List all labels in a given workspace",
      "inputSchema": {
        "type": "object",
        "properties": {
          "offset": {
            "default": 0,
            "type": "integer",
            "format": "int32"
          },
          "limit": {
            "default": 100,
            "type": "integer",
            "format": "int32"
          },
          "da-workspace": {
            "default": 0,
            "minimum": 0,
            "maximum": 32767,
            "type": "integer",
            "description": "The workspace to use"
          }
        }
      }
    },
    {
      "name": "post_label",
      "description": "Create a label",
      "inputSchema": {
        "type": "object",
        "properties": {
          "da-workspace": {
            "default": 0,
            "minimum": 0,
            "maximum": 32767,
            "type": "integer",
            "description": "The workspace to use"
          },
          "body": {
            "type": "object",
            "properties": {
              "name": {
                "description": "Display name for the label",
                "type": "string"
              },
              "metadata": {
                "description": "You can use this field to attach key-value data to a label/document. Up to 20 keys; keys up to 40 characters; values up to 200 characters; keys and values must be strings; keys may contain only letters and numbers.",
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": {
                  "maxLength": 200,
                  "type": "string"
                }
              },
              "docids": {
                "description": "Unique identifiers of documents associated with the label",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "color": {
                "description": "The hex color code of the label",
                "type": "string"
              }
            },
            "required": [
              "name",
              "color"
            ],
            "description": "Request body"
          }
        },
        "required": [
          "body"
        ]
      }
    },
    {
      "name": "post_label_labelid_upload_options",
      "description": "Upload documents associated with label(s)",
      "inputSchema": {
        "type": "object",
        "properties": {
          "labelid": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Label identifier(s) to associate documents with (labelid preferred; legacy UUID lid supported)."
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Comma-separated options (e.g.,sync) that modify upload behavior. If sync, the server wait document(s) analysis is ready to return."
          },
          "da-workspace": {
            "default": 0,
            "minimum": 0,
            "maximum": 32767,
            "type": "integer",
            "description": "The workspace to use"
          },
          "body": {
            "type": "object",
            "properties": {
              "file": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "description": "Request body"
          }
        },
        "required": [
          "labelid",
          "options"
        ]
      }
    },
    {
      "name": "get_label_labelid",
      "description": "Get label information",
      "inputSchema": {
        "type": "object",
        "properties": {
          "labelid": {
            "type": "string",
            "description": "The label identifier to retrieve (labelid preferred; legacy UUID lid supported)."
          }
        },
        "required": [
          "labelid"
        ]
      }
    },
    {
      "name": "put_label_labelid",
      "description": "Update label",
      "inputSchema": {
        "type": "object",
        "properties": {
          "labelid": {
            "type": "string",
            "description": "The label identifier to update (labelid preferred; legacy UUID lid supported)."
          },
          "body": {
            "type": "object",
            "properties": {
              "name": {
                "description": "The new display name for the label",
                "type": "string"
              },
              "metadata": {
                "description": "You can use this field to attach key-value data to a label/document. Up to 20 keys; keys up to 40 characters; values up to 200 characters; keys and values must be strings; keys may contain only letters and numbers.",
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": {
                  "maxLength": 200,
                  "type": "string"
                }
              },
              "color": {
                "description": "The new hex color code for the label",
                "type": "string"
              },
              "docids": {
                "type": "object",
                "properties": {
                  "tag": {
                    "description": "Tag the document(s) with this label",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "untag": {
                    "description": "Untag the document(s) with this label",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            },
            "description": "Request body"
          }
        },
        "required": [
          "labelid",
          "body"
        ]
      }
    },
    {
      "name": "delete_label_labelid",
      "description": "Delete label",
      "inputSchema": {
        "type": "object",
        "properties": {
          "labelid": {
            "type": "string",
            "description": "The label identifier to delete (labelid preferred; legacy UUID lid supported)."
          }
        },
        "required": [
          "labelid"
        ]
      }
    },
    {
      "name": "post_label_labelid_chat",
      "description": "Chat with all documents associated with a label\n\nEach call starts a new conversation thread by default; concurrent calls (e.g. one per logged event) run independently. To continue an earlier conversation, capture the tid returned in the response and pass it back as tid in the next request. Only one chat may be in flight per tid at a time — a concurrent call on the same tid returns HTTP 423.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "labelid": {
            "type": "string",
            "description": "The label identifier to chat with (labelid preferred; legacy UUID lid supported)."
          },
          "body": {
            "type": "object",
            "properties": {
              "prompt": {
                "description": "The question for the AI.",
                "type": "string"
              },
              "tid": {
                "description": "Optional. Continue a previous conversation by passing the tid returned by an earlier call to this endpoint. Must belong to the same label. Omit to start a fresh thread (recommended for stateless / event-driven integrations).",
                "type": "string"
              },
              "dryrun": {
                "description": "If true, estimates the maximum credits the request might consume without processing it.",
                "default": false,
                "type": "boolean"
              },
              "model": {
                "description": "Specifies the AI model for generating the response. Default: 'gpt-4.1-mini'. Retrieve available model IDs via GET /models. Supports various providers and Bring Your Own Key (BYOK) models configured in your account.",
                "default": "gpt-4.1-mini",
                "type": "string"
              },
              "budget": {
                "description": "Maximum number of context tokens (from the prompt and documents) to use for the prompt. Defaults and maximums vary by model (see GET /models).",
                "type": "number"
              },
              "pcap": {
                "description": "Maximum fraction of the context budget that the prompt (input) tokens are allowed to consume. From 5% to 60%.",
                "default": 0.1,
                "minimum": 0.05,
                "maximum": 0.6,
                "type": "number"
              },
              "thinking": {
                "description": "Specifies the reasoning process for compatible models. Refer to GET /models for valid values specific to each model.",
                "type": "string"
              },
              "page": {
                "description": "Indicates whether page number references from the source documents should be included in the answer.",
                "default": true,
                "type": "boolean"
              },
              "ocap": {
                "description": "Sets the maximum number of tokens for the generated answer (output capacity). Defaults and maximums vary by model (see GET /models).",
                "default": 1024,
                "type": "number"
              },
              "adherence": {
                "description": "Controls how strictly the AI's response must adhere to the provided documents' content.",
                "enum": [
                  "strict",
                  "high",
                  "balanced",
                  "low",
                  "free"
                ],
                "default": "balanced",
                "type": "string"
              },
              "lang": {
                "description": "Specifies the desired language for the AI's answer.",
                "enum": [
                  "English",
                  "Arabic",
                  "Chinese (Simplified)",
                  "Dutch",
                  "French",
                  "German",
                  "Hindi",
                  "Italian",
                  "Japanese",
                  "Korean",
                  "Portuguese",
                  "Russian",
                  "Spanish",
                  "Swedish",
                  "Turkish"
                ],
                "type": "string"
              },
              "byok": {
                "description": "Set to true to use a Bring Your Own Key (BYOK) model configured in your account.",
                "default": false,
                "type": "boolean"
              }
            },
            "required": [
              "prompt"
            ],
            "description": "Request body"
          }
        },
        "required": [
          "labelid",
          "body"
        ]
      }
    }
  ]
}