Pre-fill the holder data
After your application creates an order, it can send the holder's address, identity document and contact. In validation, the form of the validation agent opens with this data filled in.
Before you start
- An API key of an application with the Sales app role. See Application roles.
- The number of an order in the Waiting validation (
WaitingValidation) status. See Create an order. - The holder data that your application collected. No holder field is mandatory.
When you can call the API
The API accepts the call only while the order is in Waiting validation. Orders with the Presential and VideoConference issue types
start in this status. An order with the VideoIdentification issue type gets this status when the holder completes the video
identification.
After an agent starts the validation, the API rejects the call. See Common errors.
Send the holder data
Send the request to the route of the order format, with the order number in the URL. For the ICP-Brasil format, the route is
PUT /api/brazil/orders/{number}/holder/pre-fill. In .NET, call PreFillHolderAsync.
- .NET
- REST
- curl
await ampliaRegService.PreFillHolderAsync("800-005-520", new UpdateHolderInformationRequest<BrazilUpdateHolderParameters>() {
Parameters = new BrazilUpdateHolderParameters() {
Address = new BrazilHolderAddressRequest() {
ZipCode = "12345678", // Postal code (CEP), digits only
Street = "Rua das Palmeiras", // Street
Number = "120",
Complement = "Sala 4",
District = "Jardim das Flores", // District
City = "São Paulo",
StateCode = "SP", // State abbreviation
Country = "Brazil",
},
Identification = "123456789", // Identity document number
IdentificationType = BrazilIdentificationTypes.Rg, // or BrazilIdentificationTypes.Cnh
IdentificationExpediter = "SSP", // Issuing agency
IdentificationFederativeUnit = "SP", // State that issued the document
},
Contact = new ContactData() {
EmailAddress = "ana.souza@example.com", // Holder's email
Phone = "+5511999990000", // Holder's phone number, with the country code
},
});
PUT /api/brazil/orders/800-005-520/holder/pre-fill
{
"parameters": {
"address": {
"zipCode": "12345678", // Postal code (CEP), digits only
"street": "Rua das Palmeiras", // Street
"number": "120",
"complement": "Sala 4",
"district": "Jardim das Flores", // District
"city": "São Paulo",
"stateCode": "SP", // State abbreviation
"country": "Brazil"
},
"identification": "123456789", // Identity document number
"identificationType": "Rg", // or "Cnh"
"identificationExpediter": "SSP", // Issuing agency
"identificationFederativeUnit": "SP" // State that issued the document
},
"contact": {
"emailAddress": "ana.souza@example.com", // Holder's email
"phone": "+5511999990000" // Holder's phone number, with the country code
}
}
curl -X PUT "https://ampliareg.yourcompany.com/api/brazil/orders/800-005-520/holder/pre-fill" \
-H "X-Api-Key: your-app|YOUR_KEY" \
-H "Content-Type: application/json" \
--data-binary @body.json
Content of body.json:
{
"parameters": {
"address": {
"zipCode": "12345678",
"street": "Rua das Palmeiras",
"number": "120",
"complement": "Sala 4",
"district": "Jardim das Flores",
"city": "São Paulo",
"stateCode": "SP",
"country": "Brazil"
},
"identification": "123456789",
"identificationType": "Rg",
"identificationExpediter": "SSP",
"identificationFederativeUnit": "SP"
},
"contact": {
"emailAddress": "ana.souza@example.com",
"phone": "+5511999990000"
}
}
Request fields
In .NET, the request is an UpdateHolderInformationRequest<BrazilUpdateHolderParameters>.
| Field | Required | Description |
|---|---|---|
parameters | Yes | Holder data in the format of the order. It can be an empty object. See Fields of parameters |
contact | No | Holder's contact. See Fields of contact |
customerAccountId | No | ID of the customer account of the order. The account must be enabled and must belong to the certification authority of the order |
Fields of parameters in the ICP-Brasil format
In .NET, the class is BrazilUpdateHolderParameters. All fields are optional.
| Field | Description |
|---|---|
address | Holder's address. See Fields of address |
identification | Number of the holder's identity document (maximum 20 characters) |
identificationType | Type of the identity document: Rg or Cnh |
identificationExpediter | Agency that issued the identity document (maximum 10 characters) |
identificationFederativeUnit | Abbreviation of the state that issued the identity document, for example SP |
nis | Holder's NIS (PIS, PASEP or CI) number. Digits only, maximum 11 |
cei | Holder's CEI number. Digits only, maximum 12 |
caepf | Holder's CAEPF number. Digits only, maximum 14 |
Fields of address
In .NET, the class is BrazilHolderAddressRequest. All fields are optional.
| Field | Description |
|---|---|
zipCode | Postal code (CEP) with 8 digits and no hyphen |
street | Street (maximum 200 characters) |
number | Number (maximum 50 characters) |
complement | Address complement (maximum 200 characters) |
district | District (maximum 200 characters) |
city | City (maximum 100 characters) |
stateCode | State abbreviation, for example SP |
country | Country. Use Brazil, the value that the control panel writes |
Fields of contact
In .NET, the class is ContactData. All fields are optional.
| Field | Description |
|---|---|
emailAddress | Holder's email (maximum 200 characters) |
phone | Holder's phone number with the country code, for example +5511999990000 (maximum 25 characters). See Phone number validation |
alternativeEmailAddress | Holder's alternative email (maximum 200 characters) |
alternativePhone | Holder's alternative phone number, in the same format as phone |
If the holder email validation is enabled in the instance, Amplia Reg ignores the two alternative fields.
Data that the call replaces
The call writes all the fields of parameters at the same time. If the request omits a field, that field becomes empty in the order.
Always send the full set of holder data.
The contact field has a different rule. If the request omits contact, the order keeps its current contact. If the request sends
contact, the four contact fields of the order get the values that you send.
If the request omits customerAccountId, the order has no customer account after the call.
Response
The response has HTTP status 200 and no body. In .NET, PreFillHolderAsync returns no value.
Common errors
| Code | When it happens |
|---|---|
OrderNotFound | No order has the given number |
OrderAlreadyInitialized | The order left Waiting validation, for example to Waiting confirmation, or it is still in Waiting video identification |
OrderInValidationByOtherAgent | An agent started the validation. The order is in In validation or Pending |
OrderInConfirmationByOtherAgent | The order is in In confirmation |
OrderCannotUpdate | The order is in Issued, Revoked, Canceled or Declined |
InvalidState | stateCode or identificationFederativeUnit is not the abbreviation of a Brazilian state |
PrimaryEmailInUseForAnotherPerson, AlternativeEmailInUseForAnotherPerson, BothEmailsInUseForAnotherPerson | The instance allows only one person for each email address, and an email in contact belongs to a different holder |
CantChangeEmailThatIsVerified | The holder validated the email of the order, and the request sends a different emailAddress |
CannotUpdateHolderContact | The order was in Pending, and the request changes the contact |
CustomerAccountNotFound, CustomerAccountIsDisabled | The customer account in customerAccountId does not exist or is disabled |
CertificationAuthorityMismatch | The customer account belongs to a different certification authority |
If a value has an incorrect format, such as an invalid phone number, the API returns a validation error. See HTTP status codes.
Routes of the other formats
Use the route of the order format. In .NET, PreFillHolderAsync selects the route from the class of Parameters.
| Format | Route | parameters class (.NET) |
|---|---|---|
| ICP-Brasil | PUT /api/brazil/orders/{number}/holder/pre-fill | BrazilUpdateHolderParameters |
| Paraguay | PUT /api/paraguay/orders/{number}/holder/pre-fill | ParaguayUpdateHolderParameters |
| Cabo Verde | PUT /api/cabo-verde/orders/{number}/holder/pre-fill | CaboVerdeUpdateHolderParameters |
| SSL | PUT /api/ssl/orders/{number}/holder/pre-fill | SslUpdateHolderParameters |