SCALIX help

← All tools

lads_upload_document

LinkedIn Ads write medium risk

Part of the Sponsored Content Agent.

What it does

STARTS a document (PDF) upload only: POST /rest/documents?action=initializeUpload with {owner} and returns uploadUrl and the document URN urn:li:document:{id}. It stops there — no bytes are sent from Scalix, so the URN is not usable until the caller PUTs the file to uploadUrl (scheduled for November). Two-phase (parity with Google, ADR-028/029): the first call (no preview_id) builds the request locally and returns a preview_id — nothing is sent to LinkedIn; re-call with that preview_id and identical arguments to COMMIT (single-use, 30-min; a changed/forged/replayed token fails closed).

When to use it

Use to stage a PDF before creating a Document Ad creative. Confirm compliance and ownership, then upload. Do NOT attach to a creative until the upload is confirmed processed.

Inputs

NameTypeRequiredDescription
ownerstringyesAsset owner URN — ad account or organization. Within bearer scope.
preview_idstringnoOmit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview.

Safeguards

A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.

Policy

Document content must meet LinkedIn editorial standards and make no claim the destination can't support; AI-generated content must be disclosed. Upload only to an owner within the bearer's scope.

Reminder

Document content must be professional, accurate, and policy-compliant; scope to the authorized account only.

Errors

Error classMeansWhat to doRetry
UNSUPPORTED_MEDIA_TYPEUnsupported document format (415).Provide a supported PDF and retry.no
REQUEST_ENTITY_TOO_LARGEDocument exceeds size/page limit (413).Reduce size/pages and retry.no
INVALID_ARGUMENTMalformed initializeUpload body or bad owner (400).Fix owner URN/body per surfaced message.no
PERMISSION_DENIEDNo rw_ads or owner access (403).Verify scope + owner role; re-auth if needed (needs_reauth).no
UPLOAD_URL_EXPIREDuploadUrl expired before the PUT.Re-initialize for a fresh uploadUrl, then PUT promptly.yes
PROCESSING_INCOMPLETEDocument still processing when referenced.Poll status until ready before attaching; retry attach.yes
TOKEN_REVOKEDToken expired/revoked (401).Refresh and retry once; else re-auth.yes
RESOURCE_EXHAUSTEDRate limit (429).Backoff 5/10/20s cap 60s; respect Retry-After.yes
PLATFORM_ERRORLinkedIn 5xx.Retry with backoff.yes

Edge cases

  • Only PDF (and supported doc types) accepted -> 415 otherwise.
  • uploadUrl is short-lived -> PUT promptly or re-initialize.
  • Processing async -> confirm complete before referencing in a creative.
  • Exact Documents API field names may vary by version -> verify against the pinned LinkedIn-Version.
  • Idempotency: re-initializing creates a new document URN; reuse where possible.