torn-cli is designed to cover the official Torn API v2 and FFScouter without requiring every endpoint to be hand-coded as a bespoke command.
- Generic path access is the compatibility floor. Users should be able to call any documented Torn v2 path with
torn api get <path>and any supported FFScouter path withtorn ff get <path>. - Endpoint index powers discovery. A bundled endpoint index should list services, groups, methods, paths, parameters, and auth requirements.
- Shortcuts are thin wrappers. Commands like
torn api user basicshould delegate to the same request model astorn api get /user/basic. - OpenAPI refresh is reviewable. Torn endpoint metadata should be generated from
https://www.torn.com/swagger/openapi.jsonwith a custom User-Agent and pinned in the repository so schema diffs are reviewed.
Target base URL:
https://api.torn.com/v2
Auth:
Authorization: ApiKey <redacted>Repository research observed Torn OpenAPI 3.1.0, schema version 6.0.0, and 205 documented GET paths. The endpoint index should cover all documented v2 paths across these groups:
| Group | Coverage intent |
|---|---|
user |
profile, bars, battlestats, inventory, messages, events, travel, races, reports, logs, and related user selections |
faction |
basic faction data, members, attacks, chains, crimes, revives, reports, territories, wars, applications, and ranked wars |
torn |
global reference data such as items, stocks, honors, medals, crimes, education, properties, log categories, and attack logs |
company |
company profile, employees, applications, news, stock, search, snapshots, and lookup/timestamp endpoints |
market |
item market, bazaar, auction house, properties, rentals, lookup, and timestamp endpoints |
racing |
cars, tracks, races, records, upgrades, lookup, and timestamp endpoints |
forum |
categories, threads, posts, lookup, and timestamp endpoints |
property |
property details, lookup, and timestamp endpoints |
key |
API key info and log endpoints |
Generic examples:
torn api get /user/basic --pretty
torn api get /user --param selections=basic,bars --json
torn api get /faction/members --param striptags=false --table
torn api get /market/itemmarket --param id=206 --json
torn api get /key/info --prettyDedicated log helpers cover the full-access /user/log endpoint plus public log metadata endpoints:
torn logs fetch --since 24h --to now --limit 100 --pretty
torn logs analyze --since 7d --group-by category --table
torn logs analyze --since 30d --group-by data-key --json
torn logs catalog --prettySee TORN_LOGS.md for researched field structure, filtering, grouping, and privacy caveats.
OpenAPI arrays use comma-separated form-style serialization, so flags like --param selections=basic,bars should preserve comma-separated values.
Target base URL:
https://ffscouter.com/api/v1
Auth uses a query parameter:
key=<redacted>
Generic and shortcut coverage includes:
torn ff check-key --pretty
torn ff status --pretty
torn ff register --agree-to-data-policy
torn ff stats --target 123456,789012 --json
torn ff stats-history --target 123456 --since 30d --limit 20 --json
torn ff flights --target 123456 --pretty
torn ff activity player --target 123456 --since 24h --bucket 900 --json
torn ff activity faction --faction 89 --since 24h --bucket 3600 --json
torn ff hits claims --pretty
torn ff hits claim --target 123456 --yes
torn ff hits unclaim --target 123456 --yes
torn ff hits wipe --yes
torn ff targets --preset respect --limit 25 --json
torn ff targets --min-level 20 --max-ff 2.5 --factionless --json
torn ff losses quote --quantity 10 --price-per-loss 300000
torn ff losses seller-contracts --pretty
torn ff losses seller-claims --pretty
torn ff losses seller-order --order 12345 --pretty
torn ff losses seller-claim --order 12345 --slots 10 --yes
torn ff losses seller-complete --claim-id <id> --yes
torn ff announcements --prettyBecause FFScouter credentials are query parameters, all displayed/logged URLs and cache keys must remove or redact key. Response bodies are also recursively redacted for configured secrets because /check-key and /register can echo the API key.
The design-doc seed index is available at:
docs/torn-cli-design-docs/endpoint-index-seed.json
Future generated indexes should be deterministic and reviewable. Suggested generated metadata per endpoint:
- service (
tornorffscouter) - method
- path
- group/tag
- summary/description
- path parameters
- query parameters
- auth behavior
- known access level or permission notes
- cache hints when known
Implementation should account for:
- Torn's documented 100 requests/minute per-user limit across all keys.
- Torn service-cache behavior, often around 30 seconds.
- Torn API error payloads that may arrive with HTTP 200.
- Access-level failures for private selections and faction/company endpoints.
- Invalid-key behavior that should stop retries rather than hammering the service.
When the implementation is complete, coverage checks should include:
- endpoint index count matches the pinned Torn OpenAPI snapshot
- every indexed operation is reachable through generic path access
- shortcuts delegate to generic request construction
- schema-aware
--prettysummaries cover common response wrapper families and fall back safely for uncommon schemas -
--watchrepeats GET requests with cache bypass and colored time prefixes - path query strings and repeated
--paramflags merge deterministically - Torn auth is attached as a header
- FFScouter auth is attached as a query parameter and redacted in display
- cache keys exclude auth secrets
- full-access
/user/loghelpers exposefrom/to, log id, category, target, grouping, field inventory, and safe JSON/CSV/table output - log presets cover every observed Torn log category and support user-defined TOML presets
- permission preflight uses
/key/infoplus endpoint-index access metadata before known Torn requests