Command line (CLI)

Last updated: 2026-11-08

Call the API from your terminal, no code. One small Node script (zero dependencies, Node 16+) that uses your normal API key: same credits, same rate limit, same errors as any other client.

Install

Single file, no package manager. Download the script and run it with Node.

# download curl -O https://sociallens.dev/cli/sociallens.js # optional: make it a command chmod +x sociallens.js && sudo mv sociallens.js /usr/local/bin/sociallens # or just run it in place node sociallens.js --help

Set your key

Saved in ~/.sociallens/config.json (file mode 600). The env var SOCIALLENS_API_KEY wins over the saved key, handy for CI. Get a free key in API Keys.

sociallens config set-key sk_live_YOUR_KEY sociallens ping ok key is valid (user 42). Free check, no credit used.

Commands

sociallens profile <platform> <username>Public profile as JSON. 1 credit per 200. Platform: tiktok, instagram, youtube, facebook, x, reddit, linkedin, threads, pinterest. The @ is optional.
sociallens pingChecks the key. Free.
sociallens config set-key <key>Saves the key locally.
sociallens config showWhere the key comes from (env or file), masked.
sociallens config unset-keyRemoves the saved key.
--rawCompact JSON on one line, for piping into jq.
--field <name>Prints one field only, e.g. --field followers or --field credits.balance.
--help, --versionHelp and version.

Examples

sociallens profile tiktok @tiktok { "username": "tiktok", "platform": "tiktok", "nickname": "TikTok", "verified": true, "private": false, "followers": 96700000, ... } charged 1 credit, 98 credits left sociallens profile tiktok tiktok --field followers 96700000 sociallens profile tiktok tiktok --raw | jq .credits SOCIALLENS_API_KEY=wrong sociallens ping Error: invalid API key (invalid_token). No credit was charged.

Errors

Every error is one readable line plus a hint, never a stack trace, and exits with code 1 so scripts can detect it. Only a successful read (200) costs 1 credit; every error costs 0. Codes: bad request (400), invalid key (401), no credits (402), e-mail not verified (403), account busy (409), rate limited (429, with Retry-After), platform not live (501), source unavailable (503, with Retry-After). There is no refund, because nothing is charged before the read succeeds.

Source

The CLI is a single file: sociallens.js. Read it before you run it; it only talks to api.sociallens.dev and writes the config file above. Questions: contact.

SocialLens is operated by APEX DIGITAL TECNOLOGIA DA INFORMACAO LTDA (trade name APEX MIDIA), CNPJ 66.250.452/0001-30, R. Pais Leme, 215, Pinheiros, Sao Paulo/SP, Brazil. Contact: support@sociallens.dev.