---
title: "Render CSV or JSON data as a table (PDF or image)"
method: POST
path: "/data-to-table"
tags: ["Documents"]
---

# Render CSV or JSON data as a table (PDF or image)

`POST /data-to-table`

## Request

- Base URL: `https://api.cofferdock.com`
- URL: `https://api.cofferdock.com/data-to-table`
- Auth: API key in header `x-api-key`

Builds an HTML table from CSV text or a JSON array (of objects or of arrays) and renders it as a PDF or an image. Provide csv or data, not both.

Costs 1 credit per call.

## Request body

- object
  - `csv` string: The table as CSV text, up to 5 MB. Provide "csv" or "data", not both.
  - `data` unknown[]: The table as JSON: an array of objects (their keys become the column headers) or an array of arrays (one per row). Up to 5000 rows, header included. Provide "csv" or "data", not both.
    - unknown
  - `header` boolean: true (default) = the first row is the table header (with "data" as objects, the header shows their keys); false = no header row.
  - `format` 'pdf' | 'png' | 'jpeg' | 'webp': Output format: "pdf" (default), or an image as "png", "jpeg" or "webp" (cropped to the table).
  - `pdf_format` 'A4' | 'A3' | 'A5' | 'Letter' | 'Legal' | 'Tabloid': Paper size when format is "pdf": "A4" (default), "A3", "A5", "Letter", "Legal" or "Tabloid". Ignored for images.
  - `landscape` boolean: true = landscape page, false (default) = portrait. Only used when format is "pdf".
  - `output` 'json' | 'binary' | 'url': How to return the file: "json" (default: base64 in the JSON response), "binary" (the file itself, ready for n8n/Make/Zapier) or "url" (a temporary download link, valid 15 minutes).

## Response `200`

Result.

- object
  - `success` boolean
  - `file` string, byte
  - `mime_type` string
  - `meta` object
    - `format` string
    - `rows` integer
    - `size_bytes` integer
    - `used` integer: Credits used this month, after this call.
    - `remaining` integer, nullable: Credits left this month (null = unlimited).
    - `unlimited` boolean

## Other responses

- `400`: Invalid input (nothing is charged).
- `401`: Missing or invalid API key.
- `403`: Email not verified.
- `429`: Monthly credit limit reached, or too many requests per minute for this key (see Retry-After).
- `503`: Server busy (queue full). Retry after the seconds in the Retry-After header.

---

[API](https://skmtc.dev/cofferdock/apis/cofferdock-api.md) · [All operations](https://skmtc.dev/cofferdock/apis/cofferdock-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cofferdock/apis/cofferdock-api/revisions/b57aa000d33a?raw)
