Lin / docu_code /Linkedin.txt
Zelyanoth's picture
fff
25f22bf
========================
CODE SNIPPETS
========================
TITLE: API Documentation for Creating Dark Posts
DESCRIPTION: This section describes the parameters and concepts for creating 'dark posts' on LinkedIn, which are used for ad campaigns and do not appear as organic content. Key parameters include setting `author` as an organization, `visibility` as `PUBLIC`, `feedDistribution` as `NONE`, and providing `adContext` details. Dark posts can be created as inline posts for ad campaigns.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/posts-api
LANGUAGE: APIDOC
CODE:
```
Dark Post Creation:
Endpoint: POST https://api.linkedin.com/rest/posts
Purpose: Create content that does not appear as organic content on a LinkedIn company page, primarily for Ad Campaigns (DSC).
Required Parameters:
author: urn:li:organization:{id} (organization URN)
visibility: PUBLIC
feedDistribution: NONE
adContext: (details of the ad context type)
Lifecycle State: PUBLISHED (for viewing via URL)
View URL Structure: https://www.linkedin.com/feed/update/urn:li:ugcPost:<id>/
```
----------------------------------------
TITLE: Create LinkedIn Post with Organization Mention
DESCRIPTION: Demonstrates how to create a LinkedIn post that includes a mention of an organization. This example tags 'Devtestco' using its URN, showing the HTTP POST request, the JSON payload, and the corresponding curl command.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/posts-api
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: JSON
CODE:
```
{
"author": "urn:li:organization:123456789",
"commentary": "Hello @[Devtestco](urn:li:organization:2414183)",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}
```
LANGUAGE: curl
CODE:
```
curl -X POST 'https://api.linkedin.com/rest/posts' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Content-Type: application/json' \
--data '{
"author": "urn:li:organization:123456789",
"commentary": "Hello @[Devtestco](urn:li:organization:2414183)",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}'
```
----------------------------------------
TITLE: Create a New LinkedIn Post
DESCRIPTION: This snippet demonstrates how to create a new post on the LinkedIn platform using the REST API. It includes the HTTP POST request, the JSON body representing the post content, and a complete cURL command with necessary headers and data.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/event-management/events
LANGUAGE: http
CODE:
```
POST https://api.linkedin.com/rest/posts?actor=urn%3Ali%3Amember%3A253823536
```
LANGUAGE: json
CODE:
```
{
"author": {
"company": "urn:li:company:7185861"
},
"postContent": {
"commentary": {
"attributes": [],
"text": ""
},
"content": {
"content": {
"value": {
"com.linkedin.content.ReferenceContent": {
"content": "urn:li:liveVideo:7249811612692275200"
}
}
}
}
},
"lifecycleState": {
"com.linkedin.ugc.PublishedState": {
}
},
"visibility": "PUBLIC",
"origin": "FEED",
"context": {
"paidEndorsementContext": {
"active": false
}
},
"distribution": {
"feedDistribution": "MAIN_FEED",
"externalDistributionChannels": []
}
}
```
LANGUAGE: curl
CODE:
```
curl --location 'https://api.linkedin.com/rest/posts?actor=urn%3Ali%3Amember%3A253823536' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-RestLi-Method: create' \
--header 'X-RestLi-Protocol-Version: 2.0.0' \
--header 'X-LI-R2-W-MsgType: REST' \
--header 'Authorization: Bearer <redacted>' \
--header 'LinkedIn-Version: {version number in the format YYYYMM}' \
--data '{
"author": {
"company": "urn:li:company:7185861"
},
"postContent": {
"commentary": {
"attributes": [],
"text": ""
},
"content": {
"content": {
"value": {
"com.linkedin.content.ReferenceContent": {
"content": "urn:li:liveVideo:7249811612692275200"
}
}
}
}
},
"lifecycleState": {
"com.linkedin.ugc.PublishedState": {
}
},
"visibility": "PUBLIC",
"origin": "FEED",
"context": {
"paidEndorsementContext": {
"active": false
}
},
"distribution": {
"feedDistribution": "MAIN_FEED",
"externalDistributionChannels": []
}
}'
```
----------------------------------------
TITLE: Create Single Media Post (Video) via LinkedIn API
DESCRIPTION: Illustrates how to create a post containing a single video asset on LinkedIn. Prior to creating the post, the video asset must be uploaded to obtain its URN (e.g., urn:li:video:{id}). The content.media field is used to specify the video asset's ID and title. Similar patterns apply for image and document posts. A successful response returns a 201 status and the Post ID.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/posts-api
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: JSON
CODE:
```
{
"author": "urn:li:organization:5515715",
"commentary": "Sample video Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"content": {
"media": {
"title":"title of the video",
"id": "urn:li:video:C5F10AQGKQg_6y2a4sQ"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}
```
LANGUAGE: cURL
CODE:
```
curl -X POST 'https://api.linkedin.com/rest/posts' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Content-Type: application/json' \
--data '{ \
"author": "urn:li:organization:5515715", \
"commentary": "Sample video Post", \
"visibility": "PUBLIC", \
"lifecycleState": "PUBLISHED", \
"distribution": { \
"feedDistribution": "MAIN_FEED", \
"targetEntities": [], \
"thirdPartyDistributionChannels": [] \
}, \
"content": { \
"media": { \
"title":"title of the video", \
"id": "urn:li:video:C5F10AQGKQg_6y2a4sQ" \
} \
}, \
"isReshareDisabledByAuthor": false \
}'
```
----------------------------------------
TITLE: Create LinkedIn Post with Hashtag
DESCRIPTION: Demonstrates how to create a LinkedIn post that includes a hashtag. This example uses '#coding', showing the HTTP POST request, the JSON payload, and the corresponding curl command.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/posts-api
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: JSON
CODE:
```
{
"author": "urn:li:organization:123456789",
"commentary": "Follow best practices #coding",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}
```
LANGUAGE: curl
CODE:
```
curl -X POST 'https://api.linkedin.com/rest/posts' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Content-Type: application/json' \
--data '{
"author": "urn:li:organization:123456789",
"commentary": "Follow best practices #coding",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}'
```
----------------------------------------
TITLE: Create Article Post using LinkedIn Posts API
DESCRIPTION: This snippet demonstrates how to create an article post on LinkedIn using the Posts API. It requires an organization URN for the author, a commentary, visibility settings, and detailed article content including source URL, thumbnail image URN (from Images API), title, and description. The request must include 'Content-Type: application/json'.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/posts-api
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: JSON
CODE:
```
{
"author": "urn:li:organization:5515715",
"commentary": "test article post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"content": {
"article": {
"source": "https://lnkd.in/eabXpqi",
"thumbnail": "urn:li:image:C49klciosC89",
"title": "prod test title two",
"description": "test description"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}
```
LANGUAGE: cURL
CODE:
```
curl -X POST 'https://api.linkedin.com/rest/posts' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Content-Type: application/json' \
--data '{
"author": "urn:li:organization:5515715",
"commentary": "test article post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"content": {
"article": {
"source": "https://lnkd.in/eabXpqi",
"thumbnail": "urn:li:image:C49klciosC89",
"title": "prod test title two",
"description": "test description"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}'
```
----------------------------------------
TITLE: Create Text-Only Post via LinkedIn API
DESCRIPTION: Demonstrates how to create a simple text-only post on LinkedIn using the POST /rest/posts endpoint. The request requires Content-Type: application/json and includes the author URN, commentary, visibility, and distribution settings. A successful response returns a 201 status and the Post ID in the x-restli-id header.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/posts-api
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: JSON
CODE:
```
{
"author": "urn:li:organization:5515715",
"commentary": "Sample text Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}
```
LANGUAGE: cURL
CODE:
```
curl -X POST 'https://api.linkedin.com/rest/posts' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Content-Type: application/json' \
--data '{ \
"author": "urn:li:organization:5515715", \
"commentary": "Sample text Post", \
"visibility": "PUBLIC", \
"distribution": { \
"feedDistribution": "MAIN_FEED", \
"targetEntities": [], \
"thirdPartyDistributionChannels": [] \
}, \
"lifecycleState": "PUBLISHED", \
"isReshareDisabledByAuthor": false \
}'
```
----------------------------------------
TITLE: Create Carousel Post (LinkedIn Posts API)
DESCRIPTION: Demonstrates how to create a new post with carousel content using the LinkedIn Posts API. The request body includes author, ad context, commentary, visibility, distribution settings, lifecycle state, and content details with an array of media cards. A successful response returns a '201 Created' HTTP status code and the post ID in the 'x-linkedin-id' response header.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/version/carousel-ads-integrations
LANGUAGE: http
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: json
CODE:
```
{
"author": "urn:li:organization:2414183",
"adContext": {
"dscAdAccount": "urn:li:sponsoredAccount:508915158",
"dscStatus": "ACTIVE"
},
"commentary": "sample commentary",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "NONE",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false,
"content": {
"carousel": {
"cards": [
{"media": {
"id": "urn:li:image:C4E22AQGX_uq7mQBfAA",
"title": "first card"
},
"landingPage": "http://www.linkedin.com/"
},
{"media": {
"id": "urn:li:image:C4E22AQGX_uq7mQBfAA",
"title": "second card"
},
"landingPage": "http://www.linkedin.com/"
}
]
}
},
"contentLandingPage": "http://www.linkedin.com/contentLandingPage"
}
```
LANGUAGE: curl
CODE:
```
curl --location --request POST 'https://api.linkedin.com/rest/posts' \
--header 'x-restli-protocol-version: 2.0.0' \
--header 'LinkedIn-Version: {version number in the format YYYYMM}' \
--header 'Authorization: Bearer {INSERT_TOKEN}' \
--header 'Content-Type: application/json' \
--data '{
"author": "urn:li:organization:2414183",
"adContext": {
"dscAdAccount": "urn:li:sponsoredAccount:508915158",
"dscStatus": "ACTIVE"
},
"commentary": "sample commentary",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "NONE",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false,
"content": {
"carousel": {
"cards": [
{"media": {
"id": "urn:li:image:C4E22AQGX_uq7mQBfAA",
"title": "first card"
},
"landingPage": "http://www.linkedin.com/"
},
{"media": {
"id": "urn:li:image:C4E22AQGX_uq7mQBfAA",
"title": "second card"
},
"landingPage": "http://www.linkedin.com/"
}
]
}
},
"contentLandingPage": "http://www.linkedin.com/contentLandingPage"
}'
```
----------------------------------------
TITLE: Create LinkedIn Article Content via Posts API
DESCRIPTION: This snippet demonstrates how to create new article content on LinkedIn using the Posts API. It includes the HTTP POST endpoint, the JSON request body structure, and a cURL command example. Note that image thumbnails require prior upload to be included.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/version/article-ads-integrations
LANGUAGE: http
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: json
CODE:
```
{
"author": "urn:li:organization:5515715",
"commentary": "test strings",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"content": {
"article": {
"source": "https://lnkd.in/eabXpqi",
"thumbnail": "urn:li:image:C49klciosC89",
"title": "prod test title two",
"description": "test description"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}
```
LANGUAGE: curl
CODE:
```
curl --location --request POST 'https://api.linkedin.com/rest/posts' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'X-Restli-Protocol-Version: 2.0.0'\
--data-raw '{
"author": "urn:li:organization:5515715",
"commentary": "test strings",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"content": {
"article": {
"source": "https://lnkd.in/eabXpqi",
"thumbnail": "urn:li:image:C49klciosC89",
"title": "prod test title two",
"description": "test description"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}'
```
----------------------------------------
TITLE: Create Organic Targeted Video Post on LinkedIn
DESCRIPTION: This snippet demonstrates how to create an organic video post with specific targeting (geo-target and seniority) using the LinkedIn API. It requires a 'Content-Type: application/json' header and publishes the post immediately.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/posts-api
LANGUAGE: http
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: json
CODE:
```
{
"author": "urn:li:organization:5515715",
"commentary": "Sample targeted video Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [{
"geoLocations": [
"urn:li:geo:103644278"
],
"seniorities": [
"urn:li:seniority:3"
]
}],
"thirdPartyDistributionChannels": []
},
"content":{
"media":{
"title":"title of the video",
"id": "urn:li:video:C5F10AQGKQg_6y2a4sQ"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}
```
LANGUAGE: curl
CODE:
```
curl -X POST 'https://api.linkedin.com/rest/posts' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Content-Type: application/json' \
--data '{
"author": "urn:li:organization:5515715",
"commentary": "Sample targeted video Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [{
"geoLocations": [
"urn:li:geo:103644278"
],
"seniorities": [
"urn:li:seniority:3"
]
}],
"thirdPartyDistributionChannels": []
},
"content":{
"media":{
"title":"title of the video",
"id": "urn:li:video:C5F10AQGKQg_6y2a4sQ"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}'
```
----------------------------------------
TITLE: Create Post with Mention and Hashtag using `little` Format
DESCRIPTION: Demonstrates how to create a post using the LinkedIn Posts API, including a company mention and a hashtag formatted with the `little` text format. The request uses `curl` to send a JSON payload.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/little-text-format
LANGUAGE: curl
CODE:
```
curl --location 'https://api.linkedin.com/rest/posts' \
--header 'LinkedIn-Version: 202502' \
--header 'X-Restli-Protocol-Version: 2.0.0' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data-raw '{
"author": "urn:li:organization:2414183",
"commentary": "This example mentions a company @[DevtestCo](urn:li:organization:2414183) and {hashtag|\\#|MyTestTag}",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED"
},
"lifecycleState": "PUBLISHED"
}'
```
----------------------------------------
TITLE: Simple Job Postings API Endpoint
DESCRIPTION: The API endpoint for creating new job postings via the SimpleJobPostings API.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/talent/apply-connect/sync-jobs-onsite-apply
LANGUAGE: APIDOC
CODE:
```
POST https://api.linkedin.com/v2/simpleJobPostings
```
----------------------------------------
TITLE: Create Video Post API Request
DESCRIPTION: This API request creates a new video post on LinkedIn. It includes details such as ad context, author, commentary, visibility, distribution settings, and video content. The post can be sponsored and targeted to specific demographics. A successful response returns a 201 Created HTTP status code and the ID in the 'x-linkedin-id' response header.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/create-and-manage-video
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: JSON
CODE:
```
{
"adContext": {
"dscAdAccount": "urn:li:sponsoredAccount:508915158",
"dscStatus": "ACTIVE"
},
"author": "urn:li:organization:5515715",
"commentary": "Sample Video Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "NONE",
"targetEntities": [{
"geoLocations": [
"urn:li:geo:103644278"
],
"seniorities": [
"urn:li:seniority:3"
]
}],
"thirdPartyDistributionChannels": []
},
"content":{
"media":{
"title":"title of the video",
"id": "urn:li:video:C5F10AQGKQg_6y2a4sQ"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": true
}
```
LANGUAGE: curl
CODE:
```
curl --location --request POST 'https://api.linkedin.com/rest/posts/' \
–header 'LinkedIn-Version: {version number in the format YYYYMM}' \
--header 'Authorization: Bearer {INSERT_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"adContext": {
"dscAdAccount": "urn:li:sponsoredAccount:508915158",
"dscStatus": "ACTIVE"
},
"author": "urn:li:organization:5515715",
"commentary": "Sample Video Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "NONE",
"targetEntities": [{
"geoLocations": [
"urn:li:geo:103644278"
],
"seniorities": [
"urn:li:seniority:3"
]
}],
"thirdPartyDistributionChannels": []
},
"content":{
"media":{
"title":"title of the video",
"id": "urn:li:video:C5F10AQGKQg_6y2a4sQ"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": true
}'
```
----------------------------------------
TITLE: Create Poll Content using LinkedIn Posts API
DESCRIPTION: Demonstrates how to create a new poll post on LinkedIn using the `/rest/posts` endpoint. Includes the HTTP method, request body structure, and a cURL example. Requires `Content-Type: application/json` header for the request.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/poll-post-api
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: JSON
CODE:
```
{
"author": "urn:li:organization:2414183",
"commentary": "test poll",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false,
"content": {
"poll": {
"question" :"What is your favorite color?",
"options" : [ { "text" : "Red" }, { "text" : "Blue" }, {"text": "Yellow"}, {"text": "green"} ],
"settings" : { "duration" : "THREE_DAYS" }
}
}
}
```
LANGUAGE: cURL
CODE:
```
curl --location --request POST 'https://api.linkedin.com/rest/posts' \
--header 'LinkedIn-Version: {version number in the format YYYYMM}' \
--header 'Authorization: Bearer {INSERT_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"author": "urn:li:organization:2414183",
"commentary": "test poll",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false,
"content": {
"poll": {
"question" :"What is your favorite color?",
"options" : [ { "text" : "Red" }, { "text" : "Blue" }, {"text": "Yellow"}, {"text": "green"} ],
"settings" : { "duration" : "THREE_DAYS" }
}
}
}'
```
----------------------------------------
TITLE: Article Post API Workflow
DESCRIPTION: Outlines the sequential steps for using the Article Post API, from uploading optional image assets via the Images API to creating, getting, and batch getting article content.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/version/article-ads-integrations
LANGUAGE: APIDOC
CODE:
```
Workflow:
1. Upload Article image assets via Images API (Note: This step only applies for optional thumbnail content)
2. Create Article content
3. Get Article content
4. Batch Get Article content
```
----------------------------------------
TITLE: Create a Dark Post for a LinkedIn Live Event
DESCRIPTION: This section outlines the process of creating a 'dark post' specifically for a LinkedIn Live event. A dark post is not distributed to the main feed. It includes the HTTP POST request endpoint, a sample JSON payload for the request body, and a cURL command demonstrating how to send the request with necessary headers and the JSON data. The payload specifies ad context, author, commentary, visibility, distribution settings (set to NONE for dark posts), and a reference to the live video URN.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/version/event-ads-integrations
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: JSON
CODE:
```
{
"adContext": {
"dscAdAccount": "urn:li:sponsoredAccount:53333333341",
"dscStatus": "ACTIVE"
},
"author": "urn:li:organization:1234567",
"commentary": "Sample Live Event Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "NONE",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"content":{
"reference":{
"id": "urn:li:liveVideo:7240449542943305728"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": true
}
```
LANGUAGE: cURL
CODE:
```
curl --location POST 'https://api.linkedin.com/rest/posts' \
-H'X-RestLi-Protocol-Version: 2.0.0' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Content-Type: application/json' \
--data '{
"adContext": {
"dscAdAccount": "urn:li:sponsoredAccount:53333333341",
"dscStatus": "ACTIVE"
},
"author": "urn:li:organization:1234567",
"commentary": "Sample Live Event Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "NONE",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"content":{
"reference":{
"id": "urn:li:liveVideo:7240449542943305728"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": true
}'
```
----------------------------------------
TITLE: Post an Event API Reference
DESCRIPTION: This section describes the process of publishing a created event on LinkedIn using the Posts API. An event becomes publicly accessible only after successful posting.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/event-management/events
LANGUAGE: APIDOC
CODE:
```
In this step, a request is made to the [Posts API](../community-management/shares/posts-api?view=li-lms-2025-06) to publish an event on LinkedIn. An event becomes readable and writeable only after it has been successfully posted.
#### Live Video Event Example
In this example one uses the value of the property `type.online.format.liveVideo.liveVideo` in the response to the [creation of a live video event](#live-video-event-example) to post that event.
```
----------------------------------------
TITLE: HTTP POST Request for LinkedIn Posts
DESCRIPTION: Specifies the HTTP method and endpoint for creating new posts on the LinkedIn API.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/version/document-ads
LANGUAGE: http
CODE:
```
POST https://api.linkedin.com/rest/posts
```
----------------------------------------
TITLE: Create UGC Post on LinkedIn API
DESCRIPTION: This snippet demonstrates how to create a new User-Generated Content (UGC) post on LinkedIn. It includes setting the content type to application/json, defining the author, lifecycle state, specific content (like media, commentary, and category), target audience, and visibility. Optionally, landingPage and title can be set for future sponsorship.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/ugc-post-api
LANGUAGE: http
CODE:
```
POST https://api.linkedin.com/v2/ugcPosts
```
LANGUAGE: json
CODE:
```
{
"author": "urn:li:organization:5590506",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"media": "urn:li:digitalmediaAsset:C5500AQG7r2u00ByWjw",
"status": "READY",
"title": {
"attributes": [],
"text": "Sample Video Create"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "VIDEO"
}
},
"targetAudience": {
"targetedEntities": [
{
"geoLocations": [
"urn:li:geo:103644278"
],
"seniorities": [
"urn:li:seniority:3"
]
}
]
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
```
LANGUAGE: curl
CODE:
```
curl -X POST 'https://api.linkedin.com/v2/ugcPosts' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'Content-Type: application/json' \
--data '{
"author": "urn:li:organization:5590506",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"media": "urn:li:digitalmediaAsset:C5500AQG7r2u00ByWjw",
"status": "READY",
"title": {
"attributes": [],
"text": "Sample Video Create"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "VIDEO"
}
},
"targetAudience": {
"targetedEntities": [
{
"geoLocations": [
"urn:li:geo:103644278"
],
"seniorities": [
"urn:li:seniority:3"
]
}
]
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}'
```
----------------------------------------
TITLE: Create LinkedIn Image Post via API
DESCRIPTION: This snippet demonstrates how to create a new image post on LinkedIn using the REST API. It requires an existing image URN and involves sending a POST request to the `/rest/posts` endpoint with a JSON payload specifying ad context, author, commentary, visibility, distribution, and content details. Ensure the `Content-Type: application/json` header is included.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/version/image-ads-integrations
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: JSON
CODE:
```
{
"adContext": {
"dscAdAccount": "urn:li:sponsoredAccount:508915158",
"dscStatus": "ACTIVE"
},
"author": "urn:li:organization:5515715",
"commentary": "Sample Image Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "NONE",
"thirdPartyDistributionChannels": []
},
"content":{
"media":{
"title":"title of the image",
"id": "urn:li:image:C5F10AQGKQg_6y2a4sQ"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": true
}
```
LANGUAGE: curl
CODE:
```
curl --location --request POST 'https://api.linkedin.com/rest/posts/' \
–H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'X-Restli-Protocol-Version: 2.0.0'\
--data-raw '{
"adContext": {
"dscAdAccount": "urn:li:sponsoredAccount:508915158",
"dscStatus": "ACTIVE"
},
"author": "urn:li:organization:5515715",
"commentary": "Sample Image Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "NONE",
"targetEntities": [{
"geoLocations": [
"urn:li:geo:103644278"
],
"seniorities": [
"urn:li:seniority:3"
]
}],
"thirdPartyDistributionChannels": []
},
"content":{
"media":{
"title":"title of the image",
"id": "urn:li:image:C5F10AQGKQg_6y2a4sQ"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": true
}'
```
----------------------------------------
TITLE: Create New LinkedIn Post with Document Content
DESCRIPTION: Provides the API endpoint and request body structure for creating a new post that includes document content. The example demonstrates how to specify the author, commentary, visibility, distribution, and link to an existing document ID. A cURL command is also provided for direct execution.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/documents-api
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: JSON
CODE:
```
{
"author": "urn:li:organization:1234567",
"commentary": "test strings!",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"content": {
"media": {
"title":"Example.pdf",
"id": "urn:li:document:D5510AQFx87994pYx0Q"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}
```
LANGUAGE: cURL
CODE:
```
curl --location --request POST 'https://api.linkedin.com/rest/posts' \
--header 'LinkedIn-Version: {version number in the format YYYYMM}' \
--header 'Authorization: Bearer {INSERT_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"author": "urn:li:organization:1234567",
"commentary": "test strings!",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"content": {
"media": {
"title":"Example.pdf",
"id": "urn:li:document:D5510AQFx87994pYx0Q"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false
}'
```
----------------------------------------
TITLE: Create MultiImage Post on LinkedIn API
DESCRIPTION: This snippet demonstrates how to create a new post with multiple images on LinkedIn using a POST request. It includes the HTTP request line, the JSON payload structure, and the equivalent cURL command. The 'Content-Type: application/json' header is required for the request body.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/multiimage-post-api
LANGUAGE: http
CODE:
```
POST https://api.linkedin.com/rest/posts
```
LANGUAGE: json
CODE:
```
{
"author": "urn:li:organization:2414183",
"commentary": "test multiimage post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false,
"content": {
"multiImage": {
"images": [
{
"id": "urn:li:image:C4D22AQFttWMAaIqHaa",
"altText": "testing for alt tags1"
},
{
"id": "urn:li:image:C4D22AQG7uz0yPJh588",
"altText": "testing for alt tags2"
}
]
}
}
}
```
LANGUAGE: curl
CODE:
```
curl --location --request POST 'https://api.linkedin.com/rest/posts'
--header 'LinkedIn-Version: {version number in the format YYYYMM}'
--header 'Authorization: Bearer {INSERT_TOKEN}'
--header 'Content-Type: application/json'
--data-raw '{
"author": "urn:li:organization:2414183",
"commentary": "test multiimage post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "MAIN_FEED",
"targetEntities": [],
"thirdPartyDistributionChannels": []
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": false,
"content": {
"multiImage": {
"images": [
{
"id": "urn:li:image:C4D22AQFttWMAaIqHaa",
"altText": "testing for alt tags1"
},
{
"id": "urn:li:image:C4D22AQG7uz0yPJh588",
"altText": "testing for alt tags2"
}
]
}
}
}'
```
----------------------------------------
TITLE: Workflow to Create an Event Ad with a New Post
DESCRIPTION: Outlines the sequential steps required to create an Event Ad, starting from campaign creation to the final creative setup using a dark post.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/version/event-ads-integrations
LANGUAGE: APIDOC
CODE:
```
Workflow:
1. Create a Campaign for Event Ad.
2. Create the Post for the Event (This should be a dark post).
3. Create an Event Creative with the Event dark post.
```
----------------------------------------
TITLE: Create LinkedIn UGC Post with Video Content
DESCRIPTION: This snippet demonstrates how to create a User Generated Content (UGC) post on LinkedIn, specifically for sharing video content. It includes the API endpoint, the required JSON payload structure for video shares, and a complete cURL command for execution. Ensure the `Content-Type` header is set to `application/json` and replace `{INSERT_TOKEN}` with a valid bearer token.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/ugc-post-api
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/v2/ugcPosts
```
LANGUAGE: JSON
CODE:
```
{
"author": "urn:li:organization:5590506",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"landingPage": {
"landingPageTitle": "LEARN_MORE",
"landingPageUrl": "https:linkedin.com"
},
"media": "urn:li:digitalmediaAsset:C5500AQG7r2u00ByWjw",
"status": "READY",
"title": {
"attributes": [],
"text": "Sample Video Create"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "VIDEO"
}
},
"visibility": {
"com.linkedin.ugc.SponsoredContentVisibility": "DARK"
}
}
```
LANGUAGE: curl
CODE:
```
curl -X POST 'https://api.linkedin.com/v2/ugcPosts' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'Content-Type: application/json' \
--data '{
"author": "urn:li:organization:5590506",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"landingPage": {
"landingPageTitle": "LEARN_MORE",
"landingPageUrl": "https:linkedin.com"
},
"media": "urn:li:digitalmediaAsset:C5500AQG7r2u00ByWjw",
"status": "READY",
"title": {
"attributes": [],
"text": "Sample Video Create"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "VIDEO"
}
},
"visibility": {
"com.linkedin.ugc.SponsoredContentVisibility": "DARK"
}
}'
```
----------------------------------------
TITLE: Sample JSON Request Body for Basic Job Posting (Integration Context)
DESCRIPTION: Provides a JSON payload example for creating multiple basic job postings, using `integrationContext` to specify the organization. It includes fields like `companyApplyUrl`, `description`, `employmentStatus`, `externalJobPostingId`, `listedAt`, `jobPostingOperationType`, `title`, `location`, and `workplaceTypes`.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/talent/job-postings/api/create-jobs
LANGUAGE: JSON
CODE:
```
{
"elements": [{
"integrationContext": "urn:li:organization:2414183",
"companyApplyUrl": "http://linkedin.com",
"description": "We are looking for a passionate Software Engineer to design, develop and install software solutions. Software Engineer responsibilities include gathering user requirements, defining system functionality and writing code in various languages. Our ideal candidates are familiar with the software development life cycle (SDLC) from preliminary system analysis to tests and deployment.",
"employmentStatus": "PART_TIME",
"externalJobPostingId": "1234",
"listedAt": 1440716666,
"jobPostingOperationType": "CREATE",
"title": "Software Engineer",
"location": "India",
"workplaceTypes": [
"remote"
]
},
{
"integrationContext": "urn:li:organization:2414183",
"companyApplyUrl": "http://linkedin.com",
"description": "We are looking for a passionate Software Engineer to design, develop and install software solutions. Software Engineer responsibilities include gathering user requirements, defining system functionality and writing code in various languages. Our ideal candidates are familiar with the software development life cycle (SDLC) from preliminary system analysis to tests and deployment.",
"employmentStatus": "PART_TIME",
"externalJobPostingId": "1234",
"listedAt": 1440716666,
"jobPostingOperationType": "CREATE",
"title": "Software Engineer",
"location": "San Francisco, CA",
"workplaceTypes": [
"hybrid"
]
},
{
"integrationContext": "urn:li:organization:2414183",
"companyApplyUrl": "http://linkedin.com",
"description": "We are looking for a passionate Senior Software Engineer to design, develop and install software solutions. Software Engineer responsibilities include gathering user requirements, defining system functionality and writing code in various languages. Our ideal candidates are familiar with the software development life cycle (SDLC) from preliminary system analysis to tests and deployment.",
"employmentStatus": "PART_TIME",
"externalJobPostingId": "789",
"listedAt": 1440716666,
"jobPostingOperationType": "CREATE",
"title": "Senior Software Engineer",
"location": "San Francisco, CA"
}
]
}
```
----------------------------------------
TITLE: UGC Post Creation Validation Rules
DESCRIPTION: This section outlines critical validation rules for successfully creating UGC posts. Adhering to these rules, such as matching owner and author fields, ensuring media category consistency, and verifying user roles, is essential to prevent API failures and ensure proper post visibility.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/ugc-post-api
LANGUAGE: APIDOC
CODE:
```
To prevent failures, make sure to verify the following:
- The `registerUploadRequest.owner` field of the referenced asset is the same as the `author` field when you create the UGC Post.
- `ShareContent.shareMediaCategory` matches the same category as the media URN.
- `visibility` can be set as `SponsoredContentVisibility` only when `author` is an `organization` URN.
- `shareContent.ShareMedia.landingPage.landingPageUrl` is a required field for Video Dark Posts.
- The member must have the role of Company Page `ADMINISTRATOR` or `DIRECT_SPONSORED_CONTENT_POSTER`.
```
----------------------------------------
TITLE: Create DMP Segment Destination (POST)
DESCRIPTION: Demonstrates how to create a new destination for an existing DMP segment using a POST request. A successful response returns a 201 Created HTTP status code and the type of destination created in the 'x-linkedin-id' header.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/matched-audiences/create-and-manage-segment-destinations
LANGUAGE: http
CODE:
```
POST https://api.linkedin.com/rest/dmpSegments/11134/destinations
{
"destination": "LINKEDIN"
}
```
LANGUAGE: curl
CODE:
```
curl -X POST 'https://api.linkedin.com/rest/dmpSegments/11134/destinations' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'X-Restli-Protocol-Version: 2.0.0'\
--data '{
"destination": "LINKEDIN"
}'
```
----------------------------------------
TITLE: Sample JSON Request Body for Creating a Job Posting
DESCRIPTION: This JSON structure represents a sample request body used to create or update a job posting through the LinkedIn API. Key fields include `externalJobPostingId` for unique identification, `title` and `description` for job details, `contract` and `integrationContext` (or `company`) for organizational context, and `companyApplyUrl` for the application link. The `jobPostingOperationType` specifies the action (e.g., CREATE). Note that duplicate updates to the same `externalJobPostingId` should be avoided, and providing contract information is mandatory for internal job postings.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/talent/job-postings/api/create-jobs
LANGUAGE: json
CODE:
```
{
"elements":[
{
"externalJobPostingId":"PremiumJobPostingG1TC1",
"listingType":"BASIC",
"title":"Job Posting G1 TC1",
"description":"<b>Objective of the Position</b><br/> <ul> <li>To develop digital content plan, manage and monitor different content executions for social and online platforms to maximize the communication effectiveness and impact</li> <li>To manage, monitor and keep optimizing the performance of social platforms of MB and AMG</li> <li>To monitor and manage internet word of mouth to keep the health of brand and product image</li></ul>",
"contract":"urn:li:contract:{your_contract_id}",
"integrationContext":"urn:li:organization:{your_organization_id}",
"companyApplyUrl": "http://linkedin.com/jobpostingG1TC1",
"location":"San Francisco, CA",
"listedAt":1513756352000,
"jobPostingOperationType":"CREATE",
"availability": "INTERNAL"
}
]
}
```
----------------------------------------
TITLE: Creating Video Posts via UGC API
DESCRIPTION: The UGC API now supports creating video posts on behalf of a member, which will be posted on their member profile. Authors must reference a member URN, not an organization URN, for this functionality.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/archived-recent-changes/2021/marketing-api-changes
LANGUAGE: APIDOC
CODE:
```
API: UGC API
Functionality: Create video posts on member feeds.
Constraint: Author must reference a member URN, not an organization URN.
```
----------------------------------------
TITLE: Article Post API Content Schema
DESCRIPTION: Defines the data structure for creating and managing article content, specifying fields such as `description`, `source`, `thumbnail`, `thumbnailAltText`, and `title`, along with their types, details, and requirement status.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/version/article-ads-integrations
LANGUAGE: APIDOC
CODE:
```
Schema:
description:
Type: string
Details: Custom or saved description of the article. If empty, there is none. The length must be less than 4086 characters.
Required: optional
source:
Type: URL
Details: A URL of the article. Typically the URL that was ingested to maintain URL parameters. Please note that this field maps to "Destination URL" field in Campaign Manager UI.
Required: required
thumbnail:
Type: ImageUrn
Details: Custom or saved thumbnail for the article. If empty, there is none. To retrieve the download URL, an additional request must be made to the Images API using this URN.
Required: optional
thumbnailAltText:
Type: string
Details: Alt text for the custom thumbnail. If empty, there is none. The length must be less than 4086 characters.
Required: optional
title:
Type: string
Details: Custom or saved title of the article. The length must be less than 400 characters.
Required: required
```
----------------------------------------
TITLE: Create Targeted UGC Post
DESCRIPTION: This snippet demonstrates how to create a User Generated Content (UGC) post on LinkedIn via a POST request to `https://api.linkedin.com/v2/ugcPosts`. It includes examples for specifying content (e.g., video, commentary), setting public visibility, and targeting a specific audience by geo-locations, seniorities, and industries. It also implicitly highlights invalid `targetAudience` configurations by showing a valid example.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/ugc-post-api
LANGUAGE: APIDOC
CODE:
```
POST https://api.linkedin.com/v2/ugcPosts
```
LANGUAGE: JSON
CODE:
```
{
"author": "urn:li:organization:2414183",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"media": "urn:li:digitalmediaAsset:C5500AQG7r2u00ByWjw",
"status": "READY",
"title": {
"attributes": [],
"text": "Sample Video Create"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "VIDEO"
}
},
"targetAudience": {
"targetedEntities": [
{
"geoLocations": [
"urn:li:geo:103644278"
],
"seniorities": [
"urn:li:seniority:3"
],
"industries": [
"urn:li:industry:4"
]
}
]
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
```
LANGUAGE: curl
CODE:
```
curl -X POST 'https://api.linkedin.com/v2/ugcPosts' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'Content-Type: application/json' \
--data '{
"author": "urn:li:organization:2414183",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"media": "urn:li:digitalmediaAsset:C5500AQG7r2u00ByWjw",
"status": "READY",
"title": {
"attributes": [],
"text": "Sample Video Create"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "VIDEO"
}
},
"targetAudience": {
"targetedEntities": [
{
"geoLocations": [
"urn:li:geo:103644278"
],
"seniorities": [
"urn:li:seniority:3"
],
"industries": [
"urn:li:industry:4"
]
}
]
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}'
```
----------------------------------------
TITLE: Create Event Ad Creative via LinkedIn API
DESCRIPTION: This snippet demonstrates how to create a new event ad creative by linking a dark post and a campaign. It requires the ad account ID, a reference to an existing UGC post (dark post), and the campaign URN. A successful request returns a 201 Created status and the creative ID in the 'x-linkedin-id' header.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/version/event-ads-integrations
LANGUAGE: http
CODE:
```
POST https://api.linkedin.com/rest/adAccounts/{adAccountId}/creatives
```
LANGUAGE: json
CODE:
```
{
"content": {
//Post urn - response from the dark post creation API (Step #5.g)
"reference": "urn:li:ugcPost:7240552321461111111"
},
//Campaign urn - response from the campaign API (Step #4.a)
"campaign": "urn:li:sponsoredCampaign:330682563",
"intendedStatus": "ACTIVE"
}
```
LANGUAGE: curl
CODE:
```
curl --location POST -v 'https://api.linkedin.com/rest/adAccounts/{adAccountId}/creatives' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Content-Type: application/json' \
-H 'X-Restli-Protocol-Version: 2.0.0'
--data '{
"content": {
//Post urn - response from the dark post creation API (Step #5.g)
"reference": "urn:li:ugcPost:7240552321461111111"
},
//Campaign urn - response from the campaign API (Step #4.a)
"campaign": "urn:li:sponsoredCampaign:330682563",
"intendedStatus": "ACTIVE"
}'
```
----------------------------------------
TITLE: Sample JSON Request Body for Basic Job Posting (Company ID)
DESCRIPTION: Presents an alternative JSON payload for creating multiple basic job postings, using `company` to specify the organization. It includes similar fields as the previous example, demonstrating flexibility in identifying the associated company.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/talent/job-postings/api/create-jobs
LANGUAGE: JSON
CODE:
```
{
"elements": [{
"company": "urn:li:company:{company_id}",
"companyApplyUrl": "http://linkedin.com",
"description": "We are looking for a passionate Software Engineer to design, develop and install software solutions. Software Engineer responsibilities include gathering user requirements, defining system functionality and writing code in various languages. Our ideal candidates are familiar with the software development life cycle (SDLC) from preliminary system analysis to tests and deployment.",
"employmentStatus": "PART_TIME",
"externalJobPostingId": "1234",
"listedAt": 1440716666,
"jobPostingOperationType": "CREATE",
"title": "Software Engineer",
"location": "India",
"workplaceTypes": [
"remote"
]
},
{
"company": "urn:li:company:{company_id}",
"companyApplyUrl": "http://linkedin.com",
"description": "We are looking for a passionate Software Engineer to design, develop and install software solutions. Software Engineer responsibilities include gathering user requirements, defining system functionality and writing code in various languages. Our ideal candidates are familiar with the software development life cycle (SDLC) from preliminary system analysis to tests and deployment.",
"employmentStatus": "PART_TIME",
"externalJobPostingId": "1234",
"listedAt": 1440716666,
"jobPostingOperationType": "CREATE",
"title": "Software Engineer",
"location": "San Francisco, CA",
"workplaceTypes": [
"hybrid"
]
},
{
"company": "urn:li:company:{company_id}",
"companyApplyUrl": "http://linkedin.com",
"description": "We are looking for a passionate Senior Software Engineer to design, develop and install software solutions. Software Engineer responsibilities include gathering user requirements, defining system functionality and writing code in various languages. Our ideal candidates are familiar with the software development life cycle (SDLC) from preliminary system analysis to tests and deployment.",
"employmentStatus": "PART_TIME",
"externalJobPostingId": "789",
"listedAt": 1440716666,
"jobPostingOperationType": "CREATE",
"title": "Senior Software Engineer",
"location": "San Francisco, CA"
}
]
}
```
----------------------------------------
TITLE: cURL Command to Create LinkedIn Document Post
DESCRIPTION: Provides a complete cURL command example for sending a POST request to the LinkedIn API, including necessary headers and the full JSON payload, to create a sponsored document post.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/version/document-ads
LANGUAGE: curl
CODE:
```
curl -X POST 'https://api.linkedin.com/rest/example' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Authorization: Bearer {INSERT_TOKEN}'\
--header 'Content-Type: application/json' \
--data-raw '{
"adContext": {
"dscAdAccount": "urn:li:sponsoredAccount:508915158",
"dscStatus": "ACTIVE"
},
"author": "urn:li:organization:5515715",
"commentary": "Sample Document Post",
"visibility": "PUBLIC",
"distribution": {
"feedDistribution": "NONE",
"thirdPartyDistributionChannels": []
},
"content":{
"media":{
"title":"title of the document",
"id": "urn:li:document:C5F10AQGKQg_6y2a4sQ"
}
},
"lifecycleState": "PUBLISHED",
"isReshareDisabledByAuthor": true
}'
```
----------------------------------------
TITLE: API Error: UGC_INVALID_FEED_DISTRIBUTION
DESCRIPTION: Signifies that the specified feed distribution for User-Generated Content (UGC) is invalid. UGC content requires specific feed distributions: NONE for dark posts, MAIN_FEED for organic posts, and CONTAINER_ONLY for container posts.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/account-structure/create-and-manage-creatives
LANGUAGE: APIDOC
CODE:
```
UGC_INVALID_FEED_DISTRIBUTION: 400 - Feed distribution {value} is invalid as UGC content should set NONE feed distribution for dark post, MAIN_FEED for organic posts, and CONTAINER_ONLY for container posts
```
----------------------------------------
TITLE: Create UGC Post Activity for Event Share (JSON Payload)
DESCRIPTION: This JSON payload represents the request body for creating a UGC post activity that shares content on a LinkedIn event page. It specifies the owner, the content to be shared (a simple text commentary), and links the post to a specific event using the 'containerEntity' field. The 'processedActivity' section shows how the platform might enrich the data with resolved entity details.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/compliance/integrations/compliance-events/resource-references/ugcposts
LANGUAGE: JSON
CODE:
```
{
"owner": "urn:li:person:Ylpq-RobP9",
"resourceId": "urn:li:ugcPost:123456789",
"configVersion": 53,
"method": "CREATE",
"activity": {
"lifecycleState": "PUBLISHED",
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "CONTAINER"
},
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareMediaCategory": "NONE",
"shareFeatures": {
"hashtags": []
},
"shareCommentary": {
"text": "Hello!"
},
"media": [],
"shareCategorization": {}
}
},
"firstPublishedActor": {
"member": "urn:li:person:Ylpq-RobP9"
},
"author": "urn:li:person:Ylpq-RobP9",
"created": {
"actor": "urn:li:person:Ylpq-RobP9",
"time": 1569543293839
},
"versionTag": "1",
"distribution": {
"feedDistribution": "MAIN_FEED"
},
"ugcOrigin": "DESKTOP",
"containerEntity": "urn:li:event:123456789",
"id": "urn:li:ugcPost:123456789",
"lastModified": {
"time": 1569543293912
},
"firstPublishedAt": 1569543293839
},
"resourceName": "ugcPosts",
"resourceUri": "/ugcPosts/urn:li:ugcPost:123456789",
"actor": "urn:li:person:Ylpq-RobP9",
"activityId": "1b36d266-cfd6-4d8a-ad4d-0ed6c478f233",
"processedAt": 1558380117783,
"capturedAt": 1558380087104,
"processedActivity": {
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareMediaCategory": "NONE",
"shareFeatures": {
"hashtags": []
},
"shareCommentary": {
"text": "Hello!"
},
"media": [],
"shareCategorization": {}
}
},
"author~": {},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "CONTAINER"
},
"author": "urn:li:person:2qXA98-mVk",
"created": {
"actor": "urn:li:person:2qXA98-mVk",
"actor~": {},
"time": 1569543293839
},
"distribution": {
"feedDistribution": "MAIN_FEED"
},
"ugcOrigin": "DESKTOP",
"containerEntity": "urn:li:event:123456789",
"containerEntity~": {
"created": {
"actor": "urn:li:person:2qXA98-mVk",
"actor~": {},
"time": 1569542293839
},
"localizedName": "My Event",
"address": {
"geographicArea": "California",
"country": "US",
"city": "San Francisco"
},
"organizer~": {},
"organizer": "urn:li:person:2qXA98-mVk",
"name": {
"localized": {
"en_US": "My Event"
},
"preferredLocale": {
"country": "US",
"language": "en"
}
},
"description": {
"localized": {
"en_US": {
"rawText": "My Event Description"
}
},
"preferredLocale": {
"country": "US",
"language": "en"
}
},
"id": 123456789,
"localizedDescription": {
"rawText": "Hello!"
},
"timeRange": {
"start": 1570633200000,
"end": 1570636800000
}
},
"id": "urn:li:ugcPost:123456789",
"firstPublishedAt": 1569543293839,
"lastModified": {
"time": 1569543293912
}
},
"id": 841260
}
```
----------------------------------------
TITLE: Example: Create Comment on UGC Post
DESCRIPTION: Provides a concrete example of creating a comment on a specific UGC post, demonstrating the API endpoint and request body with placeholder values for organization ID and token.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/network-update-social-actions
LANGUAGE: http
CODE:
```
https://api.linkedin.com/rest/socialActions/urn%3Ali%3AugcPost%3A7096760097833439232/comments
```
LANGUAGE: json
CODE:
```
{
"actor": "urn:li:organization:{{organization_id}}",
"object": "urn:li:activity:7096760097833439232",
"message": {
"text": "commentV2 with image entity"
}
}
```
LANGUAGE: curl
CODE:
```
curl --location --request POST 'https://api.linkedin.com/rest/socialActions/urn%3Ali%3AugcPost%3A7096760097833439232/comments' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'Authorization: Bearer {insert token}'
--data '{
"actor":"urn:li:organization:79988552",
"object":"urn:li:activity:7096760097833439232",
"message":{
"text":"commentV2 with image entity"
}
}'
```
----------------------------------------
TITLE: Create DMP Segment Destination
DESCRIPTION: Demonstrates how to create a new destination for a DMP segment using a POST request. The request body specifies the `destination` as 'LINKEDIN'.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/matched-audiences/create-and-manage-segment-destinations
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/dmpSegments/11134/destinations
{
"destination": "LINKEDIN"
}
```
LANGUAGE: cURL
CODE:
```
curl -X POST 'https://api.linkedin.com/rest/dmpSegments/11134/destinations' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'X-Restli-Protocol-Version: 2.0.0'\
--data '{
"destination": "LINKEDIN"
}'
```
----------------------------------------
TITLE: LinkedIn Simple Job Posting API Endpoint (REST)
DESCRIPTION: The REST API endpoint for asynchronously submitting tasks to create, close, update, or renew one or more jobs on LinkedIn.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/talent/job-postings/api/create-jobs
LANGUAGE: APIDOC
CODE:
```
POST https://api.linkedin.com/rest/simpleJobPostings
```
----------------------------------------
TITLE: CREATE Method for New Entity Creation (LinkedIn API)
DESCRIPTION: The CREATE method indicates to a service that it should use the information provided in the request body to create a new entity. This method uses the traditional HTTP POST method.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/shared/api-guide/concepts/methods
LANGUAGE: APIDOC
CODE:
```
POST https://api.linkedin.com/v2/{service}/{Request Body}
```
----------------------------------------
TITLE: Create LinkedIn DMP Segment with POST Request
DESCRIPTION: This snippet demonstrates how to create a new DMP segment by sending a POST request to the LinkedIn API. It includes the API endpoint, a sample JSON request body with required fields like name, source platform, account, type, and destinations, and a corresponding cURL command for execution.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/matched-audiences/create-and-manage-segments
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/dmpSegments
```
LANGUAGE: JSON
CODE:
```
{
"name":"DMP Segment 1",
"sourcePlatform":"DMP_PARTNER_PLATFORM", // Name will be provided.
"account":"urn:li:sponsoredAccount:516848833",
"type":"USER",
"destinations":[
{
"destination":"LINKEDIN"
}
]
}
```
LANGUAGE: curl
CODE:
```
curl -X POST 'https://api.linkedin.com/rest/dmpSegments' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'Content-Type: application/json' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data '{
"name":"DMP Segment 1",
"sourcePlatform":"DMP_PARTNER_PLATFORM", // Name will be provided.
"account":"urn:li:sponsoredAccount:516848833",
"type":"USER",
"destinations":[
{
"destination":"LINKEDIN"
}
]
}'
```
----------------------------------------
TITLE: Post LinkedIn Share API Request
DESCRIPTION: Demonstrates how to send a POST request to the LinkedIn Shares API, including the endpoint, sample JSON request body, and a cURL command example for creating new shares.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/share-api
LANGUAGE: http
CODE:
```
POST https://api.linkedin.com/v2/shares
```
LANGUAGE: json
CODE:
```
{
"content": {
"contentEntities": [
{
"entityLocation": "https://www.example.com/content.html",
"thumbnails": [
{
"resolvedUrl": "https://www.example.com/image.jpg"
}
]
}
],
"title": "Test Share with Content"
},
"distribution": {
"linkedInDistributionTarget": {}
},
"owner": "urn:li:person:324_kGGaLE",
"subject": "Test Share Subject",
"text": {
"text": "Test Share!"
}
}
```
LANGUAGE: curl
CODE:
```
curl -X POST 'https://api.linkedin.com/v2/shares' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'Content-Type: application/json' \
--data '{
"content": {
"contentEntities": [
{
"entityLocation": "https://www.example.com/content.html",
"thumbnails": [
{
"resolvedUrl": "https://www.example.com/image.jpg"
}
]
}
],
"title": "Test Share with Content"
},
"distribution": {
"linkedInDistributionTarget": {}
},
"owner": "urn:li:person:324_kGGaLE",
"subject": "Test Share Subject",
"text": {
"text": "Test Share!"
}
}'
```
----------------------------------------
TITLE: API Error Codes for Simple Job Postings
DESCRIPTION: Details common error responses for the `POST /simpleJobPostings` API endpoint, including HTTP status codes, response statuses, error messages, descriptions, and resolutions for each error.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/talent/job-postings/api/create-jobs
LANGUAGE: APIDOC
CODE:
```
Error Details for POST /simpleJobPostings:
- HTTP CODE: 200
RESPONSE STATUS: 422
ERROR MESSAGE: ERROR :: /{mandatory key} :: field is required but not found and has no default value
DESCRIPTION: Required field is missing in the request body
RESOLUTION: Refer to the schema documentation and ensure all the required fields are present in the request body
- HTTP CODE: 200
RESPONSE STATUS: 422
ERROR MESSAGE: ERROR :: /{attribute_name} :: {value} cannot be coerced to Long\n
DESCRIPTION: When value of the attribute does not match the datatype it accepts. For example, `title` accepts String but we have provided numerical value
RESOLUTION: Ensure that the value provided for attribute should match the datatype it accepts. Please refer to schema documentation for data types of the attributes
- HTTP CODE: 200
RESPONSE STATUS: 422
ERROR MESSAGE: ERROR :: /`jobPostingOperationType` :: "UPDATED" is not an enum symbol\n
DESCRIPTION: Wrong value provided for the field `jobPostingOperationType`
RESOLUTION: The value should either be one of `CREATE`, `UPDATE` or `CLOSE`
- HTTP CODE: 200
RESPONSE STATUS: 400
ERROR MESSAGE: The `workplaceTypes` field cannot have more than one value provided. Provided values [..]
DESCRIPTION: `workplaceTypes` field accepts an array of only one element, but the request contains more than one elements for `workplaceTypes` field
RESOLUTION: Ensure that `workplaceTypes` field is an array with only one element (one of the following: `On-Site`, `Hybrid`, `Remote`)
- HTTP CODE: 400
RESPONSE STATUS: 400
ERROR MESSAGE: Invalid company apply url for job with externalPartnerId {externalJobPostingId}, taskUrn urn:li:simpleJobPostingTask:{taskID}
DESCRIPTION: The URL specified for the job posting is in an invalid format
RESOLUTION: Ensure the url specified is in a valid url
- HTTP CODE: 400
RESPONSE STATUS: 400
ERROR MESSAGE: Either `context` or `company` or `companyPageUrl` or `companyName` must be provided
DESCRIPTION: Integration context company field is missing
RESOLUTION: All jobs are associated with company page. You can provide this value with either of the schema fields listed in the error messages
- HTTP CODE: 401
RESPONSE STATUS: 401
ERROR MESSAGE: Invalid access token
DESCRIPTION: Access token is tampered
RESOLUTION: Regenerate a new access token
- HTTP CODE: 401
RESPONSE STATUS: 401
ERROR MESSAGE: The token used in the request has expired
DESCRIPTION: The access token used in Authorization header is a valid token but it has expired
RESOLUTION: Regenerate a new access token
- HTTP CODE: 402
RESPONSE STATUS: 402
ERROR MESSAGE: Insufficient job slots for contract = urn:li:contract:{contract_id} for purchase flow
DESCRIPTION: All job slots associated with the supplied contract are used
RESOLUTION: Please ask the customer to reach out to LinkedIn's customer support to purchase more Job Slots with LinkedIn or Close some existing Premium Job Postings to free up Job Slots. To know more refer to LinkedIn [help center article](https://www.linkedin.com/help/linkedin/answer/a417111?lang=en). If this issue is occurring frequently in your development environment please create a ticket on Zendesk Platform
- HTTP CODE: 402
RESPONSE STATUS: 402
ERROR MESSAGE: Insufficient lifetime budget for contract: urn:li:contract:{contract_id}
DESCRIPTION: For FP4P jobs PAYMENTS_INSUFFICIENT_FUNDS contract has exhausted allocated budget for premium job posting. Contract monthly limits can be setup within LinkedIn Recruiter
RESOLUTION: Please validate contract limit per month or sufficient balance before posting a premium job
- HTTP CODE: 403
RESPONSE STATUS: 403
ERROR MESSAGE: Caller is not authorized to access the jobs for contract: urn:li:contract:{contract_id}
DESCRIPTION: The application used for posting premium job does not belong to the Job posting contract
RESOLUTION: 1. Ensure that you are using the correct contract details provided in the Premium Job Posting onboarding email 2. Ensure that you are using the correct application credentials
- HTTP CODE: 403
RESPONSE STATUS: 403
ERROR MESSAGE: Not enough permissions to access: POST /simpleJobPostings
DESCRIPTION: The application does not have enough permissions to use /simpleJobPostings API
RESOLUTION: Ensure that the header x-restli-method with value batch_create is present
- HTTP CODE: 403
RESPONSE STATUS: 403
ERROR MESSAGE: Unpermitted fields present in REQUEST_BODY: Data Processing Exception while processing fields [/elements]
DESCRIPTION: Value for Request Header: `x-restli-method: batch_create` is not provided
RESOLUTION: Ensure that value for Request Header: `x-restli-method: batch_create` is provided
- HTTP CODE: 403
RESPONSE STATUS: 403
ERROR MESSAGE: Caller is not authorized to access the fp4p contract
DESCRIPTION: Customer is unable to post premium jobs after widget opt-in
RESOLUTION: Pay for performance contract customers need to enable toggle for posting of promoted jobs with a LinkedIn recommended budget using the [Job Posting API](overview?view=li-lts-2025-04) (Partner Integrations)
- HTTP CODE: 403
RESPONSE STATUS: 403
ERROR MESSAGE: Not enough permissions to access: POST (Name)
DESCRIPTION: Access token is generated from the application which does not have permission to access this resource
RESOLUTION: Use Partner application for creating child application, all other resources should be requested using child applications
```
----------------------------------------
TITLE: API Documentation for Dark UGC Posts
DESCRIPTION: This section provides conceptual API documentation for creating 'Dark UGC Posts'. These posts are designed for Ad Campaigns as Direct Sponsored Content (DSC) and do not appear as organic content on a LinkedIn company page. It outlines the specific author and visibility settings required for such posts and references further documentation for integration into ad campaigns.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/ugc-post-api
LANGUAGE: APIDOC
CODE:
```
Dark UGC Posts:
Purpose: Create content for Ad Campaigns (Direct Sponsored Content) without appearing organically on a company page.
Author: urn:li:organization:{id}
Visibility: visibility.com.linkedin.ugc.SponsoredContentVisibility = DARK
Usage: Requires additional steps for Ad Campaign integration. Refer to 'Direct Sponsored Content Overview' and 'Video Ads' documentation for details.
```
----------------------------------------
TITLE: Sample Request Body for Job Posting Creation/Update
DESCRIPTION: Illustrates the JSON structure for creating or updating a job posting, including detailed configuration for onsite application questions like voluntary self-identification, education, work experience, and custom questions with multiple-choice options. The 'questionText' field supports basic HTML formatting.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/talent/apply-connect/sync-jobs-onsite-apply
LANGUAGE: json
CODE:
```
{
"elements": [
{
"externalJobPostingId": "external-job-id-0001",
"title": "Test Job",
"description": "Lorem Ipsum is simply. . .",
"integrationContext": "urn:li:organization:1234",
"listedAt": 1558045934000,
"jobPostingOperationType":"CREATE",
"location": "Enterprise, UT",
"availability": "PUBLIC",
"industries": [
"urn:li:industry:3"
],
"categories": [
"advr"
],
"trackingPixelUrl": "http://localhost:5000/jobs/tracking",
"companyApplyUrl": "http://localhost:5000",
"posterEmail": "test@email.com",
"onsiteApplyConfiguration": {
"jobApplicationWebhookUrl": "https://customer-webhook.com/api/webhook",
"questions": {
"voluntarySelfIdentificationQuestions": {},
"educationQuestions": {
"educationExperienceQuestionSet": {}
},
"workQuestions": {
"workExperienceQuestionSet": {}
},
"additionalQuestions": {
"customQuestionSets": [
{
"repeatLimit": 1,
"questions": [
{
"required": true,
"partnerQuestionIdentifier": "question1",
"questionText": "Please choose the right answer",
"questionDetails": {
"multipleChoiceQuestionDetails": {
"choices": [
{
"symbolicName": "wrong",
"displayValue": "This is the wrong answer"
},
{
"symbolicName": "right",
"displayValue": "This is the correct answer"
},
{
"symbolicName": "right2",
"displayValue": "This is also the correct answer"
}
],
"selectMultiple": false,
"defaultValueSymbolicName": "right",
"preferredFormComponent": "DROPDOWN",
"favorableMultipleChoiceAnswer": {
"favorableSymbolicNames": [
"right",
"right2"
]
}
}
}
}
]
}
]
}
}
}
}
]
}
```
----------------------------------------
TITLE: Common UGC Post Creation Errors
DESCRIPTION: This section details common error codes and messages that may be encountered when attempting to create User Generated Content (UGC) Posts via the LinkedIn API. It provides insights into the cause of each error and potential solutions.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/ugc-post-api
LANGUAGE: APIDOC
CODE:
```
Error Codes for UGC Post Creation:
- Code: 400
Message: urn:li:developerApplication:{developer application ID} does not have permission to create ugc posts
Description: Your developer application is not allowlisted for video UGC Post creation. Restricted to approved applications.
- Code: 400
Message: Error parsing request body to json Unrecognized character escape
Description: Request payload contains incorrect character escaping (e.g., "It\'s a test"). Review and remove unnecessary escapes.
- Code: 400
Message: Post should only contain 1 set of targeting criteria
Description: The `targetedEntities` field has more than one targeting object. Refer to documentation for correct structure.
- Code: 400
Message: Target audience does not meet 300 follower minimum
Description: Targeted audience is too small; must have at least 300 members. See documentation for audience count calculation.
- Code: 401
Message: Member is unauthorized to create UserGeneratedContent
Description: Authenticated member lacks permission to create content on the specified company page.
- Code: 403
Message: Not enough permissions to access: POST {endpoint}
Description: Token lacks required permissions. Generate a new token with `w_organization_social` or `w_member_social` scope.
- Code: 409
Message: Write conflict due to an internal UGC error. Please retry the create operation.
Description: (No specific description provided in source, implies a transient conflict)
- Code: 422
Message: Content is a duplicate of {share or UGC URN}
Description: UGC Post is an exact duplicate of a recently created one. Wait 10 minutes or modify content.
- Code: 422
Message: Error validating the post
Description: Error in post (e.g., missing required field, field too long). Error message will provide details.
- Code: 429
Message: UGC action was blocked because a share limit has been reached
Description: Author has reached maximum daily share limit.
- Code: 429
Message: Resource level throttle {period} limit for calls to this resource is reached.
Description: Developer application has reached maximum call limit for this resource within the given time period.
```
----------------------------------------
TITLE: Create Dynamic Job Ad Creative via API
DESCRIPTION: Demonstrates how to create a new Dynamic Job Ad Creative by sending a POST request to the LinkedIn API. The request body includes content details for the job ad, campaign ID, and intended status. A successful response returns a 201 Created status and the creative ID.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/advertising-targeting/version/jobs-ads-integrations
LANGUAGE: HTTP
CODE:
```
POST https://api.linkedin.com/rest/creatives
```
LANGUAGE: JSON
CODE:
```
{
"content": {
"jobs": {
"organizationName": "Test Company Name",
"logo": "urn:li:image:C4E22AQExxAnf-VY49w",
"headline": {
"preApproved": "MEMBER_NEED_A_NEW_CHALLENGE_WE_CAN_HELP"
},
"buttonLabel": {
"preApproved": "CAREERS_AT_COMPANY"
},
"showMemberProfilePhoto": true
}
},
"campaign": "urn:li:sponsoredCampaign:190357284",
"intendedStatus": "ACTIVE"
}
```
LANGUAGE: curl
CODE:
```
curl --location --request POST 'https://api.linkedin.com/rest/creatives' \
-H 'Authorization: Bearer {INSERT_TOKEN}' \
-H 'LinkedIn-Version: {version number in the format YYYYMM}' \
-H 'Content-Type: application/json' \
-H 'X-Restli-Protocol-Version: 2.0.0'\
--data '{
"content": {
"jobs": {
"organizationName": "Test Company Name",
"logo": "urn:li:image:C4E22AQExxAnf-VY49w",
"headline": {
"preApproved": "MEMBER_NEED_A_NEW_CHALLENGE_WE_CAN_HELP"
},
"buttonLabel": {
"preApproved": "CAREERS_AT_COMPANY"
},
"showMemberProfilePhoto": true
}
},
"campaign": "urn:li:sponsoredCampaign:190357284",
"intendedStatus": "ACTIVE"
}'
```
----------------------------------------
TITLE: LinkedIn Simple Job Posting API Endpoint (v2)
DESCRIPTION: The v2 API endpoint for asynchronously submitting tasks to create, close, update, or renew one or more jobs on LinkedIn.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/talent/job-postings/api/create-jobs
LANGUAGE: APIDOC
CODE:
```
POST https://api.linkedin.com/v2/simpleJobPostings
```
----------------------------------------
TITLE: LinkedIn Posts API Reference
DESCRIPTION: This entry refers to the LinkedIn Posts API, which is used for managing user-generated content (UGC) posts. It provides a link to the official API documentation for detailed information on endpoints, request/response formats, and available operations related to creating, retrieving, updating, and deleting posts.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/multiimage-post-api
LANGUAGE: APIDOC
CODE:
```
Posts API: Reference documentation for managing LinkedIn User-Generated Content (UGC) posts. Provides details on endpoints, request/response formats, and operations for creating, retrieving, updating, and deleting posts. (Link: posts-api?view=li-lms-2025-06)
```
----------------------------------------
TITLE: JSON Sample Response for Successful Job Posting (Detailed)
DESCRIPTION: This JSON snippet provides a more detailed successful response body for a job posting request, including location, ID, entity details like externalJobPostingId, and status for each posted job task.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/talent/job-postings/api/create-jobs
LANGUAGE: JSON
CODE:
```
{
"elements": [
{
"location": "/simpleJobPostings/urn%3Ali%3AsimpleJobPostingTask%3A33349175-1da5-48b4-a3a6-abfd9248bdc6",
"id": "urn:li:simpleJobPostingTask:33349175-1da5-48b4-a3a6-abfd9248bdc6",
"entity": {
"externalJobPostingId": "Job1234"
},
"status": 202
},
{
"location": "/simpleJobPostings/urn%3Ali%3AsimpleJobPostingTask%3A2f46fde5-bccb-4750-ab9c-99e02359fb6b",
"id": "urn:li:simpleJobPostingTask:2f46fde5-bccb-4750-ab9c-99e02359fb6b",
"entity": {
"externalJobPostingId": "Job2345"
},
"status": 202
}
]
}
```
----------------------------------------
TITLE: API Error: SPONSORED_UPDATE_JOB_POSTING_NON_SHARING_CONTENT
DESCRIPTION: Signifies that a sponsored update job posting creative is attributed as non-shareable, which is not allowed.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/account-structure/create-and-manage-creatives
LANGUAGE: APIDOC
CODE:
```
SPONSORED_UPDATE_JOB_POSTING_NON_SHARING_CONTENT: 400 - Sponsored update job posting creative cannot be attributed as non-shareable
```
----------------------------------------
TITLE: Verify User Permission to Create Video Ad Dark Post
DESCRIPTION: This endpoint verifies if a user has the necessary permissions (rw_ads) to create a Video Ad Dark post for a given organizational entity. It returns a status indicating approval or denial.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/integrations/ads/account-structure/account-access-controls
LANGUAGE: HTTP
CODE:
```
GET https://api.linkedin.com/rest/organizationalEntityCreateShareAuthorizations/owner=urn:li:company:5590506&loggedInMember=urn:li:person:LBSWch4wcA&agent=urn:li:sponsoredAccount:517753843
```
LANGUAGE: curl
CODE:
```
curl -X GET 'https://api.linkedin.com/rest/organizationalEntityCreateShareAuthorizations/owner=urn:li:company:5590506&loggedInMember=urn:li:person:LBSWch4wcA&agent=urn:li:sponsoredAccount:517753843' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'Authorization: Bearer {INSERT_TOKEN}'\
-H 'Linkedin-Version: {version number in the format YYYYMM}'
```
LANGUAGE: JSON
CODE:
```
{
"status": {
"com.linkedin.sharingauth.Denied": {}
}
}
```
LANGUAGE: JSON
CODE:
```
{
"status": {
"com.linkedin.sharingauth.Approved": {}
}
}
```
----------------------------------------
TITLE: Create a Like on a LinkedIn Share, Post, or Comment
DESCRIPTION: This snippet illustrates how to create a 'like' action on a LinkedIn share, UGC post, or comment. It provides the HTTP endpoint, the JSON payload for the like, and a cURL command example. The 'object' field specifies the URN of the entity to be liked, and the 'actor' field specifies the URN of the entity performing the like.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/marketing/community-management/shares/network-update-social-actions
LANGUAGE: http
CODE:
```
POST https://api.linkedin.com/rest/socialActions/{shareUrn|ugcPostUrn|commentUrn}/likes
```
LANGUAGE: json
CODE:
```
{
"actor": "urn:li:person:0XV6h162Ub",
"object": "urn:li:share:6280442346811207680"
}
```
LANGUAGE: curl
CODE:
```
curl -X POST 'https://api.linkedin.com/rest/socialActions/{shareUrn|ugcPostUrn|commentUrn}/likes' \n-H 'Authorization: Bearer {INSERT_TOKEN}' \n-H 'LinkedIn-Version: {version number in the format YYYYMM}' \n-H 'Content-Type: application/json' \n-H 'X-Restli-Protocol-Version: 2.0.0'\n--data '{ "actor": "urn:li:person:0XV6h162Ub", "object": "urn:li:share:6280442346811207680" }'
```
----------------------------------------
TITLE: Create LinkedIn Job Posting Request Body
DESCRIPTION: JSON payload examples for creating new job postings on LinkedIn. These examples demonstrate the structure for various job types, including premium and internal-only jobs. Key fields include `externalJobPostingId`, `listingType`, `title`, `description`, `contract`, `company` or `integrationContext` for organization association, `companyApplyUrl`, `location`, `listedAt` (timestamp), and `jobPostingOperationType`. It also shows how to include `industries` and `posterEmail`. Note that `contract` information is mandatory for promoted jobs, and `availability: INTERNAL` is required for internal-only jobs. Requests should not include duplicate updates for the same `externalJobPostingId`.
SOURCE: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2/talent/job-postings/api/create-jobs
LANGUAGE: JSON
CODE:
```
{
"elements":[
{
"externalJobPostingId":"PremiumJobPostingG1TC1",
"listingType":"PREMIUM",
"title":"Premium Job Posting G1 TC1",
"description":"<b>Objective of the Position</b><br/> <ul> <li>To develop digital content plan, manage and monitor different content executions for social and online platforms to maximize the communication effectiveness and impact</li> <li>To manage, monitor and keep optimizing the performance of social platforms of MB and AMG</li> <li>To monitor and manage internet word of mouth to keep the health of brand and product image</li></ul>",
"contract":"urn:li:contract:{your_contract_id}",
"integrationContext":"urn:li:organization:{your_organization_id_01}",
"companyApplyUrl": "http://linkedin.com/jobpostingG1TC1",
"location":"San Francisco, CA",
"listedAt":1513756352000,
"jobPostingOperationType":"CREATE"
},
{
"externalJobPostingId":"PremiumJobPostingG1TC2",
"listingType":"PREMIUM",
"title":"Premium Job Posting G1 TC2",
"description":"<b>G1 TC2: Objective of the Position</b><br/> <ul> <li>To develop digital content plan, manage and monitor different content executions for social and online platforms to maximize the communication effectiveness and impact</li> <li>To manage, monitor and keep optimizing the performance of social platforms of MB and AMG</li> <li>To monitor and manage internet word of mouth to keep the health of brand and product image</li></ul>",
"contract":"urn:li:contract:{your_contract_id}",
"industries":["urn:li:industry:4", "urn:li:industry:99"],
"integrationContext":"urn:li:organization:{your_organization_id_02}",
"companyApplyUrl": "http://linkedin.com/jobpostingG1TC2",
"location":"San Francisco, CA",
"listedAt":1513756352000,
"jobPostingOperationType":"CREATE",
"posterEmail":"stub@your_poster_email_address"
}
]
}
```
LANGUAGE: JSON
CODE:
```
{
"elements":[
{
"externalJobPostingId":"PremiumJobPostingG1TC1",
"listingType":"PREMIUM",
"title":"Premium Job Posting G1 TC1",
"description":"<b>Objective of the Position</b><br/> <ul> <li>To develop digital content plan, manage and monitor different content executions for social and online platforms to maximize the communication effectiveness and impact</li> <li>To manage, monitor and keep optimizing the performance of social platforms of MB and AMG</li> <li>To monitor and manage internet word of mouth to keep the health of brand and product image</li></ul>",
"contract":"urn:li:contract:{your_contract_id}",
"company": "urn:li:company:{company_id}",
"companyApplyUrl": "http://linkedin.com/jobpostingG1TC1",
"location":"San Francisco, CA",
"listedAt":1513756352000,
"jobPostingOperationType":"CREATE"
},
{
"externalJobPostingId":"PremiumJobPostingG1TC2",
"listingType":"PREMIUM",
"title":"Premium Job Posting G1 TC2",
"description":"<b>G1 TC2: Objective of the Position</b><br/> <ul> <li>To develop digital content plan, manage and monitor different content executions for social and online platforms to maximize the communication effectiveness and impact</li> <li>To manage, monitor and keep optimizing the performance of social platforms of MB and AMG</li> <li>To monitor and manage internet word of mouth to keep the health of brand and product image</li></ul>",
"contract":"urn:li:contract:{your_contract_id}",
"industries":["urn:li:industry:4", "urn:li:industry:99"],
"company": "urn:li:company:{company_id}",
"companyApplyUrl": "http://linkedin.com/jobpostingG1TC2",
"location":"San Francisco, CA",
"listedAt":1513756352000,
"jobPostingOperationType":"CREATE",
"posterEmail":"stub@your_poster_email_address"
}
]
}
```