---
title: "Troubleshooting"
description: "Common problems of a first integration with the Amplia Reg API, by symptom, with cause and fix: 401, 403, error codes, webhooks and uploads."
canonical: "https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/troubleshooting"
locale: "en"
product: "Amplia Reg"
last_updated: "2026-11-17"
---

# Troubleshooting

If a call to the [Amplia Reg](https://docs.lacunasoftware.com/en-us/articles/amplia-reg) API fails, start with the HTTP code of the response. If the code is 400, a required field is missing or
has an incorrect value. If the code is 422, the `code` field of the body identifies the problem. The .NET client library throws `AmpliaRegException` for an API error and `RestErrorException` for an
error in the HTTP call. See [API authentication and errors](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/authentication#http-status-codes).

## Authentication and permission

### The API responds with 401

Amplia Reg did not recognize the API key.

| Cause | Fix |
|---|---|
| The request has no `X-Api-Key` header, or the header name is wrong | Send the key in the `X-Api-Key` header of every request |
| The key is incomplete | Send the whole key: the application name, the vertical bar and the key |
| The key belongs to another instance | Use a key that you created on the instance of the endpoint. The key works only on the instance where you created it |
| The key is expired, or someone deleted it | On the application page, click **Keys** and create a new key |

To test the key, list the certificate types:

```bash
curl -i "https://ampliareg.yourcompany.com/api/certificate-types?isDisabled=false" -H "X-Api-Key: your-app|YOUR_KEY"
```

See [API key](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/authentication#api-key) and [Get started](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/get-started#api-key).

### The API responds with 403

The API key is valid, but the application does not have the role that the operation requires.

| Operation | Required role |
|---|---|
| Create and cancel orders, verify the holder and send holder documents | **Sales app** |
| Create pre-approved orders, get their issue links and send the issue instructions again | **Electronic registration authority** |
| Create orders with `videoIdentification.useApiIntegration` set to `true` | **Pre video identification app** |

The **Sales app** role also gets 403 when it gets the order (`GET /api/brazil/orders/{number}`) and when it creates an order with
`startValidation`. To follow the order, use the [webhooks](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/webhooks) or `GET /api/orders/status-transitions`.

Check the roles of the application in the **Applications** menu of the control panel. The roles appear only for applications of a
certification authority (CA) or of a registration authority (RA). The **Electronic registration authority** role does not cancel orders.
If the application creates pre-approved orders and also cancels them, it must have the first two roles.

See [Application roles](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/authentication#roles).

### The API responds with `SubscriptionRequired`

The request did not specify a subscription, which is a CA or an RA.

| Cause | Fix |
|---|---|
| The creation of a pre-approved order did not specify the RA | Send the ID of the RA in the `X-Subscription` header. In .NET, set the `RegistrationAuthorityId` option |
| The application does not belong to a CA or to an RA | Create the application in a CA or in an RA |

If the code is `RegistrationAuthorityRequired`, the order creation did not specify the RA: send `registrationAuthority` in the body. If
the code is `NormalSubscriptionRequired`, the `X-Subscription` header specified the root subscription: send the ID of an RA.

See [Application subscription](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/authentication#subscription) and [Creating pre-approved orders](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/preapproved-orders).

## Order creation

### The creation responds with HTTP 400

A required field is missing or has an incorrect value.

| Cause | Fix |
|---|---|
| A field that all orders require is missing, for example `certificateType` or `parameters.cpf` | Send the field. See [Request fields](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/create-order#request-fields) |
| The issue type is `VideoIdentification` or `OnlineIssuance`, and `contact` or `holderType` is missing | Send `contact` and `holderType` |
| The issue type is `OnlineIssuance`, and `address` is missing | Send `address` |
| The request has `contact`, but `emailAddress` or `phone` is missing | Send the two fields |
| A field has an incorrect value, for example an incorrect CPF or a phone number without the country code | Correct the value |

### The creation responds with `RfbQueryNotApproved` or with a name mismatch code

The instance has the RFB prior query configured. The order creation ran the query, and the query did not accept the data that you sent.

| Code | Cause | Fix |
|---|---|---|
| `RfbQueryNotApproved` | The query did not approve the holder's data. The `message` of the error has the reason | Correct `cpf`, `birthDate` or `cnpj` as the `message` tells. To see the reason before you create the order, call `POST /api/rfb-query` |
| `RfbQueryNameMismatch` | The `name` of the order is different from the name that the query returns | Send the `name` of the query response in `parameters.name` |
| `RfbQueryOrganizationNameMismatch` | The `organizationName` of the order is different from the company name that the query returns | Send the `organizationName` of the query response in `parameters.organizationName` |

The comparison of the names ignores uppercase and lowercase. Copy the values of the query response and do not change the text.

See [RFB prior query](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/verify-holder#rfb-query).

### The creation responds with `CertificateTypeNotFound`

No certificate type exists with the `code` or the `id` that you sent.

| Cause | Fix |
|---|---|
| The `code` is wrong | List the types with `GET /api/certificate-types?isDisabled=false` and copy the `code` of the applicable type |
| The `code` belongs to a certificate type of another CA | Use a certificate type of the CA of the RA where you create the order |

The `CertificateTypeDisabled` code means that the certificate type is disabled. The `CertificateFormatMismatch` code means that the type
has a different format, for example an SSL type on `/api/brazil/orders`.

See [List the certificate types](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/create-order#certificate-types).

### The creation responds with HTTP 400 because of the phone number

Order creation rejects an invalid phone number in `contact.phone` or in `contact.alternativePhone`.

| Cause | Fix |
|---|---|
| The number has no country code, and Amplia Reg reads the first digits as the country code | Send the number with the country code, as in `+5511999990000` |
| The number is not valid in the numbering plan of the country | Check the length, the area code and the prefix of the number |
| The number has more than 25 characters | Send the number in the E.164 format, with digits only after the `+` |

To find the problem before the creation, validate the number with `GET /api/users/phone-number/validation`. Order creation also accepts
a number that the validation accepts.

See [Phone number validation](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/verify-holder#phone-validation).

## Existing orders

### The API responds with `OrderCannotUpdate`

The status of the order does not let you change the data. The lock starts in `WaitingIssue`.

| Cause | Fix |
|---|---|
| You sent the holder documents while the order was in `WaitingIssue`, `Issued`, `Revoked`, `Canceled` or `Declined` | Send the documents immediately after you create the order, before the validation |
| The order is pre-approved and starts in `WaitingIssue` | Send the documents in the `holderFiles` field of the pre-approved order creation |

See [Add holder documents to an order](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/add-holder-files) and [Order statuses](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/issuance#order-statuses).

### The API responds with `OrderNotFound`

No order exists with the number that you sent in the URL.

| Cause | Fix |
|---|---|
| The number that you sent is not the order number | Use the `number` of the creation response, or the `orderNumber` of the webhooks and of the pre-approved orders |
| The route received the ID of the order instead of the number | Send the number. The cancellation route also accepts the ID |

Amplia Reg compares the number and ignores punctuation, spaces and the difference between uppercase and lowercase.

See [Response of the order creation](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/create-order#response) and [Error codes](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/error-codes).

## Webhooks

### The webhook does not arrive

In the control panel, open the application in the **Applications** menu and look at the **Webhook notifications** section. The section
shows each notification, the number of attempts and the response or the error of the last attempt.

| Symptom | Cause | Fix |
|---|---|---|
| No notification appears in the list | An agent created the order in the control panel, or another application created it | Create the order with the API key of the application that has the webhook |
| No notification appears in the list | The webhook was disabled when the status changed | Enable the webhook before you create the order |
| The notification fails with `401` or `403` | Your application did not accept the secret | Check the registered authentication type and secret |
| The notification fails with no response code | Amplia Reg could not connect to the URL | Make sure that the URL is public and that its HTTPS certificate is valid |
| The notification fails with a different code | Your application responded with a code that is not `2xx` | Store the notification and respond with `2xx`. Do slow processing later |

Amplia Reg tries again to deliver a notification that failed. The new attempts do not guarantee the delivery. To recover the missed
changes, call `GET /api/orders/status-transitions`.

See [Check the deliveries](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/webhooks#troubleshooting), [Which orders trigger notifications](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/webhooks/how-it-works#which-orders)
and [Recover missed changes](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/webhooks#reconcile).

### The webhook arrives twice or out of order

Amplia Reg delivers each notification independently and repeats the delivery after a failure.

| Symptom | Cause | Fix |
|---|---|---|
| The same notification arrives more than once | Your application processed the notification, and the response did not reach Amplia Reg | Ignore a notification that you processed before. Identify an `OrderStatusChanged` notification by `orderId`, `status` and `date` |
| The `Issued` notification arrives before the `WaitingIssue` notification | A retry delayed the older notification | Compare the `date` of the notification with the date of the last change that you stored. Keep only the latest change |

Identify an `OrderVideoIdentificationCompleted` notification by `number` and `sessionId`.

See [Ordering and duplicates](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/webhooks/how-it-works#ordering) and [Receive the notifications](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/webhooks#receive).

## Files

### The upload reference fails

A route that receives files, for example the holder documents route, did not accept the `file` field.

| Cause | Fix |
|---|---|
| A previous call used the upload. Amplia Reg moves the file to the order and deletes the upload | Make a new upload for each use |
| The request has the file in the JSON body | First upload the file with `POST /api/uploads`. Then send the `id` of the upload in the `file` field |
| The upload request is not `multipart/form-data` with the `file`, `name` and `contentType` fields | Build the upload request as in the example below |

```bash
curl -X POST "https://ampliareg.yourcompany.com/api/uploads" \
  -H "X-Api-Key: your-app|YOUR_KEY" \
  -F "file=@document.pdf" \
  -F "name=document.pdf" \
  -F "contentType=application/pdf"
```

In .NET, use `FileReference.FromFile`, `FileReference.FromBytes` or `FileReference.FromStream`. The .NET client library uploads the
file for you.

See [Reference files](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/add-holder-files#file-referencing).

## See also

* [API authentication and errors](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/authentication)
* [Error codes](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/error-codes)
* [How webhooks work](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/webhooks/how-it-works)
