Skip to main content
POST
/
messaging
/
api
/
v1
/
services
/
mfa
Iniciando o Serviço
curl --request POST \
  --url https://api.valid.com/messaging/api/v1/services/mfa \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "channel": "<string>",
  "contact": [
    "<string>"
  ],
  "externalId": "<string>"
}
'
import requests

url = "https://api.valid.com/messaging/api/v1/services/mfa"

payload = {
"channel": "<string>",
"contact": ["<string>"],
"externalId": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({channel: '<string>', contact: ['<string>'], externalId: '<string>'})
};

fetch('https://api.valid.com/messaging/api/v1/services/mfa', 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",
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([
'channel' => '<string>',
'contact' => [
'<string>'
],
'externalId' => '<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"

payload := strings.NewReader("{\n \"channel\": \"<string>\",\n \"contact\": [\n \"<string>\"\n ],\n \"externalId\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", 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.post("https://api.valid.com/messaging/api/v1/services/mfa")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"channel\": \"<string>\",\n \"contact\": [\n \"<string>\"\n ],\n \"externalId\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.valid.com/messaging/api/v1/services/mfa")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channel\": \"<string>\",\n \"contact\": [\n \"<string>\"\n ],\n \"externalId\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body

Request Body

channel
string
required
Canal de comunicação com usuário, atualmente os canais disponíveis são: SMS ou EMAIL.Exemplo: SMS
contact
string[]
Baseado no canal de comunicação aqui dever inserido o número de telefone ou e-mail.Exemplo: ["+55119912341234", "mail@mail.com"]
externalId
string
Identificador utilizado no sistema externo, usado de forma opcional para relacionar o processo de MFA com um processo cliente.Exemplo: 05be75cc-8f8a-414a-891f-434aa9b4e7a5

Response

Retorna de forma síncrona os dados do processo de MFA criado.

Exemplo de sucesso (201 Created)

{
  "requestId": "12c54b67-e89d-4a12-b345-678901234567",
  "status": "PENDING",
  "createdAt": "2024-01-01T00:00:00.000Z"
}