Example: Upload API primer
Request presigned URLs, confirm bytes on storage, and attach files — compact curl reference with links to full format walkthroughs.
Endpoints: Request file upload URLs, Attach file. After files are attached and metadata is valid, call Publish a book.
Replace YOUR_API_KEY, BOOK_PUBLIC_ID, and FILE_ID (from the presign response). Use PUT to the returned url with your bytes (not shown here — see the long guides).
Full walkthroughs
Request presigned URLs (ebook manuscript)
curl -sS -X POST "https://api.sandbox.dev.publishdrive.com/v2/distribution/books/b2c3d4e5-f6a7-8901-bcde-f12345678901/upload" \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '[{
"referenceId": "epub-ref",
"role": "ebook_content",
"filename": "mybook.epub",
"hashSha256": "9c50bbd0c11fda120232a970f3ee67f993459bb81fda6f35d7ac4cfa9b45d5f5"
}]'Save the returned id (file id) and url for the next steps.
After PUT to S3 — confirm upload and attach
curl -sS -X PATCH "https://api.sandbox.dev.publishdrive.com/v2/distribution/books/b2c3d4e5-f6a7-8901-bcde-f12345678901/file/550e8400-e29b-41d4-a716-446655440000/attach" \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filename": "mybook.epub",
"hashSha256": "9c50bbd0c11fda120232a970f3ee67f993459bb81fda6f35d7ac4cfa9b45d5f5"
}'