AI-agent-friendly CLI for LinkedIn automation via Linked API.
Give your AI agent full LinkedIn capabilities: send messages, fetch profiles, search people and companies, manage connections, create posts, react, comment – all through simple CLI commands with structured JSON output. Built for OpenClaw, Claude Code, Cursor, Codex, and any AI agent that can execute shell commands.
Under the hood, Linked API runs a dedicated cloud browser instance for each connected LinkedIn account. When your agent runs a command, the CLI sends the request to Linked API's infrastructure, where an isolated browser with a residential IP performs the action on LinkedIn – simulating human-like mouse movements, keyboard input, and natural browsing patterns. No local browsers, no proxies, no Selenium, no infrastructure to manage. Learn more about safety.
npm install -g @linkedapi/linkedin-cli# 1. Save your tokens (get them at app.linkedapi.io)
linkedin setup
# 2. Fetch a profile
linkedin person fetch https://www.linkedin.com/in/vprudnikoff --json
# 3. Search for people
linkedin person search --term "revops engineer" --current-companies "Linked API" --json
# 4. Send a message
linkedin message send https://www.linkedin.com/in/vprudnikoff "Hey, loved your latest post!"linkedin setupThe CLI will ask for your Linked API Token and Identification Token. Get them at app.linkedapi.io.
For non-interactive environments (CI, scripts):
linkedin setup --linked-api-token=xxx --identification-token=yyy| Flag | Description |
|---|---|
--linked-api-token |
Linked API Token (skips prompt) |
--identification-token |
Identification Token (skips prompt) |
Run linkedin setup again with different tokens to add more accounts. The last added account becomes active.
# List all accounts (* marks active)
linkedin account list
# Switch active account
linkedin account switch "Vlad"
# Rename a saved account
linkedin account rename "Vlad" --name "My Work Account"
# Use a specific account for one command
linkedin person fetch https://www.linkedin.com/in/... --account "Vlad"
# Remove active account (auto-switches to next)
linkedin reset
# Remove all accounts
linkedin reset --allEvery command supports these flags:
| Flag | Description |
|---|---|
--json |
Structured JSON output to stdout |
--fields name,url,... |
Select specific fields in output |
--quiet / -q |
Suppress stderr progress |
--no-color |
Disable colors |
--account "Name" |
Use a specific account for this command |
Fetch a LinkedIn person profile with optional additional data sections.
linkedin person fetch <url> [flags]| Arg | Required | Description |
|---|---|---|
url |
yes | LinkedIn profile URL |
| Flag | Type | Description |
|---|---|---|
--experience |
boolean | Include work experience |
--education |
boolean | Include education history |
--skills |
boolean | Include skills |
--languages |
boolean | Include languages |
--posts |
boolean | Include recent posts |
--comments |
boolean | Include recent comments |
--reactions |
boolean | Include recent reactions |
--posts-limit |
integer | Max posts to retrieve (requires --posts) |
--posts-since |
string | Posts since ISO timestamp (requires --posts) |
--comments-limit |
integer | Max comments to retrieve (requires --comments) |
--comments-since |
string | Comments since ISO timestamp (requires --comments) |
--reactions-limit |
integer | Max reactions to retrieve (requires --reactions) |
--reactions-since |
string | Reactions since ISO timestamp (requires --reactions) |
# Basic profile info
linkedin person fetch https://www.linkedin.com/in/vprudnikoff
# Full profile with experience and education
linkedin person fetch https://www.linkedin.com/in/vprudnikoff --experience --education --json
# Profile with recent posts (last 5)
linkedin person fetch https://www.linkedin.com/in/vprudnikoff --posts --posts-limit 5
# Everything
linkedin person fetch https://www.linkedin.com/in/vprudnikoff \
--experience --education --skills --languages \
--posts --comments --reactions --jsonSearch for people on LinkedIn with filters.
linkedin person search [flags]| Flag | Type | Description |
|---|---|---|
--term |
string | Search keyword or phrase |
--limit |
integer | Max results to return |
--first-name |
string | Filter by first name |
--last-name |
string | Filter by last name |
--position |
string | Filter by job position |
--locations |
string | Comma-separated locations |
--industries |
string | Comma-separated industries |
--current-companies |
string | Comma-separated current company names |
--previous-companies |
string | Comma-separated previous company names |
--schools |
string | Comma-separated school names |
linkedin person search --term "revops engineer" --locations "San Francisco"
linkedin person search --current-companies "Linked API" --position "Engineer" --json
linkedin person search --schools "MIT" --industries "Software Development" --limit 20 --jsonFetch a LinkedIn company profile with optional employees, decision makers, and posts.
linkedin company fetch <url> [flags]| Arg | Required | Description |
|---|---|---|
url |
yes | LinkedIn company URL |
| Flag | Type | Description |
|---|---|---|
--employees |
boolean | Include employee data |
--dms |
boolean | Include decision makers |
--posts |
boolean | Include company posts |
--employees-limit |
integer | Max employees to retrieve (requires --employees) |
--employees-first-name |
string | Filter employees by first name (requires --employees) |
--employees-last-name |
string | Filter employees by last name (requires --employees) |
--employees-position |
string | Filter employees by position (requires --employees) |
--employees-locations |
string | Filter employees by locations, comma-separated (requires --employees) |
--employees-industries |
string | Filter employees by industries, comma-separated (requires --employees) |
--employees-schools |
string | Filter employees by schools, comma-separated (requires --employees) |
--dms-limit |
integer | Max decision makers to retrieve (requires --dms) |
--posts-limit |
integer | Max posts to retrieve (requires --posts) |
--posts-since |
string | Posts since ISO timestamp (requires --posts) |
# Basic company info
linkedin company fetch https://www.linkedin.com/company/flutterwtf
# Company with employees and decision makers
linkedin company fetch https://www.linkedin.com/company/flutterwtf --employees --dms --json
# Filter employees by position and location
linkedin company fetch https://www.linkedin.com/company/flutterwtf \
--employees --employees-position "Engineer" --employees-locations "United States"
# Company posts from last month
linkedin company fetch https://www.linkedin.com/company/flutterwtf \
--posts --posts-since 2024-12-01T00:00:00Z --jsonSearch for companies on LinkedIn with filters.
linkedin company search [flags]| Flag | Type | Description |
|---|---|---|
--term |
string | Search keyword or phrase |
--limit |
integer | Max results to return |
--sizes |
string | Company sizes, comma-separated (1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10001+) |
--locations |
string | Comma-separated locations |
--industries |
string | Comma-separated industries |
linkedin company search --term "fintech" --sizes "11-50,51-200" --json
linkedin company search --industries "Software Development" --locations "Berlin" --jsonSend a message to a LinkedIn connection.
linkedin message send <person-url> <text>| Arg | Required | Description |
|---|---|---|
person-url |
yes | LinkedIn profile URL of the recipient |
text |
yes | Message text (up to 1900 characters) |
linkedin message send https://www.linkedin.com/in/vprudnikoff "Hey, loved your latest post!"Get conversation messages with a LinkedIn person.
linkedin message get <person-url> [flags]| Arg | Required | Description |
|---|---|---|
person-url |
yes | LinkedIn profile URL |
| Flag | Type | Description |
|---|---|---|
--since |
string | Only retrieve messages since this ISO timestamp |
linkedin message get https://www.linkedin.com/in/vprudnikoff --json
linkedin message get https://www.linkedin.com/in/vprudnikoff --since 2024-01-15T10:30:00ZNote: The first call for a conversation triggers a background sync, which may take longer. Subsequent calls use cached data and are faster.
Check connection status with a LinkedIn person.
linkedin connection status <url>| Arg | Required | Description |
|---|---|---|
url |
yes | LinkedIn profile URL |
linkedin connection status https://www.linkedin.com/in/vprudnikoffSend a connection request.
linkedin connection send <url> [flags]| Arg | Required | Description |
|---|---|---|
url |
yes | LinkedIn profile URL |
| Flag | Type | Description |
|---|---|---|
--note |
string | Personalized note to include with the request |
--email |
string | Email address (required by some profiles to connect) |
linkedin connection send https://www.linkedin.com/in/vprudnikoff
linkedin connection send https://www.linkedin.com/in/vprudnikoff --note "Love to connect!"
linkedin connection send https://www.linkedin.com/in/vprudnikoff --email vlad@example.comList your LinkedIn connections with optional filters.
linkedin connection list [flags]| Flag | Type | Description |
|---|---|---|
--limit |
integer | Max connections to return |
--since |
string | Only connections made since this ISO timestamp |
--first-name |
string | Filter by first name |
--last-name |
string | Filter by last name |
--position |
string | Filter by job position |
--locations |
string | Comma-separated locations |
--industries |
string | Comma-separated industries |
--current-companies |
string | Comma-separated current company names |
--previous-companies |
string | Comma-separated previous company names |
--schools |
string | Comma-separated school names |
Note:
--sinceonly works when no filter flags are used.
linkedin connection list --limit 50 --json
linkedin connection list --current-companies "Linked API" --position "Engineer" --json
linkedin connection list --since 2024-01-01T00:00:00Z --jsonList pending outgoing connection requests.
linkedin connection pendinglinkedin connection pending --jsonWithdraw a pending connection request.
linkedin connection withdraw <url> [flags]| Arg | Required | Description |
|---|---|---|
url |
yes | LinkedIn profile URL |
| Flag | Type | Default | Description |
|---|---|---|---|
--unfollow / --no-unfollow |
boolean | true |
Also unfollow the person |
linkedin connection withdraw https://www.linkedin.com/in/vprudnikoff
linkedin connection withdraw https://www.linkedin.com/in/vprudnikoff --no-unfollowRemove an existing connection.
linkedin connection remove <url>| Arg | Required | Description |
|---|---|---|
url |
yes | LinkedIn profile URL |
linkedin connection remove https://www.linkedin.com/in/vprudnikoffFetch a LinkedIn post with optional comments and reactions.
linkedin post fetch <url> [flags]| Arg | Required | Description |
|---|---|---|
url |
yes | LinkedIn post URL |
| Flag | Type | Description |
|---|---|---|
--comments |
boolean | Include comments |
--reactions |
boolean | Include reactions |
--comments-limit |
integer | Max comments to retrieve (requires --comments) |
--comments-sort |
string | Sort order: mostRelevant or mostRecent (requires --comments) |
--comments-replies |
boolean | Include replies to comments (requires --comments) |
--reactions-limit |
integer | Max reactions to retrieve (requires --reactions) |
linkedin post fetch https://www.linkedin.com/posts/vprudnikoff_activity-123
# With comments sorted by most recent, including replies
linkedin post fetch https://www.linkedin.com/posts/vprudnikoff_activity-123 \
--comments --comments-sort mostRecent --comments-replies --json
# With reactions
linkedin post fetch https://www.linkedin.com/posts/vprudnikoff_activity-123 \
--comments --reactions --jsonCreate a LinkedIn post with optional media attachments.
linkedin post create <text> [flags]| Arg | Required | Description |
|---|---|---|
text |
yes | Post text (up to 3000 characters) |
| Flag | Type | Description |
|---|---|---|
--company-url |
string | Post on behalf of a company page (requires admin access) |
--attachments |
string | Attachments 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!"
# With an image
linkedin post create "Check this out" \
--attachments "https://example.com/photo.jpg:image"
# With a document
linkedin post create "Our Q4 report" \
--attachments "https://example.com/report.pdf:document:Q4 Report"
# Post as a company
linkedin post create "Company announcement" \
--company-url https://www.linkedin.com/company/flutterwtfReact to a LinkedIn post.
linkedin post react <url> --type <reaction> [flags]| Arg | Required | Description |
|---|---|---|
url |
yes | LinkedIn post URL |
| Flag | Type | Required | Description |
|---|---|---|---|
--type |
string | yes | Reaction type: like, love, support, celebrate, insightful, funny |
--company-url |
string | no | React on behalf of a company page |
linkedin post react https://www.linkedin.com/posts/vprudnikoff_activity-123 --type like
linkedin post react https://www.linkedin.com/posts/vprudnikoff_activity-123 --type celebrate \
--company-url https://www.linkedin.com/company/flutterwtfComment on a LinkedIn post.
linkedin post comment <url> <text> [flags]| Arg | Required | Description |
|---|---|---|
url |
yes | LinkedIn post URL |
text |
yes | Comment text (up to 1000 characters) |
| Flag | Type | Description |
|---|---|---|
--company-url |
string | Comment on behalf of a company page |
linkedin post comment https://www.linkedin.com/posts/vprudnikoff_activity-123 "Great insights!"
linkedin post comment https://www.linkedin.com/posts/vprudnikoff_activity-123 "Well said!" \
--company-url https://www.linkedin.com/company/flutterwtfRetrieve your LinkedIn Social Selling Index.
linkedin stats ssi [flags]linkedin stats ssi --jsonRetrieve your LinkedIn performance analytics (profile views, post impressions, search appearances).
linkedin stats performance [flags]linkedin stats performance --jsonRetrieve Linked API usage statistics for a date range.
linkedin stats usage --start <timestamp> --end <timestamp> [flags]| Flag | Type | Required | Description |
|---|---|---|---|
--start |
string | yes | Start date in ISO timestamp |
--end |
string | yes | End date in ISO timestamp |
linkedin stats usage --start 2024-01-01T00:00:00Z --end 2024-01-31T00:00:00Z --jsonRequires a LinkedIn Sales Navigator subscription.
Fetch a person profile via Sales Navigator.
linkedin navigator person fetch <hashed-url>| Arg | Required | Description |
|---|---|---|
hashed-url |
yes | Hashed LinkedIn profile URL |
linkedin navigator person fetch https://www.linkedin.com/in/ACwAAA...Search for people via Sales Navigator with advanced filters.
linkedin navigator person search [flags]| Flag | Type | Description |
|---|---|---|
--term |
string | Search keyword or phrase |
--limit |
integer | Max results to return |
--first-name |
string | Filter by first name |
--last-name |
string | Filter by last name |
--position |
string | Filter by job position |
--locations |
string | Comma-separated locations |
--industries |
string | Comma-separated industries |
--current-companies |
string | Comma-separated current company names |
--previous-companies |
string | Comma-separated previous company names |
--schools |
string | Comma-separated school names |
--years-of-experience |
string | Comma-separated experience ranges: lessThanOne, oneToTwo, threeToFive, sixToTen, moreThanTen |
linkedin navigator person search --term "VP Marketing" --locations "United States"
linkedin navigator person search --years-of-experience "moreThanTen" --position "CEO" --jsonFetch a company profile via Sales Navigator with optional employees and decision makers.
linkedin navigator company fetch <hashed-url> [flags]| Arg | Required | Description |
|---|---|---|
hashed-url |
yes | Hashed LinkedIn company URL |
| Flag | Type | Description |
|---|---|---|
--employees |
boolean | Include employee data |
--dms |
boolean | Include decision makers |
--employees-limit |
integer | Max employees to retrieve (requires --employees) |
--employees-first-name |
string | Filter employees by first name (requires --employees) |
--employees-last-name |
string | Filter employees by last name (requires --employees) |
--employees-positions |
string | Filter employees by positions, comma-separated (requires --employees) |
--employees-locations |
string | Filter employees by locations, comma-separated (requires --employees) |
--employees-industries |
string | Filter employees by industries, comma-separated (requires --employees) |
--employees-schools |
string | Filter employees by schools, comma-separated (requires --employees) |
--employees-years-of-experience |
string | Filter employees by experience ranges, comma-separated (requires --employees) |
--dms-limit |
integer | Max decision makers to retrieve (requires --dms) |
linkedin navigator company fetch https://www.linkedin.com/sales/company/97ural --employees --dms
linkedin navigator company fetch https://www.linkedin.com/sales/company/97ural \
--employees --employees-positions "Engineer,Designer" --employees-locations "Europe"Search for companies via Sales Navigator with advanced filters including revenue.
linkedin navigator company search [flags]| Flag | Type | Description |
|---|---|---|
--term |
string | Search keyword or phrase |
--limit |
integer | Max results to return |
--sizes |
string | Company sizes, comma-separated (1-10, 11-50, 51-200, 201-500, 501-1000, 1001-5000, 5001-10000, 10001+) |
--locations |
string | Comma-separated locations |
--industries |
string | Comma-separated industries |
--revenue-min |
string | Min annual revenue in M USD: 0, 0.5, 1, 2.5, 5, 10, 20, 50, 100, 500, 1000 |
--revenue-max |
string | Max annual revenue in M USD: 0.5, 1, 2.5, 5, 10, 20, 50, 100, 500, 1000, 1000+ |
linkedin navigator company search --term "fintech" --sizes "11-50,51-200"
linkedin navigator company search --revenue-min 10 --revenue-max 100 --locations "United States" --jsonSend a message via Sales Navigator (InMail).
linkedin navigator message send <person-url> <text> --subject <subject>| Arg | Required | Description |
|---|---|---|
person-url |
yes | LinkedIn profile URL of the recipient |
text |
yes | Message text (up to 1900 characters) |
| Flag | Type | Required | Description |
|---|---|---|---|
--subject |
string | yes | Message subject line (up to 80 characters) |
linkedin navigator message send https://www.linkedin.com/in/vprudnikoff "Would love to chat about API integrations" --subject "Partnership Opportunity"Get Sales Navigator conversation messages.
linkedin navigator message get <person-url> [flags]| Arg | Required | Description |
|---|---|---|
person-url |
yes | LinkedIn profile URL |
| Flag | Type | Description |
|---|---|---|
--since |
string | Only retrieve messages since this ISO timestamp |
linkedin navigator message get https://www.linkedin.com/in/vprudnikoff
linkedin navigator message get https://www.linkedin.com/in/vprudnikoff --since 2024-01-15T10:30:00ZExecute a custom workflow definition. Accepts JSON from a file or stdin.
linkedin workflow run [flags]| Flag | Type | Description |
|---|---|---|
-f / --file |
string | Path to workflow JSON file |
# From file
linkedin workflow run --file workflow.json
# From stdin
cat workflow.json | linkedin workflow run
# Inline
echo '{"actions":[...]}' | linkedin workflow runSee Building Workflows for the workflow JSON schema.
Check status of a running workflow or wait for its completion.
linkedin workflow status <id> [flags]| Arg | Required | Description |
|---|---|---|
id |
yes | Workflow ID |
| Flag | Type | Description |
|---|---|---|
--wait |
boolean | Block until the workflow completes |
# Check current status
linkedin workflow status abc123
# Wait for completion
linkedin workflow status abc123 --wait --jsonList all configured LinkedIn accounts.
linkedin account listThe active account is marked with *.
Switch the active LinkedIn account.
linkedin account switch <name>| Arg | Required | Description |
|---|---|---|
name |
yes | Account name (case-insensitive substring match) |
linkedin account switch "Vlad"Rename a saved LinkedIn account.
linkedin account rename <name> --name <new-name>| Arg | Required | Description |
|---|---|---|
name |
yes | Current account name (case-insensitive substring match) |
| Flag | Type | Required | Description |
|---|---|---|---|
--name |
string | yes | New name for the account |
linkedin account rename "Vlad" --name "My Work Account"Remove stored accounts and tokens.
linkedin reset [flags]| Flag | Type | Description |
|---|---|---|
--all |
boolean | Remove all accounts (default: removes only active account) |
# Remove active account (auto-switches to next)
linkedin reset
# Remove all accounts
linkedin reset --all{"success": true, "data": {"name": "Vlad Prudnikov", "headline": "CEO at Linked API"}}{"success": false, "error": {"type": "personNotFound", "message": "Person not found"}}Key-value pairs for objects, tables for arrays.
| Code | Meaning |
|---|---|
| 0 | Success (check success field – action may have returned an error like "person not found") |
| 1 | General/unexpected error |
| 2 | Missing or invalid tokens |
| 3 | Subscription/plan required |
| 4 | LinkedIn account issue |
| 5 | Invalid arguments |
| 6 | Rate limited |
| 7 | Network error |
| 8 | Workflow timeout (workflowId returned for recovery) |
- Sequential execution. Linked API executes all workflows sequentially per account. You can send multiple requests, but they queue and run one at a time. This mirrors natural LinkedIn user behavior.
- Not instant. Simple operations (fetch a profile) take ~10-20 seconds. Complex operations (search with filters) can take longer. This is because a real cloud browser navigates LinkedIn on your behalf.
- Timestamps in UTC. All dates and times returned by the API are in UTC.
- 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
nullor[], not omitted. - Action limits. Configurable per-account action limits on the platform prevent LinkedIn policy violations. When a limit is reached, you get a
limitExceedederror.
See Core Concepts for more details.
This CLI is designed for AI agent consumption:
--jsonflag gives structured output parseable withjq- Non-TTY stdout auto-switches to JSON
--quietsuppresses all stderr noise--fieldsreduces output to only needed data- Exit code 0 always means "API call succeeded" – parse
successfield for action outcome - Non-zero exits = infrastructure errors (auth, network, etc.)
Example agent usage:
# Set up authentication
linkedin setup --linked-api-token=xxx --identification-token=yyy
# Fetch just name and headline
linkedin person fetch https://www.linkedin.com/in/vprudnikoff --json --fields name,headline -q
# Pipe to jq
linkedin person search --term "revops engineer" --json -q | jq '.data[].name'This project is maintained by Linked API. The name "linkedin-cli" refers to the platform this tool is designed to work with, not to any affiliation or ownership.
Linked API is not affiliated, associated, authorized, endorsed by, or in any way officially connected with LinkedIn Corporation. "LinkedIn" is a registered trademark of LinkedIn Corporation.
This project is licensed under the MIT – see the LICENSE file for details.