Process an individual file by making a direct POST request
Watch the following 4-minute video to learn how to make POST requests to the Unstructured Partition Endpoint to process individual files:
Open the related notebook that is shown in the preceding video.
To make POST requests to the Unstructured Partition Endpoint, you will need:
These environment variables:
UNSTRUCTURED_API_KEY
- Your Unstructured API key value.UNSTRUCTURED_API_URL
- Your Unstructured API URL.
To get your API key, do the following:
-
Go to https://platform.unstructured.io and use your email address, Google account, or GitHub account to sign up for an Unstructured account (if you do not already have one) and sign into the account at the same time. The Unstructured user interface (UI) appears.
-
Get your Unstructured API key:
a. In the Unstructured UI, click API Keys on the sidebar.
b. Click Generate API Key.
c. Follow the on-screen instructions to finish generating the key.
d. Click the Copy icon next to your new key to add the key to your system’s clipboard. If you lose this key, simply return and click the Copy icon again.
By following the preceding instructions, you are signed up for a Developer pay per page account by default.
To save money, consider switching to a Subscribe & Save account instead. To save even more money, consider switching to an Enterprise account instead.
The API URL is https://api.unstructuredapp.io/general/v0/general
Let’s start with a simple example in which you use curl to send a local PDF file (*.pdf
) to partition via the Unstructured Partition Endpoint.
In this command, be sure to replace <path/to/file>
with the path to your local PDF file.
In the example above we’re representing the API endpoint with the environment variable UNSTRUCTURED_API_URL
. Note, however, that you also need to authenticate yourself with
your individual API Key, represented by the environment variable UNSTRUCTURED_API_KEY
. Learn how to obtain an API URL and API key in the Unstructured Partition Endpoint guide.
Parameters & examples
The API parameters are the same across all methods of accessing the Unstructured Partition Endpoint.
- 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.
Postman collection
Unstructured offers a Postman collection that you can import into Postman to make POST requests through a graphical user interface.
-
In your workspace, click Import.
-
In the Paste cURL, Raw text or URL box, enter the following URL, and then press
Enter
: -
On the sidebar, click Collections.
-
Expand Unstructured POST.
-
Click (Partition Endpoint) Basic Request.
-
On the Headers tab, next to
unstructured-api-key
, enter your Unstructured API key in the Value column. -
On the Body tab, next to
files
, click the Select files box in the Value column. -
Click New file from local machine.
-
Browse to and select the file that you want Unstructured to process.
-
Click Send. Processing could take several minutes.
To download the processed data to your local machine, in the response area, click the ellipses, and then click Save response to file.
Was this page helpful?