Skip to main content

Search API

Full-text search across OCR text of completed documents owned by the authenticated user.


GET /v1/search

Search across all OCR text using PostgreSQL full-text search with stemming and relevance ranking.

Query Parameters:

ParameterRequiredDefaultMaxDescription
qYes----Search query string
limitNo50200Number of results to return
offsetNo0--Number of results to skip

Example:

curl -s "https://api.openesl.com/v1/search?q=dallas+shipping&limit=10" \
-H "Authorization: Bearer $TOKEN"

Response (200):

{
"items": [
{
"document_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"received_at": "2026-02-21T15:30:16.258193+00:00",
"snippet": "...BOL Number: BOL-2026-04521\n\nSHIPMENT DETAILS...",
"score": 7.6
}
],
"paging": {
"limit": 10,
"offset": 0,
"total": 3
}
}

Response Fields

FieldTypeDescription
document_idUUIDID of the matching document
received_atDateTimeWhen the document was uploaded
snippetStringText excerpt (15-35 words) around the matching terms
scoreFloatRelevance score (0-99.9, higher is more relevant)

Search Behavior

  • Stemming: "shipping" matches "ship", "shipped", "shipment"
  • Case-insensitive: "Dallas" matches "dallas", "DALLAS"
  • Stop words: Common English words (the, a, is) are ignored
  • Multiple terms: All terms must appear in the document (AND logic)
  • Ranking: Results sorted by relevance score (descending)

Scope

  • Only searches documents owned by the authenticated user
  • Only searches documents with status completed
  • Searches the original OCR text (not revised text)

Errors

StatusCodeCondition
400QUERY_REQUIREDMissing q parameter
401UNAUTHORIZEDMissing or invalid token