Billing API

Introduction

This page describes the billing API and shows examples on how to use it.

The billing API reports the total number of active certificates, at the time of the request and the total number of issued certificates for a certain month.

Active certificate billing mechanism counts certificates that have been issued in the past, have not been revoked and have not been expired.

Issued certificate billing mechanism counts certificates that have been issued in the provided month, regardless of their current status.

Both mechanisms only apply to certificates issued by a certificate provider; self-signed and imported certificates are ignored.

Requirements

To enable the billing endpoints add:

billing.endpoints.enabled=true in the application.properties file.

Get number of active certificates

To query the number of all active certificates in the application, at the time of the request, an HTTP PUT request should be sent to the /api/v1/public/billings/active-certificates endpoint of the application.

The example below shows how to query the number of all active certificates on a server, listening at host mtg.example.com and on port 8501 with curl:

Listing 1. Request the number of all active certificates
curl -H "Content-Type: application/json" -X PUT https://mtg.example.com/api/v1/public/billings/active-certificates

An example of the response to the above is shown below:

Listing 2. Server response to a client request to get the number of active certificates
{"total":300}

Get number of issued certificates

To query the number of issued certificates in the application, during the provided month, an HTTP PUT request should be sent to the /api/v1/public/billings/issued-certificates endpoint of the application.

An example is shown below.

Listing 3. Request the number of certificates issued in November 2022
curl -H "Content-Type: application/json" -X PUT https://mtg.example.com/api/v1/public/billings/issued-certificates --data '{"year"=2022, "month"=11}'

An example of the response to the above is shown below:

Listing 4. Server response to a client request to get the number of certificates issued in November 2022
{"total":120}