Skip to main content
POST
/
certificates
Add Certificate
curl --request POST \
  --url https://api.example.com/certificates

Request

curl -X POST https://api.certwatch.app/v1/certificates \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "example.com",
    "name": "Main Website",
    "port": 443,
    "alertThresholds": [30, 14, 7, 3, 1]
  }'

Request Body

FieldTypeRequiredDescription
domainstringYesDomain to monitor
namestringNoFriendly name
portintegerNoPort number (default: 443)
alertThresholdsarrayNoAlert days (default: [30, 14, 7, 3, 1])

Example - Minimal

{
  "domain": "example.com"
}

Example - Full

{
  "domain": "api.example.com",
  "name": "Production API",
  "port": 8443,
  "alertThresholds": [14, 7, 1]
}

Response

{
  "data": {
    "id": "cert_abc123",
    "domain": "example.com",
    "name": "Main Website",
    "status": "valid",
    "daysUntilExpiry": 89,
    "expiresAt": "2025-04-08T15:00:00Z",
    "issuedAt": "2025-01-08T15:00:00Z",
    "issuer": "Let's Encrypt",
    "subject": "example.com",
    "port": 443,
    "alertThresholds": [30, 14, 7, 3, 1],
    "createdAt": "2025-01-08T12:00:00Z",
    "updatedAt": "2025-01-08T12:00:00Z"
  },
  "meta": {
    "requestId": "req_xyz789"
  }
}

Errors

400 Bad Request - Invalid Domain

{
  "error": {
    "code": "invalid_domain",
    "message": "The domain format is invalid"
  }
}

400 Bad Request - Duplicate Domain

{
  "error": {
    "code": "duplicate_domain",
    "message": "This domain is already being monitored"
  }
}

400 Bad Request - Certificate Not Found

{
  "error": {
    "code": "certificate_not_found",
    "message": "Could not retrieve SSL certificate from this domain"
  }
}

402 Payment Required - Limit Reached

{
  "error": {
    "code": "certificate_limit_reached",
    "message": "You have reached your certificate limit. Upgrade your plan to add more."
  }
}

401 Unauthorized

{
  "error": {
    "code": "invalid_api_key",
    "message": "The provided API key is invalid"
  }
}