Skip to content

CA Accounts & Gateways

Generated from core/api/router.go. Edit the router, not this file.

MethodPathWho can call it
GET/api/v1/ca-accountsAny authenticated user
POST/api/v1/ca-accountsOperator, admin
DELETE/api/v1/ca-accounts/:idAdmin
POST/api/v1/ca-accounts/:id/healthOperator, admin
PUT/api/v1/ca-accounts/:id/rate-limitOperator, admin
GET/api/v1/gatewaysAny authenticated user

Registering

json
{
  "name": "letsencrypt-prod",
  "provider_type": "acme",
  "gateway_addr": "acme-gateway:9092",
  "server_name": "acme-gateway",
  "config": {
    "directory_url": "letsencrypt",
    "email": "ops@example.com",
    "challenge": "dns-01",
    "dns_provider": "cloudflare",
    "dns_config": {"api_token": "..."}
  },
  "is_default": false
}

The core connects over mTLS, calls the gateway's ValidateConfig, and stores nothing if the gateway rejects it — a 400 comes back listing what is wrong. Warnings do not block and are returned alongside the created account.

config is sealed with AES-256-GCM before storage and decrypted only to populate a single outbound gRPC call. It is not readable back through the API.

server_name overrides the name expected in the gateway's TLS certificate; omit it to derive from the host part of gateway_addr.

Endpoint detail

GET /api/v1/ca-accounts

Who can call itAny authenticated user
HandlercaAccHandler.List
Display tokenReadable by an unattended screen

Responses

StatusBody
200An object with data (CAAccount[]), total
500{ "error": … }
Example request
bash
curl -X GET 'https://certpilot.example.com/api/v1/ca-accounts' \
  -H 'Authorization: Bearer <token>'

POST /api/v1/ca-accounts

Who can call itOperator, admin
HandlercaAccHandler.Create
Display tokenRefused — not a viewer-safe GET

Request body

CreateCAAccountInput is the payload for registering a CA account.

FieldTypeDescription
namestringrequired
provider_typestringrequired
gateway_addrstringrequired
server_namestringServerName overrides the name expected in the gateway's TLS certificate.
configobjectConfig carries provider-specific settings — directory URLs, API tokens, DNS credentials. It is validated by the gateway and then sealed before it reaches the database; it is never returned by any endpoint.
is_defaultboolean
renewal_rate_limitintegerRenewalRateLimit is how many certificates this account may successfully renew inside the window. Zero, the default, means unlimited.
renewal_rate_window_hoursintegerRenewalRateWindowHours is the rolling window, defaulting to a week.

Responses

StatusBody
201An object with data (CAAccount), issuers, warnings (string[])
400An object with validation_error, warnings
· the gateway rejected this configuration
500{ "error": … }
502{ "error": … }
Example request
bash
curl -X POST 'https://certpilot.example.com/api/v1/ca-accounts' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "<name>",
  "provider_type": "<provider_type>",
  "gateway_addr": "<gateway_addr>",
  "server_name": "<server_name>",
  "config": {}
}'

DELETE /api/v1/ca-accounts/:id

Who can call itAdmin
HandlercaAccHandler.Delete
Display tokenRefused — not a viewer-safe GET

Parameters

NameInDefault
idpathrequired

Responses

StatusBody
200An object with message (string)
500{ "error": … }
Example request
bash
curl -X DELETE 'https://certpilot.example.com/api/v1/ca-accounts/<id>' \
  -H 'Authorization: Bearer <token>'

POST /api/v1/ca-accounts/:id/health

Who can call itOperator, admin
HandlercaAccHandler.HealthCheck
Display tokenRefused — not a viewer-safe GET

Parameters

NameInDefault
idpathrequired

Responses

StatusBody
200An object with latency_ms, message, status
404{ "error": … }
503{ "error": … }
Example request
bash
curl -X POST 'https://certpilot.example.com/api/v1/ca-accounts/<id>/health' \
  -H 'Authorization: Bearer <token>'

PUT /api/v1/ca-accounts/:id/rate-limit

Who can call itOperator, admin
HandlercaAccHandler.SetRateLimit
Display tokenRefused — not a viewer-safe GET

Narrow on purpose: the only field on a CA account that can change without re-validating the configuration through the gateway.

Parameters

NameInDefault
idpathrequired

Request body

RateLimitInput sets how hard this account may be renewed against.

FieldTypeDescription
renewal_rate_limitintegerrequiredLimit is certificates per window. Zero means unlimited.
renewal_rate_window_hoursintegerWindowHours defaults to a week when not given.

Responses

StatusBody
200An object with data (CAAccount), message
400{ "error": … }
· renewal_rate_limit cannot be negative; use 0 for unlimited
· renewal_rate_window_hours cannot be negative
404{ "error": … }
500{ "error": … }
Example request
bash
curl -X PUT 'https://certpilot.example.com/api/v1/ca-accounts/<id>/rate-limit' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "renewal_rate_limit": 0,
  "renewal_rate_window_hours": 0
}'

GET /api/v1/gateways

Who can call itAny authenticated user
HandlercaAccHandler.ListGateways
Display tokenReadable by an unattended screen

Responses

StatusBody
200An object with data, total
Example request
bash
curl -X GET 'https://certpilot.example.com/api/v1/gateways' \
  -H 'Authorization: Bearer <token>'