Skip to content

Commit 37b6d96

Browse files
authored
Refactor of the free and hosted SaaS API getting started pages (#15)
1 parent 9e1f108 commit 37b6d96

File tree

8 files changed

+327
-169
lines changed

8 files changed

+327
-169
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To contribute changes to the documentation:
1919

2020
1. Fork the repo.
2121
2. Create a new branch with a descriptive name.
22-
3. Add your changes. DO NOT MANUALLY EDIT THE CONTENTS OF THE SNIPPETS FOLDER. These are auto-generated from tested code examples.
22+
3. Add your changes. DO NOT MANUALLY EDIT THE CONTENTS OF THE `snippets/destination_connectors` and `snippets/source_connectors` FOLDERS. These are auto-generated from tested code examples.
2323
4. Check for grammatical and technical correctness of the changes.
2424
5. Preview your changes locally. [See how below](#previewing-documentation-changes-locally).
2525
6. Create a pull request.
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
---
2+
title: Free Unstructured API
3+
description: This page describes how to obtain an API key to use with the free Unstructured API, the limitations of the free Unstructured API, and provides a quick start example.
4+
---
5+
6+
## Get an API key
7+
8+
The Free Unstructured API requires authentication via an API key. Here's how you can obtain your API key:
9+
10+
1. Navigate to the [Free Unstructured API](https://unstructured.io/api-key-free) page on our website.
11+
2. Fill out the registration form with your details: first name, last name, email, and company. Make sure your contact information is valid.
12+
3. Check the `I agree` box if you consent to Unstructured contacting you about our products and services.
13+
4. Carefully read the Terms and Conditions, and check the appropriate box to agree.
14+
5. Click "Submit". You will receive an API key to the provided email.
15+
16+
Make sure to store your API key securely, and do not share publicly.
17+
18+
<Note>
19+
When using the Free Unstructured API, you only need the API key to authenticate yourself.
20+
If you're using the SaaS Unstructured API, refer to the [SaaS Unstructured API](/api-reference/api-services/saas-api-development-guide) for the quick start documentation.
21+
</Note>
22+
23+
## Free Unstructured API limitations
24+
25+
The free Unstructured API is designed for prototyping purposes, and not for production use:
26+
* The API usage is limited to 1000 pages per month.
27+
* Unlike the users of SaaS Unstructured API, users of the free to do not get their own dedicated infrastructure.
28+
* The data sent over the free Unstructured API can be used for model training purposes, and other service improvements.
29+
30+
If you require a production-ready API, consider using the [Saas Unstructured API](/api-reference/api-services/saas-api-development-guide) instead.
31+
32+
## Quick Start Example
33+
34+
Let's say you want to preprocess an `*.eml` file using the free Unstructured API. There are several ways
35+
you can do this, which all lead to the same result, so pick your preferred method.
36+
37+
### POST request
38+
39+
Supply your API key, and the file to preprocess:
40+
41+
```bash
42+
# The URL is the same for all free Unstructured API users
43+
curl -X 'POST' 'https://api.unstructured.io/general/v0/general'
44+
-H 'accept: application/json'
45+
-H 'Content-Type: multipart/form-data'
46+
-H 'unstructured-api-key: 'YOUR_API_KEY'
47+
-F 'files=@sample-docs/family-day.eml'
48+
```
49+
50+
The result will look something like this:
51+
![Sample Output](/img/api/sample_output.png)
52+
53+
### Unstructured Python/JavaScript SDK
54+
55+
To work with the free Unstructured API in Python or JavaScript, use the
56+
Unstructured [Python SDK](https://github.com/Unstructured-IO/unstructured-python-client), or
57+
[JavaScript SDK](https://github.com/Unstructured-IO/unstructured-js-client).
58+
59+
First, install your preferred SDK:
60+
<CodeGroup>
61+
62+
```bash Python
63+
pip install unstructured-client
64+
```
65+
66+
```bash JavaScript
67+
npm install unstructured-client
68+
```
69+
</CodeGroup>
70+
71+
Next, use it to call the API:
72+
73+
<CodeGroup>
74+
75+
```python Python
76+
from unstructured_client import UnstructuredClient
77+
from unstructured_client.models import shared
78+
from unstructured_client.models.errors import SDKError
79+
80+
client = UnstructuredClient(api_key_auth="YOUR_API_KEY")
81+
filename = "sample-docs/family-day.eml"
82+
83+
with open(filename, "rb") as f:
84+
files=shared.Files(
85+
content=f.read(),
86+
file_name=filename,
87+
)
88+
89+
req = shared.PartitionParameters(files=files)
90+
91+
try:
92+
resp = client.general.partition(req)
93+
except SDKError as e:
94+
print(e)
95+
```
96+
97+
```javascript JavaScript
98+
import { UnstructuredClient } from "unstructured-client";
99+
import { PartitionResponse } from "unstructured-client/dist/sdk/models/operations";
100+
import * as fs from "fs";
101+
102+
const key = "YOUR_API_KEY";
103+
104+
const client = new UnstructuredClient({
105+
security: {
106+
apiKeyAuth: key,
107+
},
108+
});
109+
110+
const filename = "sample-docs/family-day.eml";
111+
const data = fs.readFileSync(filename);
112+
113+
client.general.partition({
114+
files: {
115+
content: data,
116+
fileName: filename,
117+
},
118+
}).then((res: PartitionResponse) => {
119+
if (res.statusCode == 200) {
120+
console.log(res.elements);
121+
}
122+
}).catch((e) => {
123+
console.log(e.statusCode);
124+
console.log(e.body);
125+
});
126+
```
127+
</CodeGroup>
128+
129+
### Calling the Unstructured API from the Unstructured open source library
130+
131+
Finally, you can call the Unstructured API directly from the Unstructured open source library:
132+
133+
```python
134+
from unstructured.partition.api import partition_via_api
135+
136+
filename = "sample-docs/family-day.eml"
137+
138+
elements = partition_via_api(
139+
filename=filename,
140+
api_key="YOUR API KEY",
141+
)
142+
```
143+
144+
145+

api-reference/api-services/overview.mdx

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,28 @@ title: Unstructured API Services
33
sidebarTitle: Overview
44
---
55

6-
The Unstructured API presents an extensive selection of API services, encompassing free access, Software-as-a-Service (SaaS), and Azure & AWS Marketplace applications. These API services offer a high-quality and scalable solution capable of ingesting and digesting files of various types and sizes.
6+
The Unstructured API documentation covers the following API services:
77

8-
Within this documentation, you will find a detailed guide for implementing the Unstructured API across these diverse service options to best meet your operational requirements. It includes details on supported file types, step-by-step guides on using various API services, Python and JavaScript SDKs, and API parameters & common error handling.
9-
10-
<Warning>
11-
12-
Please review this manual carefully, as we’ve introduced significant updates to the API services, including a new usage cap for our free API tier, effective from January 10th, 2024.
13-
14-
Also, documents submitted to the free API may be utilized for our proprietary model training and evaluation purposes. This is part of our continuous effort to improve the API’s performance and capabilities.
15-
</Warning>
16-
17-
## Changes to the Free API Service
18-
19-
### Implementation of a 1000-Page Cap
20-
21-
Starting from January 10th, 2024, our free API service includes a cap of 1,000 pages. This limitation is introduced to ensure the sustainability of our free offerings and to enhance service quality.
22-
23-
### Premium API Services
24-
25-
For users requiring privacy and scalable API services, we provide several alternatives:
26-
27-
* **Commercial SaaS API:** Our premium service available with advanced features and dedicated support. Get your premium SaaS API Key [here](https://unstructured.io/api-key-hosted).
28-
29-
* **AWS and Azure Marketplace APIs:** A selection of specialized APIs available through various marketplaces, including [AWS Marketplace](https://aws.amazon.com/marketplace/pp/prodview-fuvslrofyuato) and [Azure Marketplace](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/unstructured1691024866136.customer_api_v1).
30-
31-
* **Open Source Offering:** Access to our open-source tools for self-hosting and customization on [Unstructured GitHub repo](https://github.com/Unstructured-IO/unstructured).
32-
8+
* Free Unstructured API: hosted by Unstructured, data processing is capped to 1000 pages, documents submitted to the free API may be utilized for our proprietary model training and evaluation purposes.
9+
* SaaS Unstructured API: SaaS API hosted by Unstructured, scalable and secure, your data remains private, pay-as-you-go.
10+
* Marketplace Unstructured API: the functionality and security of the SaaS Unstructured API, but deployed via Azure or AWS marketplace, in your preferred infrastructure.
3311

3412
## Supported File Types
3513

14+
Unstructured API supports the same file types as the open source Unstructured library.
15+
However, the Unstructured API services include more powerful file transformation capabilities,
16+
such as a more accurate table extraction model.
3617

3718
|Category |File Types |
3819
|----------|--------------------------------------------------------------|
39-
|Plaintext |.eml, .html, .json, .md, .msg, .rst, .rtf, .txt, .xml |
20+
|Plaintext |.eml, .html, .md, .msg, .rst, .rtf, .txt, .xml |
4021
|Images |.png, .jpg, .jpeg, .tiff, .bmp, .heic |
41-
|Documents.|.csv, .doc, .docx, .epub, .odt, .pdf, .ppt, .pptx, .tsv, .xlsx|
22+
|Documents |.csv, .doc, .docx, .epub, .odt, .pdf, .ppt, .pptx, .tsv, .xlsx|
23+
4224

25+
## Data Ingestion
4326

44-
**NOTE**: Currently, the pipeline is capable of recognizing the file type and choosing the relevant partition function to process the file.
27+
Unstructured API services support ingesting data from various sources - refer to [unstructured-ingest documentation](/open-source/ingest/overview) to learn more.
4528

4629
## Get Support
4730

0 commit comments

Comments
 (0)