Skip to main content

GET /api/history/documents

List recent processed documents for the authenticated user.

Authentication

Requires valid JWT access token in Authorization header.

Query Parameters

limit
integer
default:"50"
Maximum number of documents to return (1-100)

Response

documents
array
Array of document summaries
total
integer
Total number of documents returned

Example Request

cURL
curl -X GET 'http://localhost:8000/api/history/documents?limit=20' \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Example Response

{
  "documents": [
    {
      "id": "789e4567-e89b-12d3-a456-426614174000",
      "title": "Annual Report 2024",
      "file_path": "https://example.com/report.pdf",
      "file_source_type": "url",
      "status": "success",
      "tags": ["annual-report", "financial-data", "2024"],
      "processed_at": "2024-01-15T10:35:00Z",
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "total": 1
}

GET /api/history/documents/

Get detailed information about a specific document including extracted text and processing metadata.

Authentication

Requires valid JWT access token. User must be the owner of the document.

Path Parameters

doc_id
uuid
required
Unique identifier of the document

Response

id
uuid
Document identifier
job_id
uuid
ID of the job that processed this document
title
string
Document title
file_path
string
Path or URL to the document
file_source_type
string
Source type: url, s3, local
file_size
integer
File size in bytes
mime_type
string
MIME type (e.g., application/pdf)
status
string
Processing status
tags
array
Generated metadata tags
extracted_text
string
Full extracted text from the document
processing_metadata
object
Metadata about how the document was processed
error_message
string
Error message if processing failed
processed_at
datetime
When document was processed
created_at
datetime
When document record was created

Example Request

cURL
curl -X GET 'http://localhost:8000/api/history/documents/789e4567-e89b-12d3-a456-426614174000' \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

GET /api/history/documents/search

Search documents by title or tags.

Authentication

Requires valid JWT access token.

Query Parameters

query
string
required
Search query (minimum 1 character)
limit
integer
default:"50"
Maximum number of documents to return (1-100)

Response

Same format as GET /api/history/documents

Example Request

cURL
curl -X GET 'http://localhost:8000/api/history/documents/search?query=annual%20report&limit=10' \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Search Behavior

  • Searches in document title and tags
  • Case-insensitive partial matching
  • Returns results sorted by relevance

Error Responses

StatusDescription
400Bad Request - Query parameter missing or too short
401Unauthorized - Invalid or missing token
500Internal Server Error

Build docs developers (and LLMs) love