POST /v1/document

Image Document API

Convert images to PDF and render PDF pages as images.

Key Operations

image_to_pdf

pdf_to_image

pdf_to_jpg

pdf_to_png

Use cases

  • Photo-to-PDF exports

  • PDF page thumbnails

  • Document preview generation

Async Job Lifecycle

All ImageHQ processing endpoints are asynchronous. Upon a successful POST, you receive a 202 Acceptedresponse with a job_id. Poll the status endpoint until the state reaches succeeded.

Request Example

import requests

url = "https://api.imagehq.io/v1/document"
payload = {
  "operation": "image_to_pdf",
  "options": {
    "merge_images": True,
    "orientation": "auto",
    "page_size": "auto"
  },
  "tool_slug": "image-to-pdf"
}
files = [("files[]", open("image.png", "rb"))]
data = {"request": json.dumps(payload)}

response = requests.post(url, files=files, data=data)
print(response.json())

Successful Response

{
  "completed": {
    "download_url": "/v1/jobs/job_123/download",
    "expires_at": "2026-05-03T00:00:00Z",
    "id": "job_123",
    "inputs": [
      {
        "filename": "input.png",
        "format": "png",
        "mime_type": "image/png",
        "size_bytes": 420122
      }
    ],
    "outputs": [
      {
        "filename": "output.jpg",
        "format": "jpg",
        "id": "0",
        "mime_type": "image/jpeg",
        "size_bytes": 161002
      }
    ],
    "progress": 100,
    "retention_policy": {
      "clamp": true,
      "ttl_hours": 24
    },
    "stages": [
      {
        "name": "queued",
        "progress": 100,
        "status": "succeeded"
      },
      {
        "name": "processing",
        "progress": 100,
        "status": "succeeded"
      }
    ],
    "status": "succeeded",
    "warnings": []
  },
  "queued": {
    "client_reference_id": "example-123",
    "created_at": "2026-05-02T00:00:00Z",
    "current_stage": "queued",
    "expires_at": "2026-05-03T00:00:00Z",
    "id": "job_123",
    "operation": "document",
    "poll_url": "/v1/jobs/job_123",
    "progress": 0,
    "status": "queued",
    "tool_slug": "png-to-jpg"
  }
}

Frequently Asked Questions

Is /api/document replacing /api/pdf?

Yes. In this API surface, document operations are grouped under /v1/document.

Can I render selected PDF pages only?

Yes. Use options like page_range for targeted rendering.

Can document output be downloaded like other jobs?

Yes. Completed jobs expose output download URLs.


Related APIs

ocr APIconvert APIpipeline APIbatch API

ImageHQ

Smart image tools for conversion, compression, and automation.

Tools

Compress ImageResize ImagePNG to JPGFiltersEnhance

© 2026 ImageHQ. All rights reserved.