👨💻 Parse HTML and Text Documents Using API
In this article, we’ll see how to parse HTML and TXT documents using the Parsio API.
This endpoint is designed for cases where you already have the document content as plain text or HTML. Instead of uploading a file, you send the text document directly in the API request body. To upload PDFs, images, and other files (binary data), please use this endpoint instead.
Typical use cases include:
Parsing email bodies
Parsing HTML pages or webhooks
Parsing text generated by another system or API
Because the content is sent as text, no file upload or binary data handling is required.
Authentication
To access the API, you will need the API key that you will find in your account:

This API key should be included in the X-API-Key HTTP header.
Unauthenticated responses will return in a HTTP 401 Unauthorized code.
Here's a request example using cURL:
curl -X GET https://api.parsio.io/mailboxes/ -H "X-API-Key: <YOUR_API_KEY>"
How to parse HTML and text documents using Parsio API
API Endpont: POST https://api.parsio.io/mailboxes/<mailbox_id>/doc
JSON parameters:
name (string): Document's name (or Subject for emails)
html (string): HTML content
text (string): Text content
from (string): 'From' email address (optional)
to (string): 'To' email address (optional)
meta (object): Payload document data (optional)
If both provided, the HTML content has priority over the TEXT content. At least one must be provided.
If needed, you can provide some payload data in the meta field, which will be included in the parsed JSON as the __meta__ field. This can be helpful for linking the document with your external database, for example.
Your Mailbox ID can be found in the browser location bar:

Code samples
CURL:
curl \-X POST \https://api.parsio.io/mailboxes/<YOUR_MAILBOX_ID>/doc \-d '{"name": "New order","from": "admin@example.com","to": "me@example.com","html": "<p>HTML content goes here</p>"}' \-H "Content-Type: application/json" \-H "X-API-Key: <YOUR_API_KEY>"
Find more code samples here.