Use an API key to authenticate every request to the Parseur API. Authentication is token-based and sent via the standard Authorization HTTP header.Create your API key#
Treat this key like a password. Keep it secret, rotate it if itโs exposed, and avoid embedding it in client-side code.Send the key with each request#
Include the key in the Authorization header:In previous version of this documentation we recommended to prefix your API key with the string literal Token, with white space separating the two strings. While prefixing your API key with Token still works, it is not required any longer.
Authentication errors#
If authentication fails, the API responds with HTTP 403.{
"non_field_errors": "Not authenticated"
}
{
"non_field_errors": "Authentication failed"
}
Donโt include quotes around the key.
Always Use HTTPS and avoid putting the key in URLs or query strings.
Testing your key#
The quickest smoke test is a GET on the API root:Using CURL#
Use the --compressed flag with cURL. It requests a compressed response and automatically decompresses it, saving bandwidth and speeding up transfers for large JSON payloads.
Using Javascript (fetch)#
Using Python (requests)#
Response#
If the connection is successful, the API will reply with HTTP 200 OK and the following payload:{
"document": "http://api.parseur.com/document",
"parser": "http://api.parseur.com/parser"
}
Common pitfalls#
Placing the key in the request body or query string instead of the header.
Forgetting to set the header on every request.
Quick reference#
Header: Authorization: <YOUR_API_KEY>