PDF.ai API - Chat with PDF using AI
HomeSign in
  • Welcome to PDF.ai API
  • Quick start
  • Reference
    • Upload PDF
      • OCR an uploaded PDF
      • Update tags for an uploaded PDF
    • Get all documents
    • Get single document
    • Summarize PDF
    • Chat with PDF
    • Chat with all PDFs
    • Delete PDF
    • Chat history
    • API limits
    • AI Tools
      • Invoice JSON
      • Resume scanner
Powered by GitBook
On this page
  • Invoice
  • Invoice JSON

Was this helpful?

  1. Reference
  2. AI Tools

Invoice JSON

PreviousAI ToolsNextResume scanner

Last updated 10 months ago

Was this helpful?

To get the invoice data in JSON format, you need docId of the PDF. To get docId the PDF first.

The invoice result will not be saved as a Chat. To save your chat history use API

Invoice

Invoice JSON

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

Get desired JSON formatted responses from the invoice PDF using docId

Headers

Name
Type
Description

X-API-Key*

string

<API-key>

Request Body

Name
Type
Description

docId*

string

Document ID obtained after uploading PDF

message*

string

Your query or JSON format details

use_gpt4

boolean

To get response using GPT-4 model. Default model: gpt-4-turbo

model

string

To choose GPT-4 model "gpt-4o" or "gpt-4-turbo"(default). gpt-4o message costs 2 credits, gpt-4-turbo message costs 4 credits.

{
  "content": {
    "products": [
      {
        "name": "First product",
        "quantity": 30
      },
      {
        "name": "Second product",
        "quantity": 20
      }
    ]
  }
}
{
    "error": "Invalid API key"
}
{
    "error": "No API key present"
}
{
    "error": "Failed to get JSON formatted answer, try again!"
}

upload
chat