API
Validando Código
PUT
/
messaging
/
api
/
v1
/
services
/
mfa
/
{requestId}
/
validate
Validando Código
curl --request PUT \
--url https://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"code": "<string>"
}
'import requests
url = "https://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate"
payload = { "code": "<string>" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>'})
};
fetch('https://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate', 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://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate"
payload := strings.NewReader("{\n \"code\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-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.put("https://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyRequest Body
Código contendo 6 dígitos recebido no canal de comunicação utilizado.Exemplo:
000000Response
Verifica se o código enviado é válido.Exemplo de sucesso (200 Ok)
{
"requestId": "12c54b67-e89d-4a12-b345-678901234567",
"externalId": "a32b4e32-b32b-4e32-b32b-4e32b32b4e32",
"status": "APPROVED",
"channel": "<sms ou email>",
"contact": "+5511912341234"
}
Exemplo de erro (422 Unprocessable Entity )
{
"message": "<text>"
}
Exemplo de erro (410 Gone)
{
"message": "<text>",
"status": "EXPIRED"
}
⌘I
Validando Código
curl --request PUT \
--url https://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"code": "<string>"
}
'import requests
url = "https://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate"
payload = { "code": "<string>" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>'})
};
fetch('https://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate', 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://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate"
payload := strings.NewReader("{\n \"code\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-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.put("https://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.valid.com/messaging/api/v1/services/mfa/{requestId}/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body