Pular para o conteúdo principal

Error codes - Amplia Reg

When a call to the Amplia Reg API fails because of how it was made, for example a missing field or an order in the wrong status, the API responds with HTTP code 422 (Unprocessable Entity) and an ErrorModel in the body. In .NET, the client throws an AmpliaRegException. In both cases, the error code identifies the problem. See HTTP response codes for the format.

{
"code": "OrderNotFound",
"message": "Order not found"
}

Use the code field to decide what to do. The message field helps diagnose the problem and should be logged, not shown to the user: it is always in English and its wording may change.

The tables below list the codes you are most likely to get when calling the APIs described in this Integration Guide, grouped by topic.

Registration authority​

CodeWhen it happens
RegistrationAuthorityRequiredThe order creation request did not say at which registration authority to create the order: send registrationAuthority in the body
RegistrationAuthorityNotFoundThe registration authority given in the request does not exist
SubscriptionRequiredThe request needs a registration authority in the X-Subscription header, as when creating preapproved orders, and none was sent
NormalSubscriptionRequiredThe X-Subscription header named the root subscription instead of a registration authority
CertificationAuthorityMismatchThe certificate type belongs to a different certification authority than the registration authority

Certificate type and holder type​

CodeWhen it happens
CertificateTypeNotFoundNo certificate type with the given code or id exists for the certification authority
BadCertificateTypeReferencecertificateType has neither code nor id
CertificateTypeDisabledThe certificate type is disabled
CertificateFormatMismatchThe certificate type has a different format from the route called, for example an SSL certificate type on /api/brazil/orders
HolderTypeNotFoundNo holder type with the given code or id exists
BadHolderTypeReferenceholderType has neither code nor id
HolderTypeDisabledThe holder type is disabled
HolderTypeNotAllowedThe certificate type does not accept the given holder type, or does not accept holder types at all
HolderTypeIsRequiredThe certificate type accepts more than one holder type and holderType was not given
InvalidValidityOptionThe certificate type does not offer the given validity
ValidityIsRequiredThe certificate type has more than one validity option and validity was not given

Order data​

CodeWhen it happens
InvalidParamsA required holder field is missing. For an ICP-Brasil organizational certificate (e-CNPJ): organizationName or cnpj
CustomNumberNotAllowednumber was sent, but the instance does not allow custom order numbers
OrderNumberAlreadyExistsAnother order already has the given number
SaleNumberNotAllowedsaleNumber was sent, but the instance does not use sale numbers
SaleNumberIsRequiredThe instance requires saleNumber and it was not sent
PrimaryEmailInUseForAnotherPerson, AlternativeEmailInUseForAnotherPerson, BothEmailsInUseForAnotherPersonThe instance allows only one person per email address, and an email address in contact already belongs to another holder
SelfOperationDeniedThe instance does not allow agents to act on their own orders, and the holder is the user making the call
OrderCreationDisabledThe instance does not allow users to create orders. Applications are not affected
InvalidCsrThe CSR sent could not be decoded

Issue type​

CodeWhen it happens
InvalidIssueTypeissueType is PreApproved. Preapproved orders have their own API: see Creating preapproved orders
CertificateTypeDoesNotAllowVideoConferenceissueType is VideoConference, but the certificate type does not allow videoconference
CertificateTypeDoesNotAllowVideoIdentificationissueType is VideoIdentification, but the certificate type does not allow video identification
VideoConferenceDisabledVideoconference or video identification is not configured on the instance
IssueTypeDoesNotAllowStartValidationstartValidation was requested for an issue type that does not allow it

ICP-Brasil checks​

CodeWhen it happens
RfbQueryNotApprovedThe instance runs the RFB prior query when the order is created, and the query did not approve the holder's data. The message includes the reason returned by the query
RfbQueryNameMismatchThe name in the order is different from the name returned by the RFB query. Use the name returned by the query
RfbQueryOrganizationNameMismatchThe company name in the order is different from the one returned by the RFB query. Use the name returned by the query
RfbQueryIsDisabledThe RFB prior query API was called, but the RFB query is not configured on the instance
PSBioDisabledThe biometric enrollment check was called, but the biometric integration is not configured on the instance

Holder documents​

CodeWhen it happens
HolderFilesRequired, MissingRequiredHolderFileTypeA document required by the holder type is missing, or the photo, when the certificate type has the biometrics step enabled. The message lists the missing types
InvalidHolderFileTypeA document type does not exist. Custom document types must be prefixed with @
HolderFileTypeCannotBeAddedThe holder type does not accept one of the document types sent
CertificateTypeDoesNotAllowDocumentsDocuments were sent for a certificate type with the documents step disabled
UnexpectedHolderFileSubtypeThe document type does not accept subtypes, or does not accept the given subtype
MissingRequiredDocumentPartsubtype was given without documentPart
UnexpectedDocumentPartThe documentPart is not allowed for the subtype

Existing orders​

CodeWhen it happens
OrderNotFoundNo order with the given number exists
CannotCancelOrderThe order cannot be canceled because it is already issued, revoked or canceled
OrderCannotUpdateThe order's data can no longer be changed because of its status, for example once it is waiting issue
InvalidOrderStatusThe operation is not allowed in the order's current status
InvalidIssueTypeA preapproved order operation was called on an order that is not preapproved
IssueKey1DisabledIssue key 1 was requested, but the instance uses a single issue key
note

The codes above are the ones most commonly returned by the APIs in this guide. The list is not comprehensive: other codes exist, and new codes may be added at any time without notice. Handle unknown codes as a generic failure, and log the message.

See also​

View as Markdown