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
| Name | Type | Required | Description |
|---|---|---|---|
owner | string | yes | Asset owner URN — ad account or organization. Within bearer scope. |
preview_id | string | no | Omit 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 class | Means | What to do | Retry |
|---|---|---|---|
UNSUPPORTED_MEDIA_TYPE | Unsupported document format (415). | Provide a supported PDF and retry. | no |
REQUEST_ENTITY_TOO_LARGE | Document exceeds size/page limit (413). | Reduce size/pages and retry. | no |
INVALID_ARGUMENT | Malformed initializeUpload body or bad owner (400). | Fix owner URN/body per surfaced message. | no |
PERMISSION_DENIED | No rw_ads or owner access (403). | Verify scope + owner role; re-auth if needed (needs_reauth). | no |
UPLOAD_URL_EXPIRED | uploadUrl expired before the PUT. | Re-initialize for a fresh uploadUrl, then PUT promptly. | yes |
PROCESSING_INCOMPLETE | Document still processing when referenced. | Poll status until ready before attaching; retry attach. | yes |
TOKEN_REVOKED | Token expired/revoked (401). | Refresh and retry once; else re-auth. | yes |
RESOURCE_EXHAUSTED | Rate limit (429). | Backoff 5/10/20s cap 60s; respect Retry-After. | yes |
PLATFORM_ERROR | LinkedIn 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.