---
title: PDF Generator API - Bulk PDF Generation from CSV
version: 1.0.0
description: Generate one PDF per row from an uploaded CSV file against a template you designed in the APIFreaks PDF Template Builder. Each row is processed independently, and the response returns an array of results, each with its own pdf_url. 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: 3
---

## Table of Contents

- [PDF Generator API - Bulk PDF Generation from CSV v1.0.0](#pdf-generator-api-bulk-pdf-generation-from-csv-v100)
  - [Authentication](#authentication)
  - [PDF Template APIs](#pdf-template-apis)
    - [generatePdfsFromCsv](#generatepdfsfromcsv)
      - [Parameters](#parameters)
      - [Responses](#responses)
  - [Schemas](#schemas)
    - [TemplateGenerationResponse](#templategenerationresponse)
    - [CsvUploadRequest](#csvuploadrequest)
    - [ErrorResponse](#errorresponse)



# PDF Generator API - Bulk PDF Generation from CSV v1.0.0

Generate one PDF per row from an uploaded CSV file against a template you designed in the APIFreaks PDF Template Builder. Each row is processed independently, and the response returns an array of results, each with its own pdf_url. 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

### generatePdfsFromCsv

`POST /pdf/template/generate/bulk`

*Generate PDFs in bulk from a CSV*

Upload a CSV file where each row is one record. The API generates one PDF per row and returns an array of results, each with its own pdf_url. Rows are processed independently, so a failure in one row does not block the rest of the batch. The response gives a row-by-row breakdown of which PDFs succeeded and which failed.

> Body parameter

```yaml
file: string

```

#### 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.|
|body|body|[CsvUploadRequest](#csvuploadrequest)|true|Multipart form-data body carrying the CSV file to render. Each row in the CSV is one record and produces one PDF.|

> Example responses

> PDFs generated successfully. The response is an array of results, one entry per CSV row, each with its own pdf_url.

```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_20260810141245054106_1.pdf",
    "created_at": "2026-08-10T14:12:47.887Z",
    "expiration_time": "2026-11-10T14:12:47.887Z"
  },
  {
    "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_20260810141245054154_2.pdf",
    "created_at": "2026-08-10T14:12:47.940Z",
    "expiration_time": "2026-11-10T14:12:47.940Z"
  }
]
```

> Bad Request — Missing parameters, a file that is not a CSV, or data larger than 10 MB.

```json
{
  "timestamp": "2026-08-10T14:13:14.497Z",
  "path": "/v1.0/generate-pdf/bulk",
  "status": 400,
  "error": "CSV File Required",
  "message": "Only CSV files are supported. Please upload a valid CSV file."
}
```

> 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/bulk",
  "status": 401,
  "timestamp": "2026-08-10T14:13:14.996Z"
}
```

> 403 Response

```json
{
  "error": "string",
  "message": "string",
  "path": "string",
  "status": 0,
  "timestamp": "2019-08-24T14:15:22Z"
}
```

#### Responses

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|PDFs generated successfully. The response is an array of results, one entry per CSV row, each with its own pdf_url.|Inline|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad Request — Missing parameters, a file that is not a CSV, or data larger than 10 MB.|[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 Schema

Status Code **200**

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|*anonymous*|[[TemplateGenerationResponse](#templategenerationresponse)]|false|none|[Result of a PDF generation request, containing the hosted URL of the generated PDF.]|
|» 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).|

#### 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).|

### CsvUploadRequest

Multipart form-data request body containing the CSV file to render in bulk.

#### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|file|string(binary)|true|none|A CSV file uploaded as form-data where each row is one record. One PDF is generated per row.|

### 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).|
