Troubleshooting Unstructured API keys and URLs
Issue
When you run script or code to call an Unstructured API, you might get one of the following warnings or errors:
You might also get the following related warnings or errors in your logs:
Possible causes
- The Unstructured API key, API URL, or both are missing or malformed in your script or code.
- The API key, API URL, or both are not present in your current session.
- The API key is no longer valid, or the API key and API URL combination is not valid.
Suggested solutions
For the API URL, note the following:
- For the Unstructured Workflow Endpoint, the typical API URL is
https://platform.unstructuredapp.io/api/v1
. This is also the default API URL that Unstructured Python SDK uses for the Workflow Endpoint. - For the Unstructured Partition Endpoint, the default API URL is
https://api.unstructuredapp.io/general/v0/general
. This is also the default API URL that Unstructured Python SDK uses for the Partition Endpoint.
If you signed up through the For Enterprise page, of if you are using a self-hosted deployment of Unstructured, your API URL might be different. For guidance, email Unstructured Sales at sales@unstructured.io.
For the API key, the same API key works for both the Unstructured Workflow Endpoint and the Unstructured Partition Endpoint. To access your key:
-
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 the Copy icon next to your target key to add the key to your system’s clipboard. If you lose this key, simply return and click the Copy icon again. -
If you want or need to generate a new Unstructured API key at this point:
a. Click Generate API Key.
b. Follow the on-screen instructions to finish generating the key.
c. 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.
If you signed up through the For Enterprise page, of if you are using a self-hosted deployment of Unstructured, the process for getting your API key might be different. For guidance, email Unstructured Sales at sales@unstructured.io.
For the API URL, note the value of the Unstructured API URL for the Endpoint that you want to call. To access these API URLs:
- 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.
- In the Unstructured UI, click API Keys on the sidebar.
- Note the API URL for the Unstructured Workflow Endpoint or the Unstructured Partition Endpoint, depending on whether you want to call the Unstructured Workflow Endpoint or the Unstructured Partition Endpoint, respectively.
If you signed up through the For Enterprise page, of if you are using a self-hosted deployment of Unstructured, your API URL might be different. For guidance, email Unstructured Sales at sales@unstructured.io.
If you still believe you have the correct API URL and API key, try the following steps:
-
Check your script or code to see where the API URL and API key are specified, as follows:
For a POST request
- Check the target URL. Make sure it is set to the right API URL.
- Check the value of the
unstructured-api-key
header. Make sure it is set to the right API key, or an environment variable representing the right API key.
For the Unstructured Python SDK
- Check the value of the
server_url
parameter. Make sure it is set to the right API URL, or an environment variable representing the right API URL. - Check the value of the
api_key_auth
parameter. Make sure it is set to the right API key, or an environment variable representing the right API key.
If you are using the Unstructured Python SDK to call the Workflow Endpoint or the Partition Endpoint, you should not need to set the value of the
server_url
parameter if you are using these Endpoints’ default API URL. However, you might want to try setting this value anyway to see if it otherwise resolves your issue.For the Unstructured JavaScript/TypeScript SDK
- Check the value of the
UnstructuredClient
object’sserverURL
parameter. Make sure it is set to the right API URL, or an environment variable representing the right API URL. - Check the value of the
UnstructuredClient
object’ssecurity: { apiKeyAuth }
parameter. Make sure it is set to the right API key, or an environment variable representing the right API key.
-
If you follow the recommended approach to use environment variables to represent the API key and API URL instead of hard-coding them into your script or code, check your session to see if these environment variables have been loaded, for example:
- Run the command for your operating system to list all environment variables. Make sure the API key and API URL are listed and are set to the right ones. Make sure the names and cases of these environment variables match the ones in your script or code exactly.
- If you use an integrated development environment (IDE) to run your script or code, check the IDE’s documentation for how to specify and load environment variables at run time or debug time. Make sure the names and cases of these environment variables match the ones in your script or code exactly.
-
If you are still getting this issue, contact us directly.
Was this page helpful?