Last updated: October 2026
How to mention someone with the LinkedIn API
Short answer
Write @[Name](urn:li:person:ID) or @[Company](urn:li:organization:ID) in the post commentary. The text in brackets must match the member's or organization's name, case sensitive, or it shows as plain text. A plain @name does not link to anyone.
LinkedIn API mentions live inside the commentary string of a Posts API request, written in LinkedIn's little text format. There is no separate mentions array. Below: the exact syntax, the matching rules that decide whether a mention links or falls back to plain text, why getting a person URN is the real obstacle, how hashtags work, and the escaping you still owe the rest of the text.
The mention syntax
A mention is @, the display text in square brackets, then the URN of the member or organization in parentheses. Members use urn:li:person:ID. Companies, schools and showcase pages (now called organization brands) use urn:li:organization:ID. This is the organization example from LinkedIn's Posts API docs:
{
"author": "urn:li:person:YOUR_MEMBER_ID",
"commentary": "Hello @[Devtestco](urn:li:organization:2414183)",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}A member mention looks the same with a person URN: @[Jane](urn:li:person:abc123). The request also needs the usual LinkedIn-Version and X-Restli-Protocol-Version: 2.0.0 headers. The LinkedIn API request builder puts the whole request together for you.
Why LinkedIn mentions are not working: the matching rules
LinkedIn only turns the bracket text into a link when it matches the name of the member or organization behind the URN. If it does not match, LinkedIn's docs say the text appears as normal text, with no link. That is the usual reason a mention "does not work".
- Matching is case sensitive.
- Text that is longer or shorter than the name does not match.
- Members are the exception: the text can match the first name, the last name or the full name. For Jane Smith,
Jane,SmithandJane Smithall work. - Organizations, schools and organization brands need the full name.
Store the URN, check the name
The bracket text has to match the name on LinkedIn. If you keep mentions to reuse later, store the URN and confirm the display name before you post.Getting a person URN is the hard part
The syntax is simple. Finding the ID to put in it is not. An app on LinkedIn's self-serve products (Sign In with LinkedIn using OpenID Connect plus Share on LinkedIn) can call GET https://api.linkedin.com/v2/userinfo, and the sub field is the signed-in member's own id. That gives you urn:li:person:{sub} for the author, which is exactly how OpenTweet builds the author URN for a connected profile.
It tells you nothing about anyone else. Self-serve access has no lookup that turns another member's name or profile URL into a person URN. So in practice you can mention:
- Members who connect to your own app, because you get their id from their own sign-in.
- Organizations whose numeric id you already know, for example a Company Page you administer.
Do not scrape for URNs
Pulling member ids out of LinkedIn pages breaks LinkedIn's terms and puts the posting account at risk. If you cannot get a URN legitimately, write the name as plain text instead.LinkedIn API hashtags
Hashtags need no URN. Write #coding in the commentary and LinkedIn makes it a hashtag. When you read the post back, LinkedIn returns it as a template:
{
"commentary": "Follow best practices {hashtag|\\#|coding}"
}You can send the template form as well. Inside it the # is escaped with a backslash, which JSON doubles to \\# on the wire. A bare #tag is a single word, so a multi-word phrase after # is not one hashtag.
Escape everything else
Mentions and hashtags only work because @ [ ] ( ) # are markup in little text format. LinkedIn's docs say every reserved character has to be escaped with a backslash when you mean it as text, even when it is not part of a mention or hashtag. An unescaped parenthesis elsewhere in the post can cut it off, which is covered in why a LinkedIn API post gets cut off at a parenthesis.
So build the commentary in pieces: escape your own text, then add the mention and hashtag markup unescaped.
const RESERVED = /[\\|{}@[\]()<>#*_~]/g;
const esc = (s) => String(s ?? '').replace(RESERVED, (c) => '\\' + c);
function commentary(parts) {
return parts
.map((p) => {
if (typeof p === 'string') return esc(p);
if (p.mention) return '@[' + esc(p.mention) + '](' + p.urn + ')';
if (p.hashtag) return '#' + p.hashtag;
return '';
})
.join('');
}
commentary([
'Thanks ',
{ mention: 'Devtestco', urn: 'urn:li:organization:2414183' },
' for the launch (and the coffee). ',
{ hashtag: 'shipping' },
]);
// Thanks @[Devtestco](urn:li:organization:2414183) for the launch \(and the coffee\). #shippingTo escape a block of text by hand, paste it into the LinkedIn little text escaper. If LinkedIn rejects the request instead of publishing it, the LinkedIn API error decoder explains the response.
How OpenTweet handles mentions today
OpenTweet escapes every reserved character before your text reaches LinkedIn. That is what keeps parentheses, brackets and underscores from cutting a post short, and it also means @ and # publish as plain text. LinkedIn mentions are not supported in OpenTweet yet, and hashtags appear as the words you typed rather than clickable tags.
What you do get is one API call that posts the same text to your LinkedIn profile, X and Bluesky, with the LinkedIn escaping done for you and a per-network result for each. Details are in the cross-posting docs.
7-day free trial. Cancel anytime.
Frequently asked questions
How do I mention someone with the LinkedIn API?
Put @[Name](urn:li:person:ID) in the commentary field of the post, or @[Company](urn:li:organization:ID) for a company or school. The text in the brackets has to match the name on LinkedIn, case sensitive, or the mention publishes as plain text.
Why is my LinkedIn API mention showing as plain text?
The bracket text does not match the name. Matching is case sensitive, and text that is longer or shorter than the name does not count. A member mention can match the first name, the last name or the full name. An organization mention needs the full name.
Does a plain @name work in the LinkedIn API?
No. A mention needs the URN in parentheses after the bracketed name. And @ is a reserved character in little text format, so if you want a literal @ in the post, escape it with a backslash.
How do I get someone else's LinkedIn person URN?
That is the hard part. With the self-serve products, the userinfo endpoint gives you the signed-in member's own id and nothing about anyone else. There is no self-serve lookup that turns another member's name into a URN. Do not scrape LinkedIn to get one.
How do hashtags work in the LinkedIn API?
Write #tag in the commentary and LinkedIn turns it into a hashtag. When you read the post back, the hashtag comes back as the template {hashtag|\#|tag}, and you can send that template form too.
Can I mention people on LinkedIn through OpenTweet?
Not yet. OpenTweet escapes every reserved character before the text reaches LinkedIn, so posts are never cut off, and as a result @ and # publish as plain text. Mentions are not supported today.
Source: LinkedIn Posts API documentation, section "Mentions and Hashtags using Posts commentary", and the little text format reference on Microsoft Learn.
Keep exploring
More LinkedIn API details, and free tools for the posting request.
LinkedIn API post cut off at a parenthesis
The 15 reserved characters in little text format, and an escape function to paste in.
LinkedIn little text escaper
Paste text, get it back with every reserved character escaped for commentary.
LinkedIn API request builder
Build a valid POST /rest/posts body and curl command in the browser.
LinkedIn API error decoder
Paste a LinkedIn API error and see what it means and how to fix it.
LinkedIn API 403 on /rest/posts
Why a post request comes back forbidden, and the scope or header behind it.
Post to LinkedIn without the escaping work
OpenTweet sends one draft to LinkedIn, X and Bluesky from a single API call. LinkedIn is on every plan from $11.99 a month.
7-day free trial. Cancel anytime.