Issue
When you run script or code to call an Unstructured API, you might get one of the following warnings or errors: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, this URL was provided to you when your Unstructured account was created. If you do not have this URL, email Unstructured Support at support@unstructured.io.The default URL for the Unstructured Worfklow Endpoint is
https://platform.unstructuredapp.io/api/v1
.The default URL for the Unstructured Partition Endpoint is https://api.unstructuredapp.io/general/v0/general
.However, you should always use the URLs that were provided to you when your Unstructured account was created.-
If you are not already signed in, sign in to your Unstructured Starter or Team account at https://platform.unstructured.io.
For an Enterprise account, see your Unstructured account administrator for instructions, or email Unstructured Support at support@unstructured.io.
-
Get your Unstructured API key:
a. After you sign in to your Unstructured Starter account, click API Keys on the sidebar.
b. Click Generate API Key.For a Team or Enterprise account, before you click API Keys, make sure you have selected the organizational workspace you want to create an API key for. Each API key works with one and only one organizational workspace. Learn more.
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.
-
If you are not already signed in, sign in to your Unstructured Starter or Team account at https://platform.unstructured.io.
For an Enterprise account, see your Unstructured account administrator for instructions, or email Unstructured Support at support@unstructured.io.
-
After you sign in to your Unstructured Starter account, click API Keys on the sidebar.
For a Team or Enterprise account, before you click API Keys, make sure you have selected the organizational workspace you want to get the API URL for. - 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.
-
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.
- 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.
For the Unstructured JavaScript/TypeScript SDKIf 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 theserver_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.- 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, email Unstructured Support at support@unstructured.io.