POST
/
api
/
v1
/
documents
/
answer
curl --request POST \
  --url https://api.fieldwise.ai/api/v1/documents/answer \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '{
  "format": "MARKDOWN",
  "metadata_filter": {
    "$and": [
      {
        "category": "finance"
      },
      {
        "priority": {
          "$gt": 2
        }
      },
      {
        "tags": {
          "$contains": [
            "important"
          ]
        }
      }
    ]
  },
  "question": "What is the main topic of the document?"
}'
{
  "success": true,
  "data": {
    "answer": "<string>",
    "sources": [
      {
        "document_id": 123,
        "page_number": 123,
        "paragraph_id": 123,
        "paragraph_index": 123,
        "highlight_sentences": [
          {}
        ],
        "relevance": "<string>",
        "document_metadata": {}
      }
    ],
    "format": "<string>",
    "optimized_question": "<string>",
    "optimized_metadata": {}
  },
  "error": {
    "error_code": "RESOURCE_NOT_FOUND",
    "message": "Resource not found"
  },
  "meta": {
    "timestamp": "2023-11-07T05:31:56Z",
    "version": "1.0"
  }
}

Authorizations

X-API-Key
string
header
required

Headers

X-API-Key
string | null

Body

application/json

Request model for asking questions about documents.

Response

200
application/json

Successful Response

The response is of type object.