Generate PDF Job
Queue a PDF generation job and retrieve its status and result.
Authentication
Influxion uses OAuth2 Bearer tokens issued by its /token endpoint. First obtain a token:
POST /token HTTP/1.1
Content-Type: application/json
{
"client_id": "<CLIENT_ID>",
"client_secret": "<CLIENT_SECRET>",
"scope": "api://d88ae758-e67d-492d-bcc6-63f560ee1f04/.default"
}
Note
The scope is optional. A default scope will be assigned if not provided, and it will allow access to all API endpoints.
Response:
{
"access_token": "<YOUR_JWT>",
"token_type": "bearer"
}
All subsequent API calls must include the Authorization header with value Bearer <YOUR_JWT>.
Create a job
Request:
POST /pdf/generate HTTP/1.1
Authorization: Bearer <YOUR_JWT>
Content-Type: application/json
{
"data": { /* structured data for template */ },
"document_id": "my-doc-123",
"pdf_standard": "pdf/a-1b",
"sign_key_id": "sign-key-id",
"html_template": {
"id": null,
"filename": null,
"content": "<html>...{{ data }}...</html>"
},
"css_template": {
"id": null,
"filename": null,
"content": "body { font-family: Arial; }"
}
}
Response:
{
"job_id": 1
}
Check job status
GET /pdf/1 HTTP/1.1
Authorization: Bearer <YOUR_JWT>
Response:
{
"id": 1,
"status": "Received",
"created_at": "2023-01-01T12:00:00Z",
"started_at": null,
"completed_at": null,
"size": null,
"error": null
}
The status can be Received, InProgress, Done, or Error.
Download PDF
GET /pdf/1/download HTTP/1.1
Authorization: Bearer <YOUR_JWT>
Response: Binary PDF (Content-Type: application/pdf)
Using Celery background workers (Optional)
When setting up Influxion, one can connect it to a RabbitMQ and use Celery for background PDF generation:
pip install -e .
export INFLUXION_USE_CELERY=1
export INFLUXION_CELERY_BROKER_URL=amqp://guest@localhost//
export INFLUXION_CELERY_RESULT_BACKEND=rpc://
celery -A influxion.celery_app worker --loglevel=info
This enables asynchronous PDF generation, allowing the API to respond immediately and several jobs to be processed concurrently.