---
title: PDF Generator API - Create PDFs from Templates
version: 1.0.0
description: Generate PDFs from templates you design once in the APIFreaks PDF Template Builder. Send JSON in the request body or provide a data_url, and the API renders your template into a hosted PDF document. Authentication is done with your APIFreaks API key passed in the X-apikey header.
openapi: 3.1.1
servers:
  - https://api.apifreaks.com/v1.0
paths: 1
operations: 1
schemas: 2
---

## Table of Contents

- [PDF Generator API - Create PDFs from Templates v1.0.0](#pdf-generator-api-create-pdfs-from-templates-v100)
  - [Authentication](#authentication)
  - [PDF Template APIs](#pdf-template-apis)
    - [generatePdfFromTemplate](#generatepdffromtemplate)
      - [Parameters](#parameters)
      - [Responses](#responses)
  - [Schemas](#schemas)
    - [TemplateGenerationResponse](#templategenerationresponse)
    - [ErrorResponse](#errorresponse)



# PDF Generator API - Create PDFs from Templates v1.0.0

Generate PDFs from templates you design once in the APIFreaks PDF Template Builder. Send JSON in the request body or provide a data_url, and the API renders your template into a hosted PDF document. Authentication is done with your APIFreaks API key passed in the X-apikey header.

Base URLs:

* [https://api.apifreaks.com/v1.0](https://api.apifreaks.com/v1.0)

## Authentication

* API Key (ApiKeyAuthHeader)
    - Parameter Name: **X-apiKey**, in: header. Pass your API key via the X-apiKey request header.

* API Key (ApiKeyAuthQuery)
    - Parameter Name: **apiKey**, in: query. Pass your API key via the apiKey query parameter.

## PDF Template APIs

### generatePdfFromTemplate

`POST /pdf/template/generate`

*Generate a PDF from a template*

Renders the template identified by template_id with the JSON data supplied in the request body (or fetched from data_url). Returns a hosted URL for the generated PDF. Provide either a request body or a data_url; one of the two is required. The keys of the data object are the fields you bound when you designed the template in the APIFreaks PDF Template Builder, so the exact shape is up to you. Pin the version parameter to a specific template version (e.g. version=v2) so later design changes never touch what is already live; omit it to use the latest version.

> Body parameter

```json
{
  "candidate_name": "Ava Thompson",
  "candidate_title": "Senior Operations Analyst",
  "email": "ava.thompson@example.com",
  "phone": "+1 (555) 381-2048",
  "city": "Austin, TX",
  "portfolio_url": "portfolio.example.com",
  "profile_summary": "Analytical operations professional with 8+ years of experience improving reporting pipelines, streamlining process documentation, and coordinating cross-functional delivery for distributed teams across multiple time zones.",
  "company_name": "Northwind Logistics",
  "job_title": "Operations Analyst",
  "employment_period": "2021 - Present",
  "job_achievement_1": "Led weekly KPI reporting for finance, fulfillment, and customer success stakeholders across three business units.",
  "job_achievement_2": "Reduced manual reconciliation work by 35% through workflow redesign and documentation automation.",
  "job_achievement_3": "Spearheaded a cross-team initiative that improved on-time delivery metrics by 18% within six months.",
  "skills": [
    {
      "skill": "Process Improvement",
      "level": "Advanced",
      "years": "7"
    },
    {
      "skill": "Stakeholder Reporting",
      "level": "Expert",
      "years": "8"
    },
    {
      "skill": "Cross-functional Coordination",
      "level": "Advanced",
      "years": "5"
    },
    {
      "skill": "Workflow Documentation",
      "level": "Advanced",
      "years": "6"
    }
  ],
  "degree": "B.S. in Information Systems",
  "institution": "University of Texas",
  "graduation_year": "2018",
  "certification_1": "Certified Business Analysis Professional (CBAP)",
  "certification_2": "Six Sigma Green Belt",
  "languages": "English (Native), Spanish (Professional)"
}
```

#### Parameters

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|template_id|query|string|true|The template to render, from the APIFreaks PDF Template Builder. Copy it from your dashboard when you save the template.|
|version|query|string|false|Template version to render, e.g. v2. Must start with v. Omit this parameter entirely to use the latest version; the literal value 'latest' is not accepted by the API.|
|data_url|query|string(uri)|false|A URL the API fetches your JSON data from, instead of the request body. Provide this when you are not sending a request body.|
|body|body|object|false|The template's data as a JSON object. The keys are the fields you bound when you designed the template, so the exact shape is up to you. Provide the body when you are not passing a data_url; one of the two is required.|

> Example responses

> PDF generated successfully. The response contains the hosted URL of the rendered PDF along with its creation and expiration times.

```json
{
  "template_id": "73691bce-1c58-4370-acc6-64b2dd14f81c",
  "pdf_url": "https://s3.eu-central-2.wasabisys.com/w.storage.apifreaks.com/pdf_templates/73691bce-1c58-4370-acc6-64b2dd14f81c/Candidate%20Resume_20260810141214723405.pdf",
  "created_at": "2026-08-10T14:12:17.673Z",
  "expiration_time": "2026-11-10T14:12:17.673Z"
}
```

> Bad Request — Missing or malformed parameters, missing data, or an unreachable data_url.

```json
{
  "error": "Invalid Param Exception",
  "message": "please pass correct parameters",
  "path": "/v1.0/pdf/template/generate",
  "status": 400,
  "timestamp": "2026-08-10T14:13:13.195Z"
}
```

```json
{
  "timestamp": "2026-08-10T14:13:13.689Z",
  "path": "/v1.0/generate-pdf",
  "status": 400,
  "error": "Invalid Template Version",
  "message": "Please provide a valid template version starting with 'v'."
}
```

```json
{
  "timestamp": "2026-08-10T14:13:14.172Z",
  "path": "/v1.0/generate-pdf",
  "status": 400,
  "error": "Template Data Not Provided",
  "message": "No data provided for the template. Please provide valid data to generate pdf."
}
```

> Unauthorized — The API key is missing or invalid.

```json
{
  "error": "API Access Exception",
  "message": "Provided API key is invalid. [For Technical Support: support@apifreaks.com]",
  "path": "/v1.0/pdf/template/generate",
  "status": 401,
  "timestamp": "2026-08-10T14:13:14.996Z"
}
```

> Forbidden — The account does not have access to this template.

```json
{
  "timestamp": "2026-08-10T14:13:15.000Z",
  "path": "/v1.0/generate-pdf",
  "status": 403,
  "error": "Template Access Denied",
  "message": "Your account does not have access to this template."
}
```

> Not Found — No template matches the template_id, or the requested version does not exist.

```json
{
  "timestamp": "2026-08-10T14:13:14.677Z",
  "path": "/v1.0/generate-pdf",
  "status": 404,
  "error": "Template Not Found",
  "message": "Please provide a valid template ID."
}
```

> Unsupported Media Type — The request Content-Type is not supported for this endpoint.

```json
{
  "timestamp": "2026-08-10T14:13:15.500Z",
  "path": "/v1.0/generate-pdf",
  "status": 415,
  "error": "Unsupported Media Type",
  "message": "The request Content-Type is not supported for this endpoint."
}
```

> Unprocessable Entity — The request contains invalid or missing data.

```json
{
  "timestamp": "2026-08-10T14:13:16.100Z",
  "path": "/v1.0/generate-pdf",
  "status": 422,
  "error": "Invalid Template Data",
  "message": "The request contains invalid or missing data."
}
```

> Internal Server Error — An unexpected error occurred, or the PDF could not be generated.

```json
{
  "timestamp": "2026-08-10T14:13:16.700Z",
  "path": "/v1.0/generate-pdf",
  "status": 500,
  "error": "PDF Generation Failed",
  "message": "The PDF could not be generated. Try the request again."
}
```

> Gateway Timeout — The request went past the 100 second processing limit.

```json
{
  "timestamp": "2026-08-10T14:13:17.300Z",
  "path": "/v1.0/generate-pdf",
  "status": 504,
  "error": "Processing Timeout",
  "message": "The request went past the 100 second processing limit. Reduce the input size or retry."
}
```

#### Responses

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|PDF generated successfully. The response contains the hosted URL of the rendered PDF along with its creation and expiration times.|[TemplateGenerationResponse](#templategenerationresponse)|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad Request — Missing or malformed parameters, missing data, or an unreachable data_url.|[ErrorResponse](#errorresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized — The API key is missing or invalid.|[ErrorResponse](#errorresponse)|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Forbidden — The account does not have access to this template.|[ErrorResponse](#errorresponse)|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|Not Found — No template matches the template_id, or the requested version does not exist.|[ErrorResponse](#errorresponse)|
|415|[Unsupported Media Type](https://tools.ietf.org/html/rfc7231#section-6.5.13)|Unsupported Media Type — The request Content-Type is not supported for this endpoint.|[ErrorResponse](#errorresponse)|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|Unprocessable Entity — The request contains invalid or missing data.|[ErrorResponse](#errorresponse)|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal Server Error — An unexpected error occurred, or the PDF could not be generated.|[ErrorResponse](#errorresponse)|
|504|[Gateway Time-out](https://tools.ietf.org/html/rfc7231#section-6.6.5)|Gateway Timeout — The request went past the 100 second processing limit.|[ErrorResponse](#errorresponse)|

#### Response Headers

|Status|Header|Type|Format|Description|
|---|---|---|---|---|
|200|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|
|400|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|
|401|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|
|403|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|
|404|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|
|415|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|
|422|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|
|500|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|
|504|X-AF-Credits-Cost|integer||Specifies the number of credits consumed by the current request.|

To perform this operation, you must be authenticated by means of one of the following methods:
ApiKeyAuthHeader, ApiKeyAuthQuery

## Schemas

### TemplateGenerationResponse

Result of a PDF generation request, containing the hosted URL of the generated PDF.

#### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|template_id|string|true|none|The template that was rendered.|
|pdf_url|string|true|none|Hosted URL of the generated PDF.|
|created_at|string(date-time)|true|none|When the PDF was generated (ISO 8601).|
|expiration_time|string(date-time)|true|none|When the hosted PDF expires (ISO 8601).|

### ErrorResponse

Standard error envelope returned by the API on failed requests.

#### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|error|string|false|none|Short error category or exception type.|
|message|string|true|none|Human-readable error message describing the failure.|
|path|string|false|none|API endpoint path that produced the error.|
|status|integer|false|none|HTTP status code returned with the error.|
|timestamp|string(date-time)|false|none|Timestamp when the error occurred (ISO 8601).|
