The Unstructured Partition Endpoint, part of the Unstructured API, is intended for rapid prototyping of Unstructured’s various partitioning strategies, with limited support for chunking. It is designed to work only with processing of local files, one file at a time. Use the Unstructured Workflow Endpoint for production-level scenarios, file processing in batches, files and data in remote locations, generating embeddings, applying post-transform enrichments, using the latest and highest-performing models, and for the highest quality results at the lowest cost.
To call the Unstructured Partition Endpoint, you need an Unstructured account and an Unstructured API key:
Sign in to your Unstructured account:
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.
Unstructured offers three account pricing plans:
For more details, see the Unstructured Pricing page.
Some of these plans are billed on a per-page basis.
Unstructured calculates a page as follows:
.pdf
, .pptx
, and .tiff
..docx
files that have page metadata, Unstructured calculates the number of pages based on that metadata.This example uses the curl utility on your local machine to call the Unstructured Partition Endpoint. It sends a source (input) file from your local machine to the Unstructured Partition Endpoint which then delivers the processed data to a destination (output) location, also on your local machine. Data is processed on Unstructured-hosted compute resources.
If you do not have a source file readily available, you could use for example a sample PDF file containing the text of the United States Constitution, available for download from https://constitutioncenter.org/media/files/constitution.pdf.
Set environment variables
From your terminal or Command Prompt, set the following two environment variables.
Replace <your-unstructured-api-url>
with the Unstructured Partition Endpoint URL. This URL was provided to you when your Unstructured account was created.
If you do not have this URL, contact Unstructured Sales at sales@unstructured.io.
The default URL for the Unstructured Partition Endpoint is https://api.unstructuredapp.io/general/v0/general
.
However, you should always use the URL that was provided to you when your Unstructured account was created.
Replace <your-unstructured-api-key>
with your Unstructured API key, which you generated earlier on this page.
Run the curl command
Run the following curl
command, replacing <path/to/file>
with the path to the source file on your local machine.
If the source file is not a PDF file, then remove ;type=application/pdf
from the final --form
option in this command.
Examine the results
After you run the curl
command, the results are printed to your terminal or Command Prompt. The command might take several
minutes to complete.
By default, the JSON is printed without indenting or other whitespace. You can pretty-print the JSON output by using utilities such as jq in future command runs.
You can also pipe the JSON output to a local file by using the curl
option -o, —output <file> in future command runs.
You can also call the Unstructured Partition Endpoint by using the Unstructured Python SDK or the Unstructured JavaScript/TypeScript SDK.
The Unstructured Partition Endpoint, part of the Unstructured API, is intended for rapid prototyping of Unstructured’s various partitioning strategies, with limited support for chunking. It is designed to work only with processing of local files, one file at a time. Use the Unstructured Workflow Endpoint for production-level scenarios, file processing in batches, files and data in remote locations, generating embeddings, applying post-transform enrichments, using the latest and highest-performing models, and for the highest quality results at the lowest cost.
To call the Unstructured Partition Endpoint, you need an Unstructured account and an Unstructured API key:
Sign in to your Unstructured account:
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.
Unstructured offers three account pricing plans:
For more details, see the Unstructured Pricing page.
Some of these plans are billed on a per-page basis.
Unstructured calculates a page as follows:
.pdf
, .pptx
, and .tiff
..docx
files that have page metadata, Unstructured calculates the number of pages based on that metadata.This example uses the curl utility on your local machine to call the Unstructured Partition Endpoint. It sends a source (input) file from your local machine to the Unstructured Partition Endpoint which then delivers the processed data to a destination (output) location, also on your local machine. Data is processed on Unstructured-hosted compute resources.
If you do not have a source file readily available, you could use for example a sample PDF file containing the text of the United States Constitution, available for download from https://constitutioncenter.org/media/files/constitution.pdf.
Set environment variables
From your terminal or Command Prompt, set the following two environment variables.
Replace <your-unstructured-api-url>
with the Unstructured Partition Endpoint URL. This URL was provided to you when your Unstructured account was created.
If you do not have this URL, contact Unstructured Sales at sales@unstructured.io.
The default URL for the Unstructured Partition Endpoint is https://api.unstructuredapp.io/general/v0/general
.
However, you should always use the URL that was provided to you when your Unstructured account was created.
Replace <your-unstructured-api-key>
with your Unstructured API key, which you generated earlier on this page.
Run the curl command
Run the following curl
command, replacing <path/to/file>
with the path to the source file on your local machine.
If the source file is not a PDF file, then remove ;type=application/pdf
from the final --form
option in this command.
Examine the results
After you run the curl
command, the results are printed to your terminal or Command Prompt. The command might take several
minutes to complete.
By default, the JSON is printed without indenting or other whitespace. You can pretty-print the JSON output by using utilities such as jq in future command runs.
You can also pipe the JSON output to a local file by using the curl
option -o, —output <file> in future command runs.
You can also call the Unstructured Partition Endpoint by using the Unstructured Python SDK or the Unstructured JavaScript/TypeScript SDK.