Criar hash de consulta (assíncrono)
curl --request POST \
--url https://public-usuario-api.autorize.com.br/api/hash-consulta/async \
--header 'Api-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"templateId": "<string>",
"isConsentimento": true,
"idPgccConsentimento": "<string>",
"cnpjAnuente": "<string>",
"dataExpiracao": "2023-11-07T05:31:56Z",
"cpfOperador": "<string>"
}
'import requests
url = "https://public-usuario-api.autorize.com.br/api/hash-consulta/async"
payload = {
"templateId": "<string>",
"isConsentimento": True,
"idPgccConsentimento": "<string>",
"cnpjAnuente": "<string>",
"dataExpiracao": "2023-11-07T05:31:56Z",
"cpfOperador": "<string>"
}
headers = {
"Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
templateId: '<string>',
isConsentimento: true,
idPgccConsentimento: '<string>',
cnpjAnuente: '<string>',
dataExpiracao: '2023-11-07T05:31:56Z',
cpfOperador: '<string>'
})
};
fetch('https://public-usuario-api.autorize.com.br/api/hash-consulta/async', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public-usuario-api.autorize.com.br/api/hash-consulta/async",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'templateId' => '<string>',
'isConsentimento' => true,
'idPgccConsentimento' => '<string>',
'cnpjAnuente' => '<string>',
'dataExpiracao' => '2023-11-07T05:31:56Z',
'cpfOperador' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public-usuario-api.autorize.com.br/api/hash-consulta/async"
payload := strings.NewReader("{\n \"templateId\": \"<string>\",\n \"isConsentimento\": true,\n \"idPgccConsentimento\": \"<string>\",\n \"cnpjAnuente\": \"<string>\",\n \"dataExpiracao\": \"2023-11-07T05:31:56Z\",\n \"cpfOperador\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://public-usuario-api.autorize.com.br/api/hash-consulta/async")
.header("Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"templateId\": \"<string>\",\n \"isConsentimento\": true,\n \"idPgccConsentimento\": \"<string>\",\n \"cnpjAnuente\": \"<string>\",\n \"dataExpiracao\": \"2023-11-07T05:31:56Z\",\n \"cpfOperador\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-usuario-api.autorize.com.br/api/hash-consulta/async")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"templateId\": \"<string>\",\n \"isConsentimento\": true,\n \"idPgccConsentimento\": \"<string>\",\n \"cnpjAnuente\": \"<string>\",\n \"dataExpiracao\": \"2023-11-07T05:31:56Z\",\n \"cpfOperador\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"sucesso": true,
"isPgccErro": true,
"pgccCodigoErro": "Continue",
"mensagem": "<string>",
"data": {
"hash": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}HashConsulta
Criar hash de consulta (assíncrono)
Mesmo contrato do POST api/hash-consulta. O hash é devolvido assim que é assinado e gravado; o registro na PGCC acontece logo em seguida, de forma assíncrona. Quando isConsentimento for true e idPgccConsentimento for informado, o hash é gerado vinculado ao consentimento identificado pelo ID do consentimento no PGCC. Caso contrário, o hash é gerado sem vínculo com consentimento. O campo tempoProcessamentoMs (e o header Server-Timing) informa o tempo de processamento dentro da API, em ms, sem a rede entre o cliente e o servidor: a diferença para o tempo medido pelo cliente é a latência de rede.
POST
/
api
/
hash-consulta
/
async
Criar hash de consulta (assíncrono)
curl --request POST \
--url https://public-usuario-api.autorize.com.br/api/hash-consulta/async \
--header 'Api-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"templateId": "<string>",
"isConsentimento": true,
"idPgccConsentimento": "<string>",
"cnpjAnuente": "<string>",
"dataExpiracao": "2023-11-07T05:31:56Z",
"cpfOperador": "<string>"
}
'import requests
url = "https://public-usuario-api.autorize.com.br/api/hash-consulta/async"
payload = {
"templateId": "<string>",
"isConsentimento": True,
"idPgccConsentimento": "<string>",
"cnpjAnuente": "<string>",
"dataExpiracao": "2023-11-07T05:31:56Z",
"cpfOperador": "<string>"
}
headers = {
"Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
templateId: '<string>',
isConsentimento: true,
idPgccConsentimento: '<string>',
cnpjAnuente: '<string>',
dataExpiracao: '2023-11-07T05:31:56Z',
cpfOperador: '<string>'
})
};
fetch('https://public-usuario-api.autorize.com.br/api/hash-consulta/async', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public-usuario-api.autorize.com.br/api/hash-consulta/async",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'templateId' => '<string>',
'isConsentimento' => true,
'idPgccConsentimento' => '<string>',
'cnpjAnuente' => '<string>',
'dataExpiracao' => '2023-11-07T05:31:56Z',
'cpfOperador' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public-usuario-api.autorize.com.br/api/hash-consulta/async"
payload := strings.NewReader("{\n \"templateId\": \"<string>\",\n \"isConsentimento\": true,\n \"idPgccConsentimento\": \"<string>\",\n \"cnpjAnuente\": \"<string>\",\n \"dataExpiracao\": \"2023-11-07T05:31:56Z\",\n \"cpfOperador\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://public-usuario-api.autorize.com.br/api/hash-consulta/async")
.header("Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"templateId\": \"<string>\",\n \"isConsentimento\": true,\n \"idPgccConsentimento\": \"<string>\",\n \"cnpjAnuente\": \"<string>\",\n \"dataExpiracao\": \"2023-11-07T05:31:56Z\",\n \"cpfOperador\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-usuario-api.autorize.com.br/api/hash-consulta/async")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"templateId\": \"<string>\",\n \"isConsentimento\": true,\n \"idPgccConsentimento\": \"<string>\",\n \"cnpjAnuente\": \"<string>\",\n \"dataExpiracao\": \"2023-11-07T05:31:56Z\",\n \"cpfOperador\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"sucesso": true,
"isPgccErro": true,
"pgccCodigoErro": "Continue",
"mensagem": "<string>",
"data": {
"hash": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Body
application/jsontext/jsonapplication/*+json
Response
OK
Available options:
Continue, SwitchingProtocols, Processing, EarlyHints, OK, Created, Accepted, NonAuthoritativeInformation, NoContent, ResetContent, PartialContent, MultiStatus, AlreadyReported, IMUsed, MultipleChoices, MovedPermanently, Found, SeeOther, NotModified, UseProxy, Unused, TemporaryRedirect, PermanentRedirect, BadRequest, Unauthorized, PaymentRequired, Forbidden, NotFound, MethodNotAllowed, NotAcceptable, ProxyAuthenticationRequired, RequestTimeout, Conflict, Gone, LengthRequired, PreconditionFailed, RequestEntityTooLarge, RequestUriTooLong, UnsupportedMediaType, RequestedRangeNotSatisfiable, ExpectationFailed, MisdirectedRequest, UnprocessableEntity, Locked, FailedDependency, UpgradeRequired, PreconditionRequired, TooManyRequests, RequestHeaderFieldsTooLarge, UnavailableForLegalReasons, InternalServerError, NotImplemented, BadGateway, ServiceUnavailable, GatewayTimeout, HttpVersionNotSupported, VariantAlsoNegotiates, InsufficientStorage, LoopDetected, NotExtended, NetworkAuthenticationRequired