Documents

Find text in the uploaded PDF, with page sizes

Returns every page size and, when text is given, each place it appears: page, box in points from the top-left, and the line it sits on. Flat PDFs carry no form fields to read positions from; this is how a caller that cannot see the page finds the signature line.

get/api/v1/documents/{id}/text

Request

  • Base URL: https://api.korala.ai
  • URL: https://api.korala.ai/api/v1/documents/{id}/text
  • Auth: one of:
    • API key in header X-API-Key
    • bearer (a scheme the document does not define)

Path parameters

idstring required

Query parameters

textstring
Example:Tenant signature

Text to look for. Matching ignores case and collapses whitespace, and a phrase must sit on one line. Omit it to get the page sizes only.

textsstring[]

Several phrases in one request (?texts=Signature&texts=Date), up to ten. The file is downloaded and parsed once for all of them, so ask together for what you would otherwise ask for one at a time. Each match says which phrase it is for, and occurrence counts per phrase.

[
  "Signature",
  "Date"
]

Response

pageCountnumber required

Pages in the document, searched or not

totalMatchesnumber required

Matches found for all the phrases together, which may exceed those listed; counts has the total for each phrase

hasTextboolean required

False when the PDF has no text layer (a scan): nothing can be found in it, so fields need coordinates

Example response

{
  "pages": [
    {
      "pageNumber": 1,
      "width": 612,
      "height": 792
    }
  ],
  "matches": [
    {
      "text": "Signature",
      "occurrence": 1,
      "pageNumber": 1,
      "line": "Tenant signature: ______________  Date: ________"
    }
  ],
  "counts": [
    {
      "text": "Signature",
      "total": 2
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.