Basics

Whether you’re using the free Unstructured API, the Unstructured Serverless API, Unstructured API on Azure/AWS or your local deployment of Unstructured API, you can work with the API by sending POST requests to it. You will need:

These environment variables:

  • UNSTRUCTURED_API_KEY - Your Unstructured API key value.
  • UNSTRUCTURED_API_URL - Your Unstructured API URL.

Get your API key and API URL.

Let’s start with a simple example in which you send an email file (*.eml) to partition via Unstructured API.

 curl -X 'POST' \
  '$UNSTRUCTURED_API_URL' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -H 'unstructured-api-key: $UNSTRUCTURED_API_KEY' \
  -F 'files=@sample-docs/family-day.eml'

In the example above we’re sending the request to the Free Unstructured API, in which case the API URL is the same for all users: https://api.unstructured.io/general/v0/general and is represented by the environment variable UNSTRUCTURED_API_URL. Note, however, that you still need to authenticate yourself with your individual API Key, represented by the environment variable UNSTRUCTURED_API_KEY. Learn how to obtain an API key in the Getting Started section of the documentation: Free Unstructured API guide and Unstructured Serverless API guide.

If you are using the Unstructured Serverless API, you need to replace the URL in this example with the unique API URL that you have received in the same email as your API key. For Unstructured API on Azure/AWS, use the API URL that you configured through those services.

Unstructured does not recommend POST to process multiple files at a time. Instead, use the Unstructured CLI or the Unstructured Python SDK with their provided source connectors and destination connectors.

Parameters & examples

The API parameters are the same across all methods of accessing the Unstructured API.

  • Refer to the API parameters page for the full list of available parameters.
  • Refer to the Examples page for some inspiration on using the parameters.