Parse emails through an API: Parseur API user guide

Parseur API user guide cover image

Simplest way to parse email data is to connect to Parseur and start sending or forwarding emails to the mailbox's email address. Remember that you can create as many mailboxes as you want. They are all included in your plan at no extra charge. If you want to connect to other applications, our Zapier integration is the easiest and simplest way to do that.

If you need more control or want to send data from your own application to Parseur, you can connect directly through our REST HTTPS API.

This article describe how to communicate with Parseur to parse emails using its API.

Parseur API Authentication

Parseur API uses a token-based authentication.

You will find your API Token Key in your Account Overview .

For clients to authenticate, the token key should be included in the Authorization HTTP header. The key should be prefixed by the string literal "Token", with white space separating the two strings. For example:

Authorization: Token 1234d45678c90bcf1234fe123ddae4aabbc6abcd

Unauthenticated responses that are denied permission will result in an  HTTP 403 Unauthorized response with an appropriate WWW-Authenticate header. For example:

WWW-Authenticate: Token

The curl command line tool may be useful for testing token authenticated APIs. For example:

curl -X GET https://api.parseur.com/ -H "Authorization: Token <enter-your-token-here>"

Sending data to Parseur

Once authenticated, you can send a new document for Parseur to process by issuing a POST request on https://api.parseur.com/email with the following payload:

{
    'subject': 'The title of your document, or email subject',
    'sender': 'sender.name@gmail.com',
    'recipient': 'parser.name@in.parseur.com',
    'body_html': '<html><body>Document content as HTML. This one has priority over text content if both are present.</body></html>',
    'body_plain': 'Document content as text. This one is only used if body_html is empty.',
    'message_headers': [
        ["Standard-SMTP-Header", "Any usual email header goes here"],
        ["X-Envelope-From", "<original.sender@corporate.email>"],
    ]
}

As an example, you can test the following curl command and it should create a new document for your parser.name@in.parseur.com mailbox (attachments and message headers removed to keep the example simple but those are optional anyway):

curl \
-X POST https://api.parseur.com/email \
-d '{
"subject": "The title of your document, or email subject",
"sender": "sender.name@gmail.com",
"recipient": "parser.name@in.parseur.com",
"body_html": "<html><body>Document content as HTML. This one has priority over text content if both are present.</body></html>",
"body_plain": "Document content as text. This one is only used if body_html is empty.",
"message_headers": []
}' \
-H "Content-Type: application/json" \
-H "Authorization: Token <enter-your-token-here>"

Mailboxes

As per standard REST protocol:

  • You can list your mailboxes with a GET request on /parser
  • You can create a mailbox with a POST request on /parser
  • You can retrieve a mailbox with a GET request on /parser/mailbox_id
  • You can update a mailbox with a PUT or POST request on /parser/mailbox_id

Documents in a mailbox

  • You can list your document in a given mailbox with a GET request on /parser/mailbox_id/document_set

Miscellaneous

Support

As usual, feel free to contact us, may you happen to have any question.

Last updated:

Parseur is the most powerful and easy-to-use mail parser.
Save hours of manual work and improve your data entry speed and quality.

Sign up now