> ## Documentation Index
> Fetch the complete documentation index at: https://ahasend.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> AhaSend stores all message data in the EU. See /facts.
> The API base URL is https://api.ahasend.com. Send the API key in the Authorization: Bearer header. See /api-reference/authentication.
> Use send.ahasend.com for SMTP. Ports 25, 587 and 2525 use STARTTLS. Port 465 is not supported. See /smtp.
> For send-only integrations, create an API Key v2 under Credentials → Add and scope it to messages:send:{your-domain}. See /send-api/credentials and /api-reference/scopes.

# ahasend ping: Test API Connectivity

> Use ahasend ping to check that the AhaSend CLI can reach the API and that the API accepts your API key from this IP address. Handy for CI health checks.

Use AhaSend CLI `ping` to check your API connection and API key; this page covers its options and results.

Before running the examples, [log in](https://ahasend.com/docs/cli/authentication.md), or pass an API key with the global flags: replace `YOUR_API_KEY` and `YOUR_ACCOUNT_ID` with your API key and the ID of its account.

## Overview

```text theme={null}
ahasend ping [flags]
```

The `ping` command sends a ping request to the AhaSend API, which checks that:

* The API can be reached
* The API accepts the API key, from this IP address

The API answers a ping before it looks at the account. So `ping` does not check that the key belongs to the account ID, or what the key may do. Run [`ahasend auth status`](https://ahasend.com/docs/cli/commands/auth) for that.

## Basic Usage

```bash theme={null}
# Test with the default profile
ahasend ping

# Test with a specific profile
ahasend ping --profile production

# Test with an API key instead of a profile
ahasend ping --api-key YOUR_API_KEY --account-id YOUR_ACCOUNT_ID
```

## Output

Table and plain output print the API's message:

```text theme={null}
pong
```

`--output json` prints the API's response body unchanged:

```json theme={null}
{
  "message": "pong"
}
```

CSV output has a `message` column and one row.

## Exit Codes

`ping` uses the CLI's [exit codes](https://ahasend.com/docs/cli/configuration.md#exit-codes):

* 0: The API accepts the key.
* 2: The API rejected the key.
* 6: The API refused the key with HTTP 403 because the key's IP allow list leaves out this IP address.
* 7: The API cannot be reached.

```bash theme={null}
# Fail a CI job when the API or the key does not work
ahasend --api-key "$AHASEND_API_KEY" --account-id "$AHASEND_ACCOUNT_ID" ping || exit 1
```

## Command Flags

This command has no command-specific flags. It accepts the [global flags](https://ahasend.com/docs/cli/configuration.md#global-flags).

## Next Steps

* [Configure authentication](https://ahasend.com/docs/cli/authentication.md)
* [Manage API keys](https://ahasend.com/docs/cli/commands/apikeys.md)
* [Send your first message](https://ahasend.com/docs/cli/commands/messages.md)

## Related Guides

* [Install the CLI](https://ahasend.com/docs/cli/installation.md), [CLI authentication](https://ahasend.com/docs/cli/authentication.md), [REST sending guide](https://ahasend.com/docs/send-api/send-email.md).
* [SMTP settings](https://ahasend.com/docs/smtp.md), [Node.js SDK](https://ahasend.com/docs/guides/nodejs-sdk.md), [Go SDK](https://ahasend.com/docs/guides/go-sdk.md).
* [CLI configuration and output](https://ahasend.com/docs/cli/configuration.md), [API authentication](https://ahasend.com/docs/api-reference/authentication.md), [Permission scopes](https://ahasend.com/docs/api-reference/scopes.md).
* [Domain setup](https://ahasend.com/docs/domains.md), [Sandbox behavior](https://ahasend.com/docs/send-api/sandbox.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.