Managing certificates for Ons API can be automated through the certificate resolve endpoint https://api-dashboard.ons.io/public-api/certs/resolve
This endpoint supports uploading a CSR, similarly to how this can be done in the Ons API Dashboard. Uploaded CSRs have to be approved separately in Ons API Dashboard by a logged-in user by clicking the link provided by the resolve endpoint. After this is done, the same endpoint can be used to fetch a signed certificate that can be used to access Ons API.
Certificate resolve protocol
The OpenAPI specification for the public certificate resolve API is included at the bottom of this page.
The API can can be used using the flowchart below. A reference implementation script has been included at the bottom of the page.

Implementation guidelines
When implementing the above protocol, follow the guidelines below:
- The protocol assumes the same common-name is used throughout
- pendingKey is the private .key file for which no certificate has (yet) been obtained
- activeCert is the .pem certificate file belonging to activeKey
- activeKey is the private.key file for which there is a working activeCert
- pendingKey and activeKey should be stored securely at all times
- In step 8, the protocol assumes that the generated CSR is defined by the pendingKey and the commonName, and subsequent CSRs generated from the same pendingKey and commonName stay the same byte-for-byte.
- The generated CSR from step 8 is always used as the body in the request in step 9.