Skip to main content
POST
/
extraction
Extracts structured data from a Document
curl --request POST \
  --url https://api.totoy.ai/v1/extraction \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "rre-de-2025-04-07",
  "document": "JVBERi0xLjUNCiW1tbW1DQox...",
  "expand_abbreviations": false
}
'
{
  "fields": {
    "referral_diagnosis": {
      "content": "C61 - Castration-resistant prostate cancer in progress, N28.1 - Right renal cyst, F52.2 - Erectile dysfunction",
      "review": {
        "reasoning": "The referral diagnosis is clearly stated with multiple diagnoses. The referral is complete and no review is needed.",
        "recommended": false
      }
    },
    "ordered_procedure": {
      "content": "MRI of the prostate, CT of the abdomen, PSA test",
      "review": {
        "reasoning": "The ordered procedures are clearly stated. No review is needed.",
        "recommended": false
      }
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
enum<string>
required

The name of the model that will be used for the extraction. A model name without a date is an alias to the latest version of that model, i.e. rre-de always points to the latest version of rre-de.

Available options:
rre-de-2025-02-14,
rre-de-2025-03-31,
rre-de-2025-04-07,
rre-de
Example:

"rre-de-2025-04-07"

document
string<byte>
required

Base64-encoded contents of a document (PDF, JPG or PNG)

Example:

"JVBERi0xLjUNCiW1tbW1DQox..."

expand_abbreviations
boolean
default:false

If set to true, the extraction will expand abbreviations in the extracted fields.

Example:

false

Response

OK

fields
object
required

The extracted data fields and review recommendations. Each key represents a field name, and the value conforms to the ExtractionField schema.

Example:
{
  "referral_diagnosis": {
    "content": "C61 - Castration-resistant prostate cancer in progress, N28.1 - Right renal cyst, F52.2 - Erectile dysfunction",
    "review": {
      "reasoning": "The referral diagnosis is clearly stated with multiple diagnoses. The referral is complete and no review is needed.",
      "recommended": false
    }
  },
  "ordered_procedure": {
    "content": "MRI of the prostate, CT of the abdomen, PSA test",
    "review": {
      "reasoning": "The ordered procedures are clearly stated. No review is needed.",
      "recommended": false
    }
  }
}