Agents and accounts

CLI

Call any endpoint from a shell, run batches from a file, download files and set up your coding agents.

On this page
  1. Which to use: MCP, CLI or SDK
  2. Sign in
  3. Call an endpoint
  4. Choose the output
  5. Walk a list
  6. Run a batch from a file
  7. Keep only what's new
  8. Download videos and photos
  9. Jobs, webhooks and local testing
  10. Connect your coding agents
  11. Agent mode
  12. Errors
  13. Commands
  14. Global flags
  15. Batch, archive and file flags
  16. Exit codes

The CLI calls every endpoint from a shell: one command per endpoint, a table or JSON out, batches from a file and exit codes a script can branch on. It needs Node.js. Install it once, sign in, then call an endpoint:

Shell
npm install -g socialtap   # once; or run each with npx
socialtap login
socialtap tiktok profile nasa

login opens your browser, and the key it saves is readable only by you. search finds the endpoint for a need or a link, and describe states any endpoint's params, price and output as JSON. Neither needs a key.

Which to use: MCP, CLI or SDK

WhenUseWhy
An agent gets data for you in a chat or a coding sessionThe MCP serverTools the agent calls with no code to write. It signs in with your browser, and the tools find the endpoint for a need or a link.
A shell: a one-off lookup, a file of links, a script or cron, an agent that runs commandsThe CLI (npx socialtap)One command per endpoint, a table or JSON out, batches from a file that resume, exit codes a script can branch on.
Code you ship: an app, a pipeline, a scheduled jobThe TypeScript SDKTyped methods for every endpoint, with retries and pagination, and the API key from your environment.

Sign in

  • login signs you in with your browser and saves a key for this computer. whoami shows the account, the balance and where the key comes from.
  • The key comes from --api-key, then SOCIALTAP_API_KEY, then the saved one. Pass --api-key - to read it from stdin.
  • An agent without a browser runs login --non-interactive: it prints a link and a code as JSON. The agent shows them to you, then runs login --complete, which waits for your approval and saves the key.
  • --profile <name> keeps a second key and origin beside the first, for another account or a staging deployment.

Call an endpoint

The command is the platform and the endpoint, then the link, handle or query the endpoint takes. Every other param is a flag, in kebab-case or snake_case. socialtap <platform> lists a platform's endpoints, and socialtap <platform> <endpoint> --help lists its params, its price and an example.

Shell
socialtap tiktok profile nasa --max-age 3600
socialtap tiktok profile nasa --dry-run
socialtap tiktok profile nasa --jq .data

--max-age accepts a stored answer up to that many seconds old, free. --dry-run prints the request and its price and sends nothing. A failed request is free, and --max-credits caps what a call may cost: one that would cost more stops first, free.

Choose the output

At a terminal you get a table, or one item's fields, with what the call cost. Piped, or run by a coding agent, you get compact JSON. --format json|jsonl|table|csv|md picks one, and -o <file> writes it to a file (the format from its extension). The CLI never replaces a file without --force, and checks that before it sends anything.

--jq <expr> filters the JSON without installing jq, and a mistake in it is refused before the call. When the filter fails on an answer you paid for, the answer is printed unfiltered and the error gives the command that reads it again free. --concise keeps the main fields and leaves nulls out; --full returns every field.

Walk a list

On a list endpoint, --all walks every page from the first (or from --cursor): a table at a terminal, one item per line otherwise. --max-pages stops it early and --max-credits caps the whole walk. A walk that stops prints the command to resume it.

Shell
socialtap amazon offers https://www.amazon.com/Apple-AirPods-Pro-3/dp/B0FQFB8FMG --all --max-pages 3 -o items.jsonl

Run a batch from a file

Every endpoint command takes --input-file <file>: one link, handle or query per line, or a JSON object of params.

Shell
socialtap tiktok profile --input-file handles.txt -o results.jsonl
socialtap tiktok profile --input-file handles.txt -o results.jsonl --resume

Each line gives one record, in input order, with its data or its error. A line that fails doesn't stop the rest. --max-credits caps the whole batch. The CLI keeps the batch's progress in its own state directory once the first request is sent, so --resume continues a batch that stopped without paying again for the lines it finished. --job runs it as background jobs, so no terminal has to stay open.

Keep only what's new

--archive <file> records the IDs of the items a run returns and leaves out the ones an earlier run saw. With --all on a newest-first list, --break-on-existing stops at the first item already in the archive, so a daily run reads only what's new.

Download videos and photos

--download[=<dir>] saves each item's files under a name template (--name-template) and skips files already there. The files go to the directory; the data still goes to stdout or -o.

Jobs, webhooks and local testing

  • jobs creates background jobs from a file, waits for them and reads their results. See Jobs and batches.
  • webhooks lists, creates and deletes webhook endpoints and sends a test event.
  • listen --forward-to <url> sends your account's events to a local URL, signed as webhooks are, to test a receiver.

Connect your coding agents

init sets up every MCP client it finds on this computer, and the agent running it: the MCP server in each one's config and the Agent Skill where it reads skills. Each client signs you in with your browser; --api-key stores your key in their configs instead. --agent claude,cursor picks clients, and one that isn't installed is an error, never skipped. A server of the same name that isn't this one is left alone unless you pass --force, and a config init can't edit safely is left as it is, with what to paste. --project writes this project's config files instead, to commit. --dry-run prints the plan, --status what is set up where, and --uninstall removes only what it added.

init --default also tells each agent to read social media links with the MCP tools, not its web fetch. It writes a short marked block into the agent's instructions file (CLAUDE.md, AGENTS.md, GEMINI.md, a Cursor rule), once per file and never a line outside it. Running it again updates the block, and --default=off removes it.

mcp is a local MCP server for clients that run local servers only. It bridges to the hosted server with the CLI's sign-in; --tools and --platforms choose the tools it lists. The docs for AI agents list every client and its one-click install.

Agent mode

The CLI detects a coding agent from its environment and answers it in compact, concise JSON, with no color and no prompts. --agent yes|no overrides the detection.

Errors

Piped or run by an agent, an error is one JSON object on stderr with a stable code, a message and a remediation. At a terminal you read the same as lines. The exit code is its class (below). A batch with some lines failed, and a --jq that fails on an answer you paid for, each have a code of their own.

Commands

Data

CommandWhat it does
socialtap search "<need or link>" [--platform <platform>] [--limit <n>]Find the endpoint for a need or a link (no key needed).
socialtap endpoints [--platform <platform>] [--resource <resource>]Every endpoint: command, price and what it returns (no key needed).
socialtap describe [<platform> [<endpoint>]]The CLI, a platform or an endpoint as JSON: params, price, output fields, exit codes (no key needed).
socialtap jobs create <file|-> | get <id> | wait <id> | results <id> | cancel <id> | listBackground jobs: many requests (or long walks) run for you; create, wait, read the results.

Account

CommandWhat it does
socialtap login [--non-interactive | --complete] [--api-key -] [--name <key name>]Sign in with your browser and save an API key for this computer.
socialtap logout [--no-revoke]Remove the saved key (a key the sign-in made is revoked too).
socialtap whoami [--json]The account, balance and key in use, and where the key comes from.
socialtap balance [--json]Your credit balance.
socialtap usage [--since <since>] [--until <until>] [--bucket-width <1h|1d>] [--group-by <group_by>] [--endpoint <endpoint>] [--api-key-id <api_key_id>] [--include <latency_histogram>] [--limit <integer>] [--cursor <cursor>]Requests and credits over time.
socialtap webhooks list | create --url <url> --events <type,…> [--description <text>] | delete <id> | test <id>Webhook endpoints: list, create, delete, send a test event.
socialtap listen --forward-to <url> [--events <type,…>] [--print-secret]Forward your account's events to a local URL as signed webhook deliveries, for testing a receiver.

Agents

CommandWhat it does
socialtap tool [<name> [<json arguments> | - | @file]]The MCP server's tools, as an agent calls them (listed by toolset).
socialtap mcp [--tools <toolset,…>] [--platforms <platform,…>]A local (stdio) MCP server that bridges to the remote one, signed in as the CLI is.
socialtap init [--agent <id>[,<id>]...] [--project] [--default[=off]] [--dry-run] [--yes] [--status] [--uninstall] [--api-key <key>]Set up MCP clients and coding agents: the MCP server in each one's config, and the Agent Skill.
socialtap uninstall [--agent <id>[,<id>]...] [--project] [--dry-run] [--yes]Remove what init added from every client (init --uninstall).
socialtap skillPrint the Agent Skill (SKILL.md) the site publishes.

Setup

CommandWhat it does
socialtap doctor [--json]Check Node, the config file, the key, the API, the balance, agents and the version.
socialtap completion bash|zsh|fishShell completion for bash, zsh or fish.
socialtap open [<platform> [<endpoint>]]Open the docs: the home, a platform's page or an endpoint's (prints the link when no browser opens).
socialtap versionThe CLI's version.

Global flags

They work anywhere on the line.

FlagTakesWhat it does
--api-keykeyAPI key, or - to read it from stdin. Prefer SOCIALTAP_API_KEY or socialtap login: other users can see a command line in the process list.
--profilenameConfig profile to use (default: default; or SOCIALTAP_PROFILE).
--base-urlurlAPI origin (default: https://socialtap.dev; or SOCIALTAP_BASE_URL).
-H, --headername:valueSend this header too (repeatable).
--timeoutsecondsTimeout of one attempt, in seconds.
--max-retriesnRetries of a retryable failure (0: none).
--formatjson|jsonl|table|csv|mdOutput format (default: a table or colored JSON at a terminal, JSON otherwise).
--jsonSame as --format json.
-o, --outputfileWrite the output to a file (its format from the extension); never over an existing file without --force.
--forceLet -o replace an existing file, and init replace a server of the same name that isn't this one.
--jqexprFilter the JSON with a jq expression (a subset: socialtap help jq).
--conciseOnly the main fields, without nulls (a field left out is null). The default for coding agents.
--fullEvery field (the default at a terminal and in scripts).
--agentauto|yes|noAgent mode: compact JSON, concise, no color, prompts or notices (default auto: detected from the environment; or SOCIALTAP_AGENT).
--no-colorNo color (also NO_COLOR, TERM=dumb).
-q, --quietNo receipts, hints or notices on stderr.
--dry-runPrint the request and its price, send nothing (no key needed).
--idempotency-keykeyIdempotency-Key for commands that create something.
-h, --helpHelp for the command.

Batch, archive and file flags

Every endpoint command takes them. The file flags appear only on endpoints whose items have files.

FlagTakesWhat it does
--input-filefile|-One call per line: a link, handle or query, or a JSON object of params (# comments and blank lines skipped). Records come out in input order: {input, line, data | error, credits_charged}.
--concurrencynCalls (or files) at once (default 4).
--abort-on-errorStop a batch at its first failed line (default: every line runs).
--resumeContinue a batch that stopped: the lines it finished are printed again from its progress file, free, and the rest run.
--statefileThe batch's progress file (default: one in the CLI's state directory, named for the command, its flags and the input; written once the first request is sent, removed once every line is done).
--jobRun the batch as background jobs: no terminal to keep open, results read when they end.
--archivefileKeep the IDs of items seen in this file (platform:id per line) and leave out the ones already in it.
--break-on-existingWith --archive and --all: stop the walk at the first item already in the archive (a newest-first list: what's new since the last run).
--downloaddirSave the items' files (videos, photos) under this directory (default: here). stdout lists each file; the data goes to -o.
--name-templatetemplateWhere each file goes under --download: {field.path} of the item and {ext}, {name}, {index}, {date} (default {platform}/{id}-{name}.{ext}).
--filesmedia|cover|avatar|allWhich files --download saves (comma-separated; default: the media, else every file the item has).

Exit codes

Exit codeMeaningAPI error codes
0Success.
1Any other error.request_too_large, method_not_allowed, idempotency_key_reused, not_cached
2The command, a flag or a param is wrong (the CLI's check or the API's invalid_input): fix it, don't retry.invalid_input, invalid_cursor
3No API key, a key the API refuses, or not enough credits: sign in or add credits.unauthorized, forbidden, insufficient_credits, spend_limit_reached
4What you asked for doesn't exist or isn't public.endpoint_retired, job_not_found, unknown_endpoint, not_found, private_or_unavailable, no_transcript, no_live, no_media, no_readme, unavailable_for_legal_reasons
5Try again later: a rate limit, an upstream failure, a network error or a timeout.rate_limited, idempotency_key_in_progress, upstream_blocked, upstream_error, overloaded, internal
6A batch finished with some lines failed or not run, and the others done: each line's record says how it went.
7The call succeeded and was charged, but --jq failed on its answer: the unfiltered JSON is on stdout.

Last updated