LinkedIn Little Text Escaper
Is your LinkedIn API post truncated at a parenthesis, bracket or underscore? Paste the text to see every character LinkedIn reads as markup, then copy the escaped version that publishes exactly as written.
Why a LinkedIn API post gets truncated
LinkedIn reads commentary as little text format, where | { } @ [ ] ( ) < > # \ * _ ~ are markup. An unescaped one can cut the post off. Put a backslash before each reserved character and the post publishes as written.
Reserved characters found: 16
Q3 results (up 40%) are in. Thanks to @[Jane](urn:li:person:abc123) and the team #growth * Revenue: [redacted] <for now> * Churn: down_2 ~ flat
Red: would be read as markup and can cut the post off or break it. Green: kept on purpose as a mention or hashtag.
Escaped commentary
Q3 results \(up 40%\) are in. Thanks to \@\[Jane\]\(urn:li:person:abc123\) and the team \#growth \* Revenue: \[redacted\] \<for now\> \* Churn: down\_2 \~ flat
As a JSON string value
"Q3 results \\(up 40%\\) are in. Thanks to \\@\\[Jane\\]\\(urn:li:person:abc123\\) and the team \\#growth\n\n\\* Revenue: \\[redacted\\] \\<for now\\>\n\\* Churn: down\\_2 \\~ flat"
The fifteen reserved characters
LinkedIn's little text grammar lists these as the characters that must be escaped to be treated as plain text, and its docs add that this applies even outside a mention or hashtag. The backslash itself is one of them, so a literal backslash in your text becomes two.
\|{}@[]()<>#*_~| Stage | Text |
|---|---|
| What you wrote | Q3 results (up 40%) #growth |
| Escaped commentary | Q3 results \(up 40%\) \#growth |
| Inside the JSON body | "commentary": "Q3 results \\(up 40%\\) \\#growth" |
| What LinkedIn shows | Q3 results (up 40%) #growth |
The tradeoff
Escaping everything turns #hashtags and @mentions into plain text. To keep them as links, use the keep option: it leaves@[Name](urn) mentions, hashtag templates and #word hashtags alone and escapes the rest. See how to mention someone with the LinkedIn API.Building the whole request?
The LinkedIn Posts API Request Builder uses the same escaping and writes the full /rest/posts call in curl, Python or Node, including image uploads, multi-image posts, article cards and polls. For a step by step Python walkthrough, read how to post to LinkedIn with the API in Python, and if LinkedIn answers with an error, paste it into the LinkedIn API Error Decoder.
Or let OpenTweet escape it for you
OpenTweet escapes every reserved character before a post reaches LinkedIn. Connect your profile once and post with one call, or from the dashboard. The same call can post to X and Bluesky too.
curl -X POST https://opentweet.io/api/v1/posts \
-H "Authorization: Bearer ot_your_key" \
-H "Content-Type: application/json" \
-d '{
"text": "Q3 results (up 40%) are in. Thanks to the team.",
"platforms": ["linkedin"],
"publish_now": true
}'7-day free trial, then from $11.99/mo. API, X, Bluesky and LinkedIn on every plan.
LinkedIn Little Text FAQ
Why is my LinkedIn API post truncated?
LinkedIn reads the commentary field as little text format, where | { } @ [ ] ( ) < > # \ * _ ~ are markup. An unescaped one, most often a parenthesis or bracket, can cut the post off at that point. Put a backslash before each reserved character and the post publishes as written.
Which characters does LinkedIn little text reserve?
Fifteen: pipe, both curly braces, @, both square brackets, both parentheses, both angle brackets, #, backslash, asterisk, underscore and tilde. LinkedIn says all of them must be escaped with a backslash, even when they are not part of a mention or hashtag.
Will the backslashes show in the published post?
No. A backslash tells LinkedIn to treat the next character as text, so the post shows only the character. Backslashes show up when the same text is escaped twice, so escape once, right before you build the request.
How do I escape and still keep a mention or hashtag?
Tick the keep option. It leaves @[Name](urn:li:person:id) and @[Name](urn:li:organization:id) mentions, {hashtag|\#|tag} templates and plain #word hashtags as they are and escapes every other reserved character. A mention only links when the text in brackets matches the name, case sensitive: the first, last or full name of a member, or the full name of an organization.
Do I escape again when I put the text in JSON?
JSON escapes each backslash once more, so \( in your text becomes \\( inside the JSON string. That is the encoding, not a second little text escape, and the JSON library does it for you. The escaper shows both forms.
Does OpenTweet escape LinkedIn posts for me?
Yes. OpenTweet escapes every reserved character before a post reaches LinkedIn, so parentheses and brackets publish as written. Hashtags and @mentions publish as plain text for the same reason. Plans start at $11.99/month with a 7-day trial.
Related tools and guides
LinkedIn API post cut off
The reserved set, an escape function in Python and JavaScript, and the tradeoff.
LinkedIn Posts API Request Builder
A ready-to-run /rest/posts request in curl, Python or Node.
LinkedIn API Error Decoder
Paste a LinkedIn API error and get the cause and the fix.
Post to LinkedIn with Python
OAuth, the person URN, text and image posts, step by step.
LinkedIn Character Counter
Count a post against LinkedIn limits before you send it.