Get started with the Amplia Reg API
This guide shows you how to create your first certificate order through the Amplia Reg API, in five steps. At the end, you have one order and the first webhook notification for that order.
The example in this guide creates an order for an ICP-Brasil standard certificate, through the /api/brazil/orders route. For this
reason, the example uses CPF and CNPJ. For other certificate formats, see Create orders of other formats.
The reference for all use cases is in the Integration Guide.
Before you start
You will need:
- The endpoint. The endpoint is the address of the Amplia Reg instance. It is the same as the address of the control panel, for example
https://ampliareg.yourcompany.com. - Access to the Applications menu of the control panel, to create the API key and register the webhook. If you do not have this access, ask the administrator of your Amplia Reg instance for the endpoint and an API key, and ask them to register the webhook. Then go to step 3.
- A public URL of your application that accepts
POSTrequests with a JSON body. Amplia Reg sends the notifications to this URL. - The CNPJ of the registration authority (RA) where you will create the orders.
- The data of a test holder: CPF, full name and birth date.
In the examples of this guide, the endpoint is https://ampliareg.yourcompany.com. Replace it with the endpoint of your instance. An API
key works only on the instance where you created it.
This guide creates a real order on the instance. If you have a test instance or a test RA, use it. Step 5 shows how to cancel the order at the end.
Step 1: Create the application and the API key
- Sign in to the control panel of your instance.
- In the side menu, click Applications, then Add.
- Fill in a name for the application.
- Select the subscription of the application: the certification authority (CA) or the RA where the application will create orders. The role in the next item appears only for these subscriptions.
- Select the Sales app role. With this role, the application can create and cancel orders, do the holder checks and send documents. To create pre-approved orders, also select the Electronic registration authority role.
- Click Create.
- On the application page, click Keys, then Add.
- Fill in a description for the key and choose an expiration. Then click Create.
The key has the format application-name|<key>. Send it in the X-Api-Key header of every request:
X-Api-Key: your-app|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Amplia Reg shows the key only once, when you create it. Keep the key in a secrets vault. You cannot recover a lost key. You can only create a new key.
To make sure that the key works, list the certificate types:
curl -i "https://ampliareg.yourcompany.com/api/certificate-types?isDisabled=false" -H "X-Api-Key: your-app|YOUR_KEY"
A 401 response means that Amplia Reg did not recognize the key. Common causes:
- The request has no
X-Api-Keyheader, or the header name is wrong. - The key is incomplete. Send the whole key, with the application name, the
|and the key. - The key belongs to another instance.
- The key is expired, or someone deleted it.
A 403 response means that the key is valid, but the application does not have the role that the operation requires.
Step 2: Register the webhook
The webhook is a URL of your application. Amplia Reg calls this URL on each status change of the orders that your application created. The webhook notifies only the changes that occur after you register it. For this reason, register it before you create the order.
- On the page of the application from step 1, click Edit. Then turn on Enable webhook.
- Fill in the URL that will receive the notifications.
- In Authentication type, select
Bearer. In Authentication token, fill in a long, random secret. - Save.
Amplia Reg sends the secret in the Authorization: Bearer <secret> header of each notification. See
Register and receive webhooks for the other authentication types and for what your application must do
with each notification.
Step 3: Choose the certificate type
The certificate type defines the certificate that the holder receives, for example an e-CPF A1. The call from step 1 lists the enabled types:
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "e-CPF A1",
"format": "PkiBrazil",
"code": "ECPFA1",
"allowVideoConference": true,
"validityOptions": [
{ "years": 1, "months": 0, "days": 0 },
{ "years": 2, "months": 0, "days": 0 }
]
}
]
The example shows only some of the fields. Write down these values:
- The
codeof the certificate type. Thecodeidentifies the type when you create the order. - One of the
validityOptions. These are the validity periods that the certificate type allows.
Step 4: Create the order
If the instance has the RFB prior query configured, the order creation checks the holder's data with the Brazilian Revenue Service (RFB). In this case, send the real data of the holder, with the name as the RFB has it.
Create the order with the code and the validity from step 3:
curl -X POST "https://ampliareg.yourcompany.com/api/brazil/orders" \
-H "X-Api-Key: your-app|YOUR_KEY" \
-H "Content-Type: application/json" \
--data-binary @order.json
Content of order.json:
{
"registrationAuthority": {
"organizationIdentifier": "09933230000188"
},
"certificateType": {
"code": "ECPFA1"
},
"issueType": "Presential",
"parameters": {
"cpf": "07917307000",
"name": "Holder Name",
"birthDate": "1995-10-15"
},
"validity": {
"years": 1
}
}
| Field | Content |
|---|---|
registrationAuthority.organizationIdentifier | The CNPJ registered on the RA, without punctuation. Instead, you can send the RA's ID in registrationAuthority.id. If the application belongs to an RA, you can omit registrationAuthority |
certificateType.code | The code from step 3 |
issueType | How the holder's identity will be validated. Presential is in-person validation, at the RA |
parameters | The holder's CPF (digits only), full name and birth date (yyyy-mm-dd) |
validity | One of the validityOptions from step 3 |
Response:
{
"id": "0195a9dc-c0f0-4f5c-83d3-bf562ae98ed9",
"number": "800-005-520",
"videoIdentification": null,
"preValidation": null
}
The number is the order number. The holder and the agents use this number to find the order. Keep it: the other APIs receive
the number in the URL.
If the response is 400, a required field is missing or a field has an incorrect value. If the response is 422, the body has an error code, for example CertificateTypeNotFound when the code does not exist. See the
error codes.
Step 5: Follow the order
Immediately after the creation, your URL receives the first notification of the order, with the WaitingValidation status:
{
"type": "OrderStatusChanged",
"orderStatusTransitionModel": {
"orderId": "0195a9dc-c0f0-4f5c-83d3-bf562ae98ed9",
"orderNumber": "800-005-520",
"previousStatus": null,
"status": "WaitingValidation",
"date": "2025-03-18T15:26:11.704304+00:00"
},
"videoIdentificationCompletedModel": null
}
The example shows only some of the fields. If the notification does not arrive, see Check the deliveries.
For a real order, the agents of the RA validate the identity of the holder and approve the order, and each status change causes a new
notification. When the certificate is issued, you receive a notification with the Issued status. See
How certificate issuance works for all statuses between creation and issuance.
This order is a test, so cancel it:
curl -X POST "https://ampliareg.yourcompany.com/api/orders/800-005-520/cancellation" \
-H "X-Api-Key: your-app|YOUR_KEY" \
-H "Content-Type: application/json" \
-d "{\"description\": \"Test order\"}"
Your URL receives one more notification, now with the Canceled status.
Next steps
With your first order created, you can:
- Verify the holder before creating the order: biometric enrollment, phone number and, if you want, the RFB prior query.
- Send the holder documents to the order.
- Create orders by videoconference or pre-approved orders.
- Cancel an order that is no longer needed.
- Call the API through the .NET client library, as in the full example.