This article follows the official documentation. We haven’t tested this tool for a hands-on review.
When a coding agent needs to inspect a Resend email account from a shell, it can use the Resend CLI, Resend’s official command-line tool. Its commands cover the Resend API, including domains and emails, and its source is in the resend/resend-cli repository. It sends requests to Resend’s API, the service interface for reading or changing account data. The CLI needs an API key, a credential it uses to make requests.
For a low-risk first task, have the agent list the account’s domains and summarize their status. The command reads account data; it does not create or change a domain. The CLI returns JSON, a structured data format, when its output does not go to a terminal, for example in CI or when another program calls it. The global --json flag forces JSON in an interactive terminal as well. This format makes the output easier for an agent to parse.
Install and authenticate
The Resend CLI documentation lists ways to install the CLI. One option uses npm to install it globally, making it available as a command across your local machine:
npm install -g resend-cli
This adds the resend command to the local machine’s global npm packages. It does not contact Resend or change account data. The same page also documents a cURL installer and Homebrew with brew install resend/cli/resend.
The CLI needs a Resend API key to make account requests. It looks for the key in a fixed order. A --api-key flag comes first, then the RESEND_API_KEY environment variable, then credentials saved by resend login. Set RESEND_API_KEY in the shell environment that launches the agent, using your existing method for storing secrets. The shell environment makes the variable available to programs it launches. Do not paste the key into an agent prompt or put its value directly in a command.
Before calling Resend, the agent can check that the environment variable exists without printing its value:
: "${RESEND_API_KEY:?Set RESEND_API_KEY in the shell environment first}"
If the key is missing, this shell check fails locally before the CLI sends a request. The CLI’s own resend doctor command goes further. It contacts Resend to check the API key and the account’s domains.
List domains
Use this command to inspect domain data without changing the account:
resend domains list --json
The command sends a network request to Resend and returns JSON with the domains in a data list. By default it returns up to 10 domains, and --limit raises that to as many as 100. The list does not include DNS records. The documentation lists resend domains get <id> for a domain with its DNS records. The response depends on the account, so do not assume the list contains a particular domain or status.
The agent can report the domain names and statuses in the response, or say that the command returned no domains. It should use the JSON it received rather than invent account details. A suitable prompt is:
Run
resend domains list --jsonand summarize the returned domain names and statuses. If the command fails, report the error without exposing credentials. Do not make changes to the account.
The prompt tells the agent what to read and summarize, and says not to change the account. The API key stays in the shell environment, not in the prompt.
Know when a command changes data
Resend CLI commands either read account data or change it. Listing domains reads data. Sending an email or creating a broadcast submits a new action to Resend and changes the account. The README’s dry-run section says --dry-run validates a payload and prints it without calling the API. It works with emails send and broadcasts create. The batch command emails batch also supports it. The README says other commands do not support it, so do not assume it protects other commands that change account data.
The Resend page on the CLI for AI agents says interactive prompts are turned off in machine mode, which the CLI uses without a terminal or with --json. Missing required flags cause an error that lists what is needed. Supply all required flags when you use a command that changes account data, and validate the data separately before submitting the request. Delete commands such as resend webhooks delete also need --yes in this mode. For example, a successful dry run checks the supported payload without sending the email. You must run the send command separately to submit it to Resend.