Chat with PDF

To chat with a PDF you need docId of the PDF. To get docId upload the PDF first.

Using the save_chat option you can save chat history and can find the same in PDF.ai/documents/<docId>

To delete the chat you need to delete the PDF document using delete API.

If you are in our Enterprise plan, then you can make use of the powerful GPT-4 model to get better answers using use_gpt4 field in the request body.

Note: There use to be chatId field previously for saving chat but now it's deprecated. You just need to use save_chat field in order to save your chat history now.

Chat with PDF

Chat with a PDF

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

Ask questions to get responses from the PDF using docId

Headers

NameTypeDescription

X-API-Key*

string

<API-key>

Request Body

NameTypeDescription

docId*

string

Document ID obtained after uploading PDF

save_chat

boolean

Option to save chat history

message*

string

Message or question you want to get answer from PDF

use_gpt4

boolean

To get response using GPT-4 model (only available for Enterprise users with extra cost)

language

string

Response language e.g., "french"

{
   "content": "This is the answer to your message or question",
   "references": [
      {
         "pageNumber": 71,
         "fromLine": 41,
         "toLine": 48
      }
   ]
}

Last updated