Skip to main content

Generate sample code

After you connect your AI tool to the Transform MCP server and have Transform parse your source files to produce the kind of output you want, you can ask the Unstructured Transform MCP server to generate sample curl or Python code based on the parsing process that Transform just ran. You can then use this code to run Transform in your production environment at scale. To get this code, ask your AI tool the following, depending on whether you want curl or Python code:
To generate the curl code as downloadable shell script (.sh) files, ask your AI tool the following:
Provide a complete set of curl code that shows how to 
perform the parsing process that the Unstructured Transform MCP server 
just ran on these source files. Provide the code as downloadable shell 
script (`.sh`) files.

For reference, use the Unstructured API quickstarts 
and documentation at 
https://docs.unstructured.io/api-reference/quickstart/* and 
https://docs.unstructured.io/api-reference/workflow/*
To write the curl code to your associated project as shell script (.sh) files , ask your AI tool the following:
Provide a complete set of curl code that shows how to 
perform the parsing process that the Unstructured Transform MCP server 
just ran on these source files. Write the code to the associated project 
as shell script (`.sh`) files.

For reference, use the Unstructured API quickstarts 
and documentation at 
https://docs.unstructured.io/api-reference/quickstart/* and 
https://docs.unstructured.io/api-reference/workflow/*
See the next section for how to run this code locally.

Run sample code

If your local development environment is already set up, skip ahead to get your Unstructured API key and URL.
Before you can run the generated example curl or Python code, you must set up your local development environment. This includes installing curl or Python locally, installing the Unstructured Python SDK locally if you’re using Python, and defining and setting two unique local environment variables, which the example code refers to and relies upon.

Install curl

curl installation instructions vary by operating system and download manager utility. See the curl Download page or the documentation for your operating system or download manager utility.

Install Python and the SDK

Python installation instructions vary by operating system and download manager utility. See the Download Python page or the documentation for your operating system or download manager utility. Unstructured recommends that you install the Python SDK into a Python virtual environment, such as uv. This enables you to isolate and manage various Python package dependencies for your Python projects. Learn more about Python virtual environments. To download and install the Unstructured Python SDK by using uv, run a command such as the following from within a uv virtual environment:
uv add unstructured-client
For Python package managers other than uv, see your package manager provider’s documentation.

Define environment variables

Your local development environment must have access to the following two environment variables:
  • UNSTRUCTURED_API_KEY, which represents the programmatic access identifier for your user account in the Transform service. Each call to the Transform service requires this identifier so that the correct user account is billed (or any remaining free page counts are reduced) accordingly.
  • UNSTRUCTURED_API_URL, which represents the programmatic API endpoint for the Unstructured Transform service. This service contains the file parsing logic and orchestrates all file processing jobs.
To define these environment variables (for example, by setting an export or setx command or equivalent), see your environment’s documentation. To set these environment variables to the appropriate values, see the following sections.

Get your Unstructured API key and URL

  1. Sign in to Unstructured Transform, if you have not already done so, at https://transform.unstructured.io
  2. If the Get started page is not visible, on the sidebar, click Get started.
  3. In the Get your API key area, get the value of your Unstructured API key. Click the pages icon (Copy) to copy this value to your system’s clipboard.
  4. Set your UNSTRUCTURED_API_KEY environment variable to this value.
  5. Next to your API key, get the value of your Unstructured API URL, which should be https://platform-api.transform.unstructured.io/api/v1
  6. Set your UNSTRUCTURED_API_URL environment variable to this value.

View Transform API documentation

Unstructured Transform uses the Unstructured API. To view the related API reference documentation, see the following:

Next steps

  • Transform quickstart: Install the Unstructured Transform MCP server, drag and drop files, and have Transform start producing partitioned and enriched data based on your files in minutes.
  • Control Transform file parsing output: Control how the Unstructured Transform MCP server instructs Transform to partition, enrich, chunk, and embed the data based on your files.