All URIs are relative to https://us1.pdfgeneratorapi.com/api/v4
| Method | HTTP request | Description |
|---|---|---|
| deleteDocument | DELETE /documents/{publicId} | Delete document |
| generateDocument | POST /documents/generate | Generate document |
| generateDocumentAsynchronous | POST /documents/generate/async | Generate document (async) |
| generateDocumentBatch | POST /documents/generate/batch | Generate document (batch) |
| generateDocumentBatchAsynchronous | POST /documents/generate/batch/async | Generate document (batch + async) |
| getDocument | GET /documents/{publicId} | Get document |
| getDocuments | GET /documents | Get documents |
deleteDocument(public_id)
Delete document
Delete document from the Document Storage
import PDFGeneratorAPI from 'pdf-generator-api-client';
let defaultClient = PDFGeneratorAPI.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: JSONWebTokenAuth
let JSONWebTokenAuth = defaultClient.authentications['JSONWebTokenAuth'];
JSONWebTokenAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new PDFGeneratorAPI.DocumentsApi();
let public_id = "bac8381bce1982e5f6957a0f52371336"; // String | Resource public id
apiInstance.deleteDocument(public_id, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| public_id | String | Resource public id |
null (empty response body)
- Content-Type: Not defined
- Accept: application/json
AddWatermark201Response generateDocument(generate_document_request)
Generate document
Merges template with data and returns base64 encoded document or a public URL to a document. NB! When the public URL option is used, the document is stored for 30 days and automatically deleted.
import PDFGeneratorAPI from 'pdf-generator-api-client';
let defaultClient = PDFGeneratorAPI.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: JSONWebTokenAuth
let JSONWebTokenAuth = defaultClient.authentications['JSONWebTokenAuth'];
JSONWebTokenAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new PDFGeneratorAPI.DocumentsApi();
let generate_document_request = new PDFGeneratorAPI.GenerateDocumentRequest(); // GenerateDocumentRequest | Request parameters, including template id, data and formats.
apiInstance.generateDocument(generate_document_request, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| generate_document_request | GenerateDocumentRequest | Request parameters, including template id, data and formats. |
- Content-Type: application/json
- Accept: application/json
GenerateDocumentAsynchronous201Response generateDocumentAsynchronous(generate_document_asynchronous_request)
Generate document (async)
Merges template with data as asynchronous job and makes POST request to callback URL defined in the request. Request uses the same format as response of synchronous generation endpoint. The job id is also added to the callback request as header PDF-API-Job-Id Example payload for callback URL: ``` { "response": "https://us1.pdfgeneratorapi.com/share/12821/VBERi0xLjcKJeLjz9MKNyAwIG9i\", "meta": { "name": "a2bd25b8921f3dc7a440fd7f427f90a4.pdf", "display_name": "a2bd25b8921f3dc7a440fd7f427f90a4", "encoding": "binary", "content-type": "application/pdf" } } ```
import PDFGeneratorAPI from 'pdf-generator-api-client';
let defaultClient = PDFGeneratorAPI.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: JSONWebTokenAuth
let JSONWebTokenAuth = defaultClient.authentications['JSONWebTokenAuth'];
JSONWebTokenAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new PDFGeneratorAPI.DocumentsApi();
let generate_document_asynchronous_request = new PDFGeneratorAPI.GenerateDocumentAsynchronousRequest(); // GenerateDocumentAsynchronousRequest | Request parameters, including template id, data and formats.
apiInstance.generateDocumentAsynchronous(generate_document_asynchronous_request, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| generate_document_asynchronous_request | GenerateDocumentAsynchronousRequest | Request parameters, including template id, data and formats. |
GenerateDocumentAsynchronous201Response
- Content-Type: application/json
- Accept: application/json
AddWatermark201Response generateDocumentBatch(generate_document_batch_request)
Generate document (batch)
Allows to merge multiple templates with data and returns base64 encoded document or public URL to a document. NB! When the public URL option is used, the document is stored for 30 days and automatically deleted.
import PDFGeneratorAPI from 'pdf-generator-api-client';
let defaultClient = PDFGeneratorAPI.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: JSONWebTokenAuth
let JSONWebTokenAuth = defaultClient.authentications['JSONWebTokenAuth'];
JSONWebTokenAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new PDFGeneratorAPI.DocumentsApi();
let generate_document_batch_request = new PDFGeneratorAPI.GenerateDocumentBatchRequest(); // GenerateDocumentBatchRequest | Request parameters, including template id, data and formats.
apiInstance.generateDocumentBatch(generate_document_batch_request, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| generate_document_batch_request | GenerateDocumentBatchRequest | Request parameters, including template id, data and formats. |
- Content-Type: application/json
- Accept: application/json
GenerateDocumentAsynchronous201Response generateDocumentBatchAsynchronous(generate_document_batch_asynchronous_request)
Generate document (batch + async)
Merges template with data as asynchronous job and makes POST request to callback URL defined in the request. Request uses the same format as response of synchronous generation endpoint. The job id is also added to the callback request as header PDF-API-Job-Id Example payload for callback URL: ``` { "response": "https://us1.pdfgeneratorapi.com/share/12821/VBERi0xLjcKJeLjz9MKNyAwIG9i\", "meta": { "name": "a2bd25b8921f3dc7a440fd7f427f90a4.pdf", "display_name": "a2bd25b8921f3dc7a440fd7f427f90a4", "encoding": "binary", "content-type": "application/pdf" } } ```
import PDFGeneratorAPI from 'pdf-generator-api-client';
let defaultClient = PDFGeneratorAPI.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: JSONWebTokenAuth
let JSONWebTokenAuth = defaultClient.authentications['JSONWebTokenAuth'];
JSONWebTokenAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new PDFGeneratorAPI.DocumentsApi();
let generate_document_batch_asynchronous_request = new PDFGeneratorAPI.GenerateDocumentBatchAsynchronousRequest(); // GenerateDocumentBatchAsynchronousRequest | Request parameters, including template id, data and formats.
apiInstance.generateDocumentBatchAsynchronous(generate_document_batch_asynchronous_request, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| generate_document_batch_asynchronous_request | GenerateDocumentBatchAsynchronousRequest | Request parameters, including template id, data and formats. |
GenerateDocumentAsynchronous201Response
- Content-Type: application/json
- Accept: application/json
GetDocument200Response getDocument(public_id)
Get document
Returns document stored in the Document Storage
import PDFGeneratorAPI from 'pdf-generator-api-client';
let defaultClient = PDFGeneratorAPI.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: JSONWebTokenAuth
let JSONWebTokenAuth = defaultClient.authentications['JSONWebTokenAuth'];
JSONWebTokenAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new PDFGeneratorAPI.DocumentsApi();
let public_id = "bac8381bce1982e5f6957a0f52371336"; // String | Resource public id
apiInstance.getDocument(public_id, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| public_id | String | Resource public id |
- Content-Type: Not defined
- Accept: application/json
GetDocuments200Response getDocuments(opts)
Get documents
Returns a list of generated documents created by authorized workspace and stored in PDF Generator API. If master user is specified as workspace in JWT then all documents created in the organization are returned. NB! This endpoint returns only documents generated using the output=url option.
import PDFGeneratorAPI from 'pdf-generator-api-client';
let defaultClient = PDFGeneratorAPI.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: JSONWebTokenAuth
let JSONWebTokenAuth = defaultClient.authentications['JSONWebTokenAuth'];
JSONWebTokenAuth.accessToken = "YOUR ACCESS TOKEN"
let apiInstance = new PDFGeneratorAPI.DocumentsApi();
let opts = {
'template_id': 19375, // Number | Template unique identifier
'start_date': "2022-08-01 12:00:00", // String | Start date. Format: Y-m-d H:i:s
'end_date': "2022-08-05 12:00:00", // String | End date. Format: Y-m-d H:i:s. Defaults to current timestamp
'page': 1, // Number | Pagination: page to return
'per_page': 20 // Number | Pagination: How many records to return per page
};
apiInstance.getDocuments(opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| template_id | Number | Template unique identifier | [optional] |
| start_date | String | Start date. Format: Y-m-d H:i:s | [optional] |
| end_date | String | End date. Format: Y-m-d H:i:s. Defaults to current timestamp | [optional] |
| page | Number | Pagination: page to return | [optional] [default to 1] |
| per_page | Number | Pagination: How many records to return per page | [optional] [default to 15] |
- Content-Type: Not defined
- Accept: application/json