Skip to content

Add apify api subcommand as a general-purpose authenticated HTTP client for the Apify API #1075

@patrikbraborec

Description

@patrikbraborec

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

Metadata

Metadata

Labels

t-dxIssues owned by the DX team.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions