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

# Connector health checks

> Monitor Baton connectors running in service mode with HTTP health check endpoints.

Baton connectors [running in service mode](/baton/deploy#run-a-self-hosted-connector-in-service-mode) can expose HTTP health check endpoints for container orchestrators (ECS Fargate, Kubernetes, etc.) to monitor connector health.

<Note>
  When C1 encounters a 503 from a connector during provisioning, it treats this as a transient error and retries automatically (up to 5 attempts). Errors indicating a configuration problem — such as 401, 403, or 404 — are not retried. If provisioning still fails after retries, the task falls back to a manual path and appears in the **Assigned to me** area for follow-up. Learn more about [automatic account provisioning](/product/admin/account-provisioning).
</Note>

## Enabling health checks

Health checks are disabled by default. Enable them using environment variables or CLI flags:

| Environment variable              | CLI flag                      | Default     | Description                              |
| --------------------------------- | ----------------------------- | ----------- | ---------------------------------------- |
| `BATON_HEALTH_CHECK`              | `--health-check`              | `false`     | Enable the health check server           |
| `BATON_HEALTH_CHECK_PORT`         | `--health-check-port`         | `8081`      | Port for the health check server         |
| `BATON_HEALTH_CHECK_BIND_ADDRESS` | `--health-check-bind-address` | `127.0.0.1` | Bind address for the health check server |

## Health check endpoints

| Endpoint  | Description                                                   | Success (HTTP 200)                   | Failure (HTTP 503)             |
| --------- | ------------------------------------------------------------- | ------------------------------------ | ------------------------------ |
| `/health` | Full health check - calls the connector's `Validate()` method | Connector is healthy                 | Connector validation failed    |
| `/ready`  | Readiness check - verifies connector client is available      | Connector is ready to serve requests | Connector client not available |
| `/live`   | Liveness check - verifies process is running                  | Always returns success               | N/A                            |

## The health-check command

Each connector includes a `health-check` subcommand for querying the health check server. This is designed for container exec probes, eliminating the need to bundle curl or other HTTP clients in container images.

### Usage

```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
# Check health (default endpoint)
baton-myconnector health-check

# Check readiness
baton-myconnector health-check --endpoint=ready

# Check liveness
baton-myconnector health-check --endpoint=live

# Check with custom port
baton-myconnector health-check --health-check-port=9090
```

### Flags

| Flag                          | Default     | Description                                     |
| ----------------------------- | ----------- | ----------------------------------------------- |
| `--endpoint`                  | `health`    | Endpoint to check: `health`, `ready`, or `live` |
| `--timeout`                   | `5`         | Request timeout in seconds                      |
| `--health-check-port`         | `8081`      | Port to connect to                              |
| `--health-check-bind-address` | `127.0.0.1` | Address to connect to                           |

### Exit codes

| Scenario              | Exit code   |
| --------------------- | ----------- |
| HTTP 200 response     | 0 (success) |
| HTTP non-200 response | 1 (failure) |
| Connection failed     | 1 (failure) |
| Timeout               | 1 (failure) |

## Container orchestrator examples

### AWS ECS Fargate

```json theme={"theme":{"light":"css-variables","dark":"css-variables"}}
{
  "healthCheck": {
    "command": ["CMD", "/baton-myconnector", "health-check"],
    "interval": 30,
    "timeout": 10,
    "retries": 3,
    "startPeriod": 60
  }
}
```

### Kubernetes

```yaml theme={"theme":{"light":"css-variables","dark":"css-variables"}}
livenessProbe:
  exec:
    command: ["/baton-myconnector", "health-check", "--endpoint=live"]
  initialDelaySeconds: 10
  periodSeconds: 5

readinessProbe:
  exec:
    command: ["/baton-myconnector", "health-check", "--endpoint=ready"]
  initialDelaySeconds: 5
  periodSeconds: 3
```
