Chat history

To get the chat history of a PDF you need docId of that PDF.

Using /v1/history API you can get the complete chat history in the desired number of pages and in the desired order.

Ensure that when you call the Chat with PDF API, you set save_chat to true to let the chat history to be saved.

Chat history of a PDF

POST https://pdf.ai/api/v1/history

To get the chat history of the PDF using its docId

Headers

Name
Type
Description

X-API-Key*

string

<API-Key>

Request Body

Name
Type
Description

docId*

string

Document ID obtained after uploading PDF

resultsPerPage

number

Number of results you want per page. Default: 10. Max: 100

pageNumber

number

Page number you want results from Default: 1

sortOrder

string

Order of the messages "asc" for ascending, "desc" for descending Default: "desc"

{
    "messages": [
        {
            "role": "assistant",
            "content": "It is in Japan",
            "createdAt": "2024-10-16T06:58:03.044Z",
            "references": [
              {
                 "pageNumber": 1,
                 "fromLine": 41,
                 "toLine": 48
              }
             ]
        },
        {
            "role": "user",
            "content": "Where is Tokyo?",
            "createdAt": "2024-10-16T06:58:03.043Z",
            "references": []
        }
    ],
    "totalMessages": 8,
    "totalPages": 1,
    "currentPage": 1
}

Last updated

Was this helpful?