String Web Access CLI
Use String Web Access from a terminal. The CLI supports fetch, search, direct HTTP requests, and sitemap jobs. JSON responses go to stdout, so they can be piped to other commands.
Install
Requires Node.js 22 or newer. Once @usestring/cli is published:
npm install -g @usestring/cli
To try the source package before release, run bun run build in this directory, then npm install -g ..
Create an API key in String settings and set it in your shell:
export STRING_API_KEY="your-api-key"
The CLI reads the key from the environment and does not save it to a file.
Commands
string fetch https://example.com
string fetch https://example.com --format markdown
string search "coffee shops in Austin" --engine google --count 20
string request POST https://example.com/api --body 'hello'
fetch and request use JSON output by default. Use --format markdown for page text or --format raw for response bytes. search and sitemap return JSON.
For API options that do not have a named flag, put them in a JSON object and pass --input FILE. The command's URL, query, and method take precedence over matching fields in the file. Use --input - to read JSON from stdin.
printf '%s\n' '{"executeJS":true,"countryCode":"GB"}' > fetch-options.json
string fetch https://example.com --input fetch-options.json
For a JSON request body, put the object and destination headers in the input file:
printf '%s\n' '{"body":{"name":"example"},"headers":{"Content-Type":"application/json"}}' > request-options.json
string request POST https://example.com/api --input request-options.json
Sitemap jobs require a separate approval after the quote. Submitting a job does not start a crawl or charge the account.
string sitemap submit https://example.com
string sitemap approve JOB_ID
string sitemap status JOB_ID
string sitemap results JOB_ID --limit 100 --offset 0
string sitemap list
string sitemap cancel JOB_ID
string --help lists the commands and the STRING_API_BASE_URL setting for a different API endpoint. HTTP errors go to stderr and return a nonzero exit status.