Pular para o conteúdo principal

Troubleshooting

If a call to the 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.

Authentication and permission​

The API responds with 401​

Amplia Reg did not recognize the API key.

CauseFix
The request has no X-Api-Key header, or the header name is wrongSend the key in the X-Api-Key header of every request
The key is incompleteSend the whole key: the application name, the vertical bar and the key
The key belongs to another instanceUse 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 itOn the application page, click Keys and create a new key

To test the key, list the certificate types:

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

See API key and Get started.

The API responds with 403​

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

OperationRequired role
Create and cancel orders, verify the holder and send holder documentsSales app
Create pre-approved orders, get their issue links and send the issue instructions againElectronic registration authority
Create orders with videoIdentification.useApiIntegration set to truePre 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 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.

The API responds with SubscriptionRequired​

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

CauseFix
The creation of a pre-approved order did not specify the RASend 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 RACreate 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 and Creating pre-approved orders.

Order creation​

The creation responds with HTTP 400​

A required field is missing or has an incorrect value.

CauseFix
A field that all orders require is missing, for example certificateType or parameters.cpfSend the field. See Request fields
The issue type is VideoIdentification or OnlineIssuance, and contact or holderType is missingSend contact and holderType
The issue type is OnlineIssuance, and address is missingSend address
The request has contact, but emailAddress or phone is missingSend the two fields
A field has an incorrect value, for example an incorrect CPF or a phone number without the country codeCorrect 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.

CodeCauseFix
RfbQueryNotApprovedThe query did not approve the holder's data. The message of the error has the reasonCorrect cpf, birthDate or cnpj as the message tells. To see the reason before you create the order, call POST /api/rfb-query
RfbQueryNameMismatchThe name of the order is different from the name that the query returnsSend the name of the query response in parameters.name
RfbQueryOrganizationNameMismatchThe organizationName of the order is different from the company name that the query returnsSend 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.

The creation responds with CertificateTypeNotFound​

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

CauseFix
The code is wrongList 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 CAUse 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.

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.

CauseFix
The number has no country code, and Amplia Reg reads the first digits as the country codeSend the number with the country code, as in +5511999990000
The number is not valid in the numbering plan of the countryCheck the length, the area code and the prefix of the number
The number has more than 25 charactersSend 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.

Existing orders​

The API responds with OrderCannotUpdate​

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

CauseFix
You sent the holder documents while the order was in WaitingIssue, Issued, Revoked, Canceled or DeclinedSend the documents immediately after you create the order, before the validation
The order is pre-approved and starts in WaitingIssueSend the documents in the holderFiles field of the pre-approved order creation

See Add holder documents to an order and Order statuses.

The API responds with OrderNotFound​

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

CauseFix
The number that you sent is not the order numberUse 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 numberSend 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 and 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.

SymptomCauseFix
No notification appears in the listAn agent created the order in the control panel, or another application created itCreate the order with the API key of the application that has the webhook
No notification appears in the listThe webhook was disabled when the status changedEnable the webhook before you create the order
The notification fails with 401 or 403Your application did not accept the secretCheck the registered authentication type and secret
The notification fails with no response codeAmplia Reg could not connect to the URLMake sure that the URL is public and that its HTTPS certificate is valid
The notification fails with a different codeYour application responded with a code that is not 2xxStore 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, Which orders trigger notifications and Recover missed changes.

The webhook arrives twice or out of order​

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

SymptomCauseFix
The same notification arrives more than onceYour application processed the notification, and the response did not reach Amplia RegIgnore a notification that you processed before. Identify an OrderStatusChanged notification by orderId, status and date
The Issued notification arrives before the WaitingIssue notificationA retry delayed the older notificationCompare 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 and Receive the notifications.

Files​

The upload reference fails​

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

CauseFix
A previous call used the upload. Amplia Reg moves the file to the order and deletes the uploadMake a new upload for each use
The request has the file in the JSON bodyFirst 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 fieldsBuild the upload request as in the example below
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.

See also​

View as Markdown