Authentication
The Visual PDF API is only accessible to registered users.
To prove that you are a user with a valid account, and who has credits, an authentication process is necessary for each call to the API. Let's dive into this guide to see how to do this very simply!
How are requests authenticated?
The Visual PDF API uses a simple and widely used method of authenticating requests: API keys.
API keys are strings, associated with your account, that you must include in your requests. When the API receives one of your requests, it will
- verify that a key has been transmitted
- verify that this key exists and associated with a valid account
- check that the account associated with the key has a sufficient number of credits (only for requets that actually require credits)
If one os these steps fail, you will not be allowed to process the request and will receive an error.
How to create an API key?
In order to create an API key, just connect to your administrator portal, go to "Settings", then in the "Your API keys" section, click on the "New" button.
We recommend that you choose the name assigned to your key carefully, so that you can easily find the context in which this key is used.
How to use my API key?
Now that you have an API key, you are able to authenticate your requests with it.
Your API key must appear in each request headers via the Authorization header like this: Authorization: Bearer {your_API_key}.
Let's take the example of a request sent via the Fetch API in JavaScript:
await fetch(
'https://api.visualpdf.com/v1/process',
{
method: 'POST',
body: form,
headers: {
Authorization: `Bearer ${your_API_key}`, // Don't forget to replace ${your_API_key} with a key created in your admin panel
}
},
)
Now that you know how to authenticate your requests to prove that you are a legitimate user, find out in the next guide how to interact with the API to process PDF files.