This article describe how to send documents to Parseur via its native REST HTTPS 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>"

Sending documents 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': '[email protected]',
    'recipient': '[email protected]',
    '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", "<[email protected]>"],
    ]
}


As an example, you can test the following curl command and it should create a new document for your [email protected] 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": "[email protected]",
"recipient": "[email protected]",
"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>"

Note: Make sure to replace the recipient email address and the token with your own values

Did this answer your question?