Authentication
You'll need to authenticate your requests to access any of the endpoints in the Pdfly API. This can be done by adding your API keys in your request headers. You can generate API keys on your Pdfly dashboard. Examples on how to authenticate API calls using your API keys are shown below.
const axios = require("axios");
const options = {
"method": "POST",
"url": "https://api.pdfly.io/pdf/generate",
"headers": {
"Content-Type": "application/jsons",
"x-api-key": "API-KEY",
},
"data": JSON.stringify({
"body": "<html><head><title>Quickstart</title></head><body> <h1>Pdfly API rocks</h1><p>You just generated your first pdf.</p></body></html>"
})
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Please don't commit your Pdfly API keys to GitHub!