Try synchronous extraction

Try out the most commonly used endpoint, the /extract endpoint. This endpoint accepts a document (PDF or image file) and returns extracted data synchronously.

Audience

If you're new to APIs, use this tutorial to return meaningful document data from an example insurance quote.

To instead run a quick "hello world" API command without prerequisites, check out the quickstart.

Prerequisites

See prerequisites.

Run the request in Postman

Click through the following slides to see how to run a Sensible API request in the Postman web app. You'll need the code sample and the example PDF listed in the following steps.

If you don't want to click through the slides, follow these steps instead:

  1. Verify that you published the anyco config listed in the prerequisites to the Development environment (in the Sensible app, select the config and click Publish>Publish to Development).

    Click to enlargeClick to enlarge

  2. Copy the following code sample, and replace YOUR_API_KEY with your API key:

curl --request POST \
  --url 'https://api.sensible.so/v0/extract/auto_insurance_quote?environment=development' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/pdf' \
  --data-binary '@/PATH_TO_DOWNLOADED_PDF/auto_insurance_anyco.pdf'
  1. In your Postman workspace, click Import, select Raw text, paste the code sample, and follow the prompts to import to code sample.

Click to enlargeClick to enlarge

  1. Download the following example PDF, which works with the prerequisite auto_insurance_quote config:
auto_insurance_anycoDownload link
  1. Correct the path to the downloaded PDF: In the request, click the Body tab, select binary, then click Select file and select the PDF:

Click to enlargeClick to enlarge

  1. Click Send. The response includes a parsed_document object that looks something like the following:
{
    "parsed_document": {
        "policy_number": {
            "type": "string",
            "value": "123456789"
        },
        "policy_period": {
            "type": "string",
            "value": " April 14, 2021 - Oct 14, 2021"
        },
        "comprehensive_premium": {
            "source": "$150",
            "value": 150,
            "unit": "$",
            "type": "currency"
        }
    }
}

Note: Did you notice that this API call doesn't specify a config (anyco)? As a convenience, Sensible evaluates all the configs for the document type (auto_insurance_quote), and automatically chooses the one that fits best.


Did this page help you?