Redeem an enrollment code for a certificate
const url = 'https://example.com/api/certs/service/retrieve';const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/certs/service/retrieve \ --header 'Content-Type: application/json' \ --data '{}'Signs and returns a service certificate for the enrollment the code identifies, using the public key and options fixed at approval time. Codes are reusable until the enrollment expires; every redemption is logged for the approving user and auditors. The certificate is valid from now until the enrollment’s expiry.
Request Bodyrequired
Section titled “Request Bodyrequired”The enrollment code to redeem
Responses
Section titled “Responses”The signed service certificate
object
object
Example generated
{ "data": { "certificate": "example" }, "error": "example"}Unknown or expired enrollment code
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}Signing failed or timed out
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}