Use this skill when you need to automate LinkedIn tasks such as profile fetching, connection management, or post creation via CLI, especially when integrated into automated workflows.
LinkedIn Skill
You have access to linkedin – a CLI tool for LinkedIn automation. Use it to fetch profiles, search people and companies, send messages, manage connections, create posts, react, comment, and more.
Each command sends a request to Linked API, which runs a real cloud browser to perform the action on LinkedIn. Operations are not instant – expect 30 seconds to several minutes depending on complexity.
If linkedin is not available, install it:
npm install -g @linkedapi/linkedin-cli
Authentication
If a command fails with exit code 2 (authentication error), ask the user to set up their account:
Use this skill when you need to orchestrate LinkedIn actions from scripts or an AI agent instead of clicking through the web UI:
Building outreach, research, or recruiting workflows that rely on LinkedIn data and messaging.
Enriching leads or accounts by fetching people and company profiles in bulk.
Coordinating multi-step Sales Navigator or workflow runs where JSON output and exit codes are required.
Always respect LinkedIn’s terms of service, local regulations, and your organisation’s compliance policies when using automation against real accounts.
Global Flags
Always use --json and -q for machine-readable output:
# Basic company info
linkedin company fetch https://www.linkedin.com/company/name --json -q
# With employees filtered by position
linkedin company fetch https://www.linkedin.com/company/name --employees --employees-position "Engineer" --json -q
# With decision makers and posts
linkedin company fetch https://www.linkedin.com/company/name --dms --posts --posts-limit 10 --json -q
By default, withdrawing also unfollows the person. Use --no-unfollow to keep following.
Remove a connection
linkedin connection remove <url> --json -q
Posts
Fetch a post
linkedin post fetch <url> [flags] --json -q
Flag
Description
--comments
Include comments
--reactions
Include reactions
--comments-limit
Max comments to retrieve (requires --comments)
--comments-sort
Sort order: mostRelevant or mostRecent (requires --comments)
--comments-replies
Include replies to comments (requires --comments)
--reactions-limit
Max reactions to retrieve (requires --reactions)
linkedin post fetch https://www.linkedin.com/posts/username_activity-123 --json -q
# With comments sorted by most recent, including replies
linkedin post fetch https://www.linkedin.com/posts/username_activity-123 \
--comments --comments-sort mostRecent --comments-replies --json -q
Create a post
linkedin post create '<text>' [flags] --json -q
Flag
Description
--company-url
Post on behalf of a company page (requires admin access)
--attachments
Attachment as url:type or url:type:name. Types: image, video, document. Can be specified multiple times.
Attachment limits: up to 9 images, or 1 video, or 1 document. Cannot mix types.
linkedin post create 'Excited to share our latest update!' --json -q
# With a document
linkedin post create 'Our Q4 report' \
--attachments "https://example.com/report.pdf:document:Q4 Report" --json -q
# Post as a company
linkedin post create 'Company announcement' \
--company-url https://www.linkedin.com/company/name --json -q
React to a post
linkedin post react <url> --type <reaction> [--company-url <url>] --json -q
linkedin post react https://www.linkedin.com/posts/username_activity-123 --type like --json -q
# React on behalf of a company
linkedin post react https://www.linkedin.com/posts/username_activity-123 --type celebrate \
--company-url https://www.linkedin.com/company/name --json -q
Comment on a post
linkedin post comment <url> '<text>' [--company-url <url>] --json -q
Text up to 1000 characters.
linkedin post comment https://www.linkedin.com/posts/username_activity-123 'Great insights!' --json -q
# Comment on behalf of a company
linkedin post comment https://www.linkedin.com/posts/username_activity-123 'Well said!' \
--company-url https://www.linkedin.com/company/name --json -q
Statistics
# Social Selling Index
linkedin stats ssi --json -q
# Performance analytics (profile views, post impressions, search appearances)
linkedin stats performance --json -q
# API usage for a date range
linkedin stats usage --start 2024-01-01T00:00:00Z --end 2024-01-31T00:00:00Z --json -q
Sales Navigator
Requires a LinkedIn Sales Navigator subscription. Uses hashed URLs for person/company lookups.
Fetch person
linkedin navigator person fetch <hashed-url> --json -q
Search people
linkedin navigator person search [flags] --json -q
Text up to 1900 characters. Subject up to 80 characters.
linkedin navigator message send https://www.linkedin.com/in/username \
'Would love to chat about API integrations' --subject 'Partnership Opportunity' --json -q
Get Sales Navigator conversation
linkedin navigator message get <person-url> [--since TIMESTAMP] --json -q
Custom Workflows
Execute a custom workflow definition from a file, stdin, or inline:
# From file
linkedin workflow run --file workflow.json --json -q
# From stdincat workflow.json | linkedin workflow run --json -q
# Inlineecho'{"actions":[...]}' | linkedin workflow run --json -q
Check workflow status or wait for completion:
linkedin workflow status <id> --json -q
linkedin workflow status <id> --wait --json -q
linkedin account list # List accounts (* = active)
linkedin account switch "Name"# Switch active account
linkedin account rename "Name" --name "New Name"# Rename account
linkedin reset # Remove active account
linkedin reset --all # Remove all accounts
Important Behavior
Sequential execution. All operations for an account run one at a time. Multiple requests queue up.
Not instant. A real browser navigates LinkedIn – expect 30 seconds to several minutes per operation.
Timestamps in UTC. All dates and times are in UTC.
Single quotes for text arguments. Use single quotes around message text, post text, and comments to avoid shell interpretation issues with special characters.
Action limits. Per-account limits are configurable on the platform. A limitExceeded error means the limit was reached.
URL normalization. All LinkedIn URLs in responses are normalized to https://www.linkedin.com/... format without trailing slashes.
Null fields. Fields that are unavailable are returned as null or [], not omitted.