PublishDrive

Example: Print on demand upload

End-to-end walkthrough — create a print book, upload interior PDF and cover assets, and publish using the PublishDrive Distribution API.

This guide outlines publishing a print-on-demand title: create the book with format set to print and a valid ISBN, request presigned URLs for interior and cover files (pod_content and pod_cover), upload bytes with PUT, then Attach file for each fileId, and Publish book. Examples use the staging base URL.

Replace YOUR_API_KEY with your actual API key. UUIDs and presigned URLs are illustrative.

See also: List books, Get a book, Update a book, Upload API primer, Unpublish and delete.

Prerequisites

  • A valid PublishDrive API key
  • Interior PDF and cover PDF (or images) meeting print specifications for your channels
  • SHA-256 hashes for each file

Computing file hashes

shasum -a 256 interior.pdf
shasum -a 256 cover.pdf

Full Flow

Step 1 — Create the print book record

Send POST to /books with format: "print", required metadata, contributors, pricing, and an isbn value appropriate for your edition.

curl -X POST https://api.sandbox.dev.publishdrive.com/v2/distribution/books \
  -H "apikey: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "print",
    "title": "Sample POD Title",
    "language": ["en"],
    "description": "Interior and cover uploaded via API.",
    "category": ["FIC002000"],
    "copyright": "SELF",
    "saleTerritory": ["ALL"],
    "publicationDate": "2027-08-01",
    "isbn": "9781234567890",
    "contributor": [
      { "firstName": "Jane", "lastName": "Doe", "role": "Author" }
    ],
    "price": [{ "currency": "USD", "price": 24.99 }]
  }'

Save the returned book public identifier for the upload steps.

Step 2 — Request upload URLs for interior and cover

Send POST to /books/{bookPublicId}/upload with an array of file descriptors. Use pod_content for the interior PDF and pod_cover for the cover asset.

curl -X POST "https://api.sandbox.dev.publishdrive.com/v2/distribution/books/BOOK_PUBLIC_ID/upload" \
  -H "apikey: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "referenceId": "pod-interior",
      "role": "pod_content",
      "filename": "interior.pdf",
      "hashSha256": "REPLACE_WITH_HASH"
    },
    {
      "referenceId": "pod-cover",
      "role": "pod_cover",
      "filename": "cover.pdf",
      "hashSha256": "REPLACE_WITH_HASH"
    }
  ]'

For each item, store the fileId and presigned url from the response.

Step 3 — Upload files, attach, publish

PUT each file body to its presigned URL, then call Attach file for each fileId with the same filename and hashSha256 you used when requesting URLs. When metadata and files satisfy validation, call Publish book.

For ebook and audiobook walkthroughs, see Example: Ebook Upload and Example: Audiobook Upload.

On this page