Publish to a LinkedIn company Page (organization) — text and/or an image.
Connect
OAuth with a Page picker (one login exposes every organization you administer, by name):
curl -X POST https://api.herald.leiritech.com/v1/accounts/connect \
-H "Authorization: Bearer hld_…" -H "Content-Type: application/json" \
-d '{"network":"linkedin","redirect_url":"https://your-app.example/connected"}'
Prerequisites (owner) — this is the gate: LinkedIn must approve your app for the
Community Management API product (not self-serve). Herald requests only
w_organization_social, rw_organization_admin, r_organization_social — do not
add the "Sign In with OpenID" product (LinkedIn requires Community Management API to be
the app's only product). Register redirect
https://herald.leiritech.com/api/oauth/linkedin/callback and save the Client ID/Secret
in admin → Platform apps. Until the product is granted, the OAuth consent fails with
invalid_scope_error.
Publish
curl -X POST https://api.herald.leiritech.com/v1/posts \
-H "Authorization: Bearer hld_…" -H "Content-Type: application/json" \
-d '{"targets":["<linkedin-org-uuid>"],"text":"We are hiring!","mode":"now"}'
{ "id":"…","status":"published","targets":[{"network":"linkedin","status":"published",
"permalink":"https://www.linkedin.com/feed/update/urn:li:share:…"}] }
With an image, Herald registers the upload, PUTs the bytes, and attaches the image URN.
Rules & gotchas
- Text required; image optional.
- Posts go to the organization Page, not a personal profile.
- Stats collected: follower count; per-post likes + comments.
- A
reauth_requiredfailure means the token expired or the product access changed — reconnect the account.