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

# Create SSL Monitor

> Create a new SSL certificate monitor to track certificate expiration

## Request Body

<ParamField body="domain" type="string" required>
  Domain to monitor (e.g., "api.example.com"). Do not include protocol.
</ParamField>

<ParamField body="port" type="number" default="443">
  Port to check for SSL certificate
</ParamField>

<ParamField body="alert_days" type="number" default="30">
  Number of days before expiration to trigger alerts. Recommended: 30 for production, 14 for staging.
</ParamField>

<ParamField body="service_id" type="string">
  Optional service ID to link this monitor to. When linked, service status can auto-update based on certificate validity.
</ParamField>

<ParamField body="notification_channels" type="array">
  Array of notification channel IDs to alert on certificate issues
</ParamField>

## Response

Returns the created SSL monitor object with initial certificate check results.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://kodostatus.com/api/v1/ssl-monitors" \
    -H "X-API-Key: your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "domain": "api.example.com",
      "alert_days": 30,
      "service_id": "svc_xyz789"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://kodostatus.com/api/v1/ssl-monitors', {
    method: 'POST',
    headers: {
      'X-API-Key': 'your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      domain: 'api.example.com',
      alert_days: 30,
      service_id: 'svc_xyz789'
    })
  });
  const ssl_monitor = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "id": "ssl_abc123",
    "domain": "api.example.com",
    "port": 443,
    "alert_days": 30,
    "enabled": true,
    "last_checked_at": "2024-01-15T10:30:00Z",
    "certificate": {
      "issuer": "Let's Encrypt Authority X3",
      "subject": "api.example.com",
      "valid_from": "2024-01-01T00:00:00Z",
      "valid_to": "2024-04-01T00:00:00Z",
      "days_until_expiry": 76,
      "is_valid": true
    },
    "service_id": "svc_xyz789",
    "created_at": "2024-01-15T10:30:00Z"
  }
  ```
</ResponseExample>

## Error Codes

| Status | Description                            |
| ------ | -------------------------------------- |
| 400    | Invalid domain format or unreachable   |
| 401    | Invalid or missing API key             |
| 422    | SSL certificate could not be retrieved |
| 429    | Rate limit exceeded                    |
