Document Analysis API

The Document Analysis API provides advanced document processing capabilities, including text extraction, document parsing, and ID document verification. This API works with files that have been previously uploaded using the Uploads API.

Analyze Document

POST /v1/document-analysis/analyze

Analyzes a document synchronously, extracting text and other information.

Request

fileKey
string
required

The key of the file in storage (obtained from Uploads API)

Response

success
boolean

Indicates if the analysis was successful

data
object

Contains the analysis results

Examples

curl -X POST https://api.gridlogs.co/v1/document-analysis/analyze \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "fileKey": "private/1234567890/document.pdf"
  }'

Analyze Document Asynchronously

POST /v1/document-analysis/analyze-async

Analyzes a document asynchronously, providing more detailed extraction results.

Request

fileKey
string
required

The key of the file in storage (obtained from Uploads API)

Response

success
boolean

Indicates if the analysis was initiated successfully

data
object

Contains the analysis results

data.blockCount
number

Number of text blocks detected in the document

data.textContent
array

Array of extracted text content

data.blocks
array

Detailed blocks of text with position information

data.tables
array

Detected tables in the document

data.forms
array

Detected form fields in the document

Examples

curl -X POST https://api.gridlogs.co/v1/document-analysis/analyze-async \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "fileKey": "private/1234567890/document.pdf"
  }'

Analyze ID Document

POST /v1/document-analysis/analyze-id

Analyzes an ID document, extracting identity information.

Request

fileKey
string
required

The key of the file in storage (obtained from Uploads API)

Response

success
boolean

Indicates if the analysis was successful

data
object

Contains the ID document analysis results

Examples

curl -X POST https://api.gridlogs.co/v1/document-analysis/analyze-id \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "fileKey": "private/1234567890/passport.jpg"
  }'

Parse Document

GET /v1/document-analysis/parse/{fileKey}

Analyzes and parses a document, providing a summary of the document content.

Path Parameters

fileKey
string
required

The key of the file in storage

Response

success
boolean

Indicates if the parsing was successful

data
object

Contains the parsing results

data.textContent
array

Array of extracted text content

data.blockCount
number

Number of text blocks detected in the document

data.tableCount
number

Number of tables detected in the document

data.formCount
number

Number of form fields detected in the document

Examples

curl -X GET "https://api.gridlogs.co/v1/document-analysis/parse/private%2F1234567890%2Fdocument.pdf" \
  -H "X-API-Key: your_api_key_here"