Getting Started Tutorial
This tutorial provides a step-by-step guide to using the Extracton API. We have provided sample files you can use to follow along.
Before you start, ensure that you have:
-
Input and output buckets with the correct permissions
- Access and Secret Access keys for these buckets
- (Optional) STS Role ARNs for generating STS credentials
-
An emtelligent-provided API Key
-
Pipeline name
-
Sample files for the tutorial (Click to download: tutorial.zip).
Quick Start Option: Download tutorial.py to run the complete end-to-end workflow automatically. Simply configure your credentials and execute the script to upload files, submit a job, monitor progress, and collect outputs.
Manual Step-by-Step Option: Follow the detailed instructions below to understand each API call individually.
For more information see Getting Set Up.
The key steps in the data flow is outlined in this image:

Notice that key actions must be initiated by the customer to transition the job its stages through from start to finish. The actions you must take are:
- Upload Files to the Input Bucket
- Post a job request
- Get job status
- Collect outputs
The next sections below provide detailed explanations of each step, including code snippets and curl commands.
In the following sections, we use hard-coded API keys/passwords for readability. When implementing this in your own project, it is strongly recommended that you replace these with securely-managed secrets (as per your organizations security policy).
Upload Files to Input Bucket
Sample manifest and PDF files
tutorial.zip
- Download the sample files and save them to a local directory e.g.
~/tutorial - Upload the files to your input bucket and note the manifest file’s S3 key
- IMPORTANT: Ensure the document values in your manifest match the exact S3 keys where your PDF files are stored
Generate STS Credentials
A secure way to provide emtelligent with credentials we need to access files in your input bucket is to use AWS Security Token Service (STS). We recommend that you use STS to generate temporary, limited-privilege security credentials. However, you may also choose use regular AWS credentials: the same secret and access keys you used to upload files to your input.
The following explains how to issue a STS credentials using AWS S3 boto3 sdk, follow these steps:
- Get STS Role ARN for input bucket
- Assume the role and get the STS credentials
Query for Pipeline Parameters
This step is optional. You can look up the supported parameters in this documentation. For example, for the Core Clinical pipelines, the supported extraction types are documented here.
However, a discovery endpoint is provided so you can programmatically to find the parameters that a pipeline supports.
How to discover a pipeline’s parameters:
- Get the pipeline name for which you have access(e.g.
core_clinicalor as provided by emtelligent support during onboarding) - Call GET
/api/v1/pipelines/:pipeline_name/pipeline_paramswith:- API key in the
X-API-Keyheader pipeline_namein the path parameters
- API key in the
The response will include the pipeline parameter names and values as required by your pipeline configuration, for example:
Post a Job Request
Now we will start a job using the API. Submit a job by calling POST on this API route /api/v1/jobs.
Provide the following in the request body:
- API key in the
X-API-Keyheader - AWS STS credentials in the request body
- File manifest S3 key
- input bucket AWS region
- Pipeline name and extraction parameters
Below is an example of request body, and how to post the job request using CURL or Python.
Sample Request body
Sample CURL Command
Sample Python Function
Sample Response
Get Job Status
A pipeline can take a while to complete depending on the number of documents in the manifest and the extractions to be performed. You need to check the status of the job by calling the GET /api/v1/jobs/{job_id}/status endpoint, so that you can start downloading the output as soon as the pipeline finishes and the job status is transitioned to completed.
You will not be able to collect the outputs via the POST /api/v1/jobs/:job_id/collect until the job is completed
Sample CURL Command
Sample Python Function
Sample Response
Collect Outputs
After the job is complete, you can call POST /api/v1/jobs/:job_id/collect to transfer final outputs to output bucket. You will need to provide the following: - an API key in the X-API-Key header - STS credentials for output bucket in the request body - optionally, S3 prefix in the output bucket where the outputs should be saved
Sample Request body
Sample CURL command
Sample Python function
The final outputs can be found in your output bucket at the prefix you specified:
Error Handling and Troubleshooting Tips
These are the common errors you may encounter:
- UNAUTHORIZED: The provided AWS credentials are invalid or have expired
- INVALID_INPUT: The pipeline name does not match any existing pipelines
- INVALID_DATA: Input data validation against the manifest has failed; one or more data contract requirements were not met
When you received INVALID_INPUT or INVALID_DATA error, the job is failed preemptively. More information is provided in the response, under job details. Please correct the issue and submit a new job.

