Initialize upload
Begin an upload: create (or resume/dedupe) a pending document and issue upload access.
Authentication#
Any one of these credentials is accepted.
The deployment's static root credential (CLOUDPDF_API_AUTH_TOKENS), valid on every surface.
Delegated tenant JWT, valid only under its own /v1/tenants/{tenantId}/ subtree — the path tenant must equal the token's tenant_id. Doc-scoped viewer tokens are rejected on every admin route.
Parameters#
tenantIdpathstringrequiredRequest body#
application/jsonDocumentsInitRequestrequiredcontentLengthnumberrequiredcontentSha256stringrequiredmetadataobjectidempotencyKeystringdedupMode"always-create" | "reuse-existing"always-create (default) creates a new document every time. reuse-existing returns a document that already holds the same content instead of storing it twice.
docIdstringuploadTtlSecnumberuploadPreference"auto" | "presigned" | "proxy"A complete body with every required field. Strings stand in for your own values.
{
"contentLength": 1,
"contentSha256": "contentSha256"
}SDK examples#
The selected SDK is remembered across the API reference. Values are examples; replace them with identifiers and input from your application.
import { CloudPDFClient } from "@cloudpdf/sdk";
const client = new CloudPDFClient({
baseUrl: "https://yourhost.com/path/to/api",
token: "<token>",
});
await client.documents.init({
tenantId: "tenantId",
contentLength: 1.1,
contentSha256: "contentSha256"
});Responses#
application/jsonDocumentsInit200Responsetag"created"documentobjectidstringtenantIdstringstate"pending" | "ready" | "failed" | "deleting"baseShastringstorageSizeBytesnumbermetadataobjectidempotencyKeystringfailureReasonstringthumbnailState"pending" | "ready" | "locked" | "failed"optionalthumbnailUrlstringoptionalcreatedAtnumberupdatedAtnumbercreatedBystringupload"presigned" | "proxy"kind"presigned"presignedobjecturlstringheadersobjectmethod"PUT"expiresAtnumberkeystringapplication/jsonDocumentsInit400Responseerrorobjectcodestringmessagestringapplication/jsonAdminErrorPayloaderrorobjectcodestringmessagestring