KosmoKrator

productivity

LinkedIn CLI for AI Agents

Use the LinkedIn CLI from KosmoKrator to call LinkedIn tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

LinkedIn CLI Setup

LinkedIn can be configured headlessly with `kosmokrator integrations:configure linkedin`.

Install, configure, and verify
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure linkedin --set access_token="$LINKEDIN_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor linkedin --json
kosmokrator integrations:status --json

Credentials

Authentication type: Manual OAuth token oauth2_manual_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
access_token LINKEDIN_ACCESS_TOKEN Secret secret yes Access Token
base_url LINKEDIN_BASE_URL URL url no API Base URL

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call linkedin.linkedin_list_posts '{"author":"example_author","count":1,"start":1}' --json
Provider shortcut
kosmo integrations:linkedin linkedin_list_posts '{"author":"example_author","count":1,"start":1}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs linkedin --json
kosmo integrations:docs linkedin.linkedin_list_posts --json
kosmo integrations:schema linkedin.linkedin_list_posts --json
kosmo integrations:search "LinkedIn" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

linkedin.linkedin_list_posts

List LinkedIn UGC posts for an author. Returns post IDs, lifecycle state, and creation timestamps. Use author, count, and start for filtering and pagination.

Read read
Parameters
author, count, start
Generic call
kosmo integrations:call linkedin.linkedin_list_posts '{"author":"example_author","count":1,"start":1}' --json
Shortcut
kosmo integrations:linkedin linkedin_list_posts '{"author":"example_author","count":1,"start":1}' --json

linkedin.linkedin_get_post

Retrieve a LinkedIn UGC post by its ID. Returns the full post including content, lifecycle state, and visibility.

Read read
Parameters
post_id
Generic call
kosmo integrations:call linkedin.linkedin_get_post '{"post_id":"example_post_id"}' --json
Shortcut
kosmo integrations:linkedin linkedin_get_post '{"post_id":"example_post_id"}' --json

linkedin.linkedin_create_post

Create a new LinkedIn UGC post. Requires an author URN and text content. Returns the created post with its ID and lifecycle state.

Write write
Parameters
author, text, visibility
Generic call
kosmo integrations:call linkedin.linkedin_create_post '{"author":"example_author","text":"example_text","visibility":"example_visibility"}' --json
Shortcut
kosmo integrations:linkedin linkedin_create_post '{"author":"example_author","text":"example_text","visibility":"example_visibility"}' --json

linkedin.linkedin_list_organizations

List LinkedIn organizations (company pages) the authenticated user has access to. Returns organization IDs, names, and roles.

Read read
Parameters
count, start
Generic call
kosmo integrations:call linkedin.linkedin_list_organizations '{"count":1,"start":1}' --json
Shortcut
kosmo integrations:linkedin linkedin_list_organizations '{"count":1,"start":1}' --json

linkedin.linkedin_get_organization

Retrieve a LinkedIn organization (company page) by its ID. Returns the organization's name, description, website, and other profile data.

Read read
Parameters
organization_id
Generic call
kosmo integrations:call linkedin.linkedin_get_organization '{"organization_id":"example_organization_id"}' --json
Shortcut
kosmo integrations:linkedin linkedin_get_organization '{"organization_id":"example_organization_id"}' --json

linkedin.linkedin_list_ad_accounts

List LinkedIn ad accounts the authenticated user has access to. Returns ad account IDs, names, statuses, and currency information.

Read read
Parameters
count, start
Generic call
kosmo integrations:call linkedin.linkedin_list_ad_accounts '{"count":1,"start":1}' --json
Shortcut
kosmo integrations:linkedin linkedin_list_ad_accounts '{"count":1,"start":1}' --json

linkedin.linkedin_get_current_user

Retrieve the currently authenticated LinkedIn user profile. Returns the user's ID, localized name, and profile metadata. Useful for identifying which account or token is in use.

Read read
Parameters
none
Generic call
kosmo integrations:call linkedin.linkedin_get_current_user '{}' --json
Shortcut
kosmo integrations:linkedin linkedin_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

linkedin.linkedin_list_posts 3 parameters
Schema command
kosmo integrations:schema linkedin.linkedin_list_posts --json
ParameterTypeRequiredDescription
author string yes Author URN (e.g. "urn:li:person:ABC123" or "urn:li:organization:12345").
count integer no Maximum number of posts to return (default 10, max 100).
start integer no Pagination offset (0-based).
linkedin.linkedin_get_post 1 parameters
Schema command
kosmo integrations:schema linkedin.linkedin_get_post --json
ParameterTypeRequiredDescription
post_id string yes LinkedIn UGC post URN or ID (e.g. "urn:li:ugcPost:123456789").
linkedin.linkedin_create_post 3 parameters
Schema command
kosmo integrations:schema linkedin.linkedin_create_post --json
ParameterTypeRequiredDescription
author string yes Author URN (e.g. "urn:li:person:ABC123" or "urn:li:organization:12345").
text string yes Text content for the post.
visibility string no Visibility: "PUBLIC" (default) or "CONNECTIONS".
linkedin.linkedin_list_organizations 2 parameters
Schema command
kosmo integrations:schema linkedin.linkedin_list_organizations --json
ParameterTypeRequiredDescription
count integer no Maximum number of organizations to return (default 10).
start integer no Pagination offset (0-based).
linkedin.linkedin_get_organization 1 parameters
Schema command
kosmo integrations:schema linkedin.linkedin_get_organization --json
ParameterTypeRequiredDescription
organization_id string yes LinkedIn organization ID or URN (e.g. "12345" or "urn:li:organization:12345").
linkedin.linkedin_list_ad_accounts 2 parameters
Schema command
kosmo integrations:schema linkedin.linkedin_list_ad_accounts --json
ParameterTypeRequiredDescription
count integer no Maximum number of ad accounts to return (default 10).
start integer no Pagination offset (0-based).
linkedin.linkedin_get_current_user 0 parameters
Schema command
kosmo integrations:schema linkedin.linkedin_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.