Summary
Add an api subcommand to the Apify CLI that acts as a general-purpose authenticated HTTP client for the Apify API — similar to how GitHub CLI offers gh api.
This would allow users to call any Apify API endpoint directly from the CLI, using their existing authentication, without needing to reach for curl or other HTTP tools.
Motivation
gh api as prior art: GitHub CLI's gh api subcommand is a great example of this pattern. If gh doesn't have a dedicated command for something, users can fall back to gh api to hit any GitHub API endpoint with automatic authentication and JSON handling.
- Discussed during roadmap review as a valuable addition to the CLI.
- Reduces friction for power users who need to interact with Apify API endpoints that don't have dedicated CLI commands yet.
Suggested behavior
apify api <endpoint> — make a GET request to the given API endpoint
- Support common HTTP methods (
--method GET/POST/PUT/DELETE)
- Automatically inject authentication (API token)
- Accept request body via
--body or stdin
- Output raw JSON by default, with optional formatting (
--jq, --pretty)
- Support both relative paths (
/v2/acts) and full URLs
Example usage
# List actor runs
apify api /v2/acts/my-actor/runs
# Create a new task
apify api /v2/actor-tasks --method POST --body '{"actId": "...", "name": "my-task"}'
# Use with jq-style filtering
apify api /v2/acts --jq '.[].name'
References
Summary
Add an
apisubcommand to the Apify CLI that acts as a general-purpose authenticated HTTP client for the Apify API — similar to how GitHub CLI offersgh api.This would allow users to call any Apify API endpoint directly from the CLI, using their existing authentication, without needing to reach for
curlor other HTTP tools.Motivation
gh apias prior art: GitHub CLI'sgh apisubcommand is a great example of this pattern. Ifghdoesn't have a dedicated command for something, users can fall back togh apito hit any GitHub API endpoint with automatic authentication and JSON handling.Suggested behavior
apify api <endpoint>— make a GET request to the given API endpoint--method GET/POST/PUT/DELETE)--bodyor stdin--jq,--pretty)/v2/acts) and full URLsExample usage
References
gh apidocs