curl --request POST \
--url https://api.taximachine.com.br/api/v2/integracao/login-unico/validar \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"token": "9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03"
}
'import requests
url = "https://api.taximachine.com.br/api/v2/integracao/login-unico/validar"
payload = { "token": "9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03" }
headers = {
"Authorization": "Basic <encoded-value>",
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Basic <encoded-value>',
'api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({token: '9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03'})
};
fetch('https://api.taximachine.com.br/api/v2/integracao/login-unico/validar', 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.taximachine.com.br/api/v2/integracao/login-unico/validar",
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([
'token' => '9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"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.taximachine.com.br/api/v2/integracao/login-unico/validar"
payload := strings.NewReader("{\n \"token\": \"9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api.taximachine.com.br/api/v2/integracao/login-unico/validar")
.header("Authorization", "Basic <encoded-value>")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.taximachine.com.br/api/v2/integracao/login-unico/validar")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"token\": \"9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"tipo": "passageiro",
"id": 88231,
"bandeira_id": 1057,
"telefone": "21998765432",
"email": "ana.souza@exemplo.com"
}
}Validar login único
Troca o token do login único pelos dados do passageiro ou do condutor que abriu o site da central pelo app.
Com o login único ligado, o app abre o link da central com o parâmetro Mch-Token na URL. O servidor da central lê esse parâmetro e chama este endpoint com ele. O token vale por 60 segundos e uma vez só: a primeira validação apaga o token, e as seguintes recebem o erro 245.
O token pertence à central: a Api-Key dela e a de qualquer associada validam os tokens das pessoas da central e das associadas. O campo bandeira_id da resposta diz a central ou a associada da pessoa.
Chame este endpoint só do servidor da central. A Api-Key e a senha do usuário da API não podem ir para o navegador.
Para acessar este endpoint, o usuário autenticado deve ser um gestor da central, sem empresa vinculada, com a permissão Login único, da seção API do cargo, e a central deve ter a licença de integração via API ativa.
curl --request POST \
--url https://api.taximachine.com.br/api/v2/integracao/login-unico/validar \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"token": "9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03"
}
'import requests
url = "https://api.taximachine.com.br/api/v2/integracao/login-unico/validar"
payload = { "token": "9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03" }
headers = {
"Authorization": "Basic <encoded-value>",
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Basic <encoded-value>',
'api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({token: '9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03'})
};
fetch('https://api.taximachine.com.br/api/v2/integracao/login-unico/validar', 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.taximachine.com.br/api/v2/integracao/login-unico/validar",
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([
'token' => '9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"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.taximachine.com.br/api/v2/integracao/login-unico/validar"
payload := strings.NewReader("{\n \"token\": \"9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api.taximachine.com.br/api/v2/integracao/login-unico/validar")
.header("Authorization", "Basic <encoded-value>")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.taximachine.com.br/api/v2/integracao/login-unico/validar")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"token\": \"9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"tipo": "passageiro",
"id": 88231,
"bandeira_id": 1057,
"telefone": "21998765432",
"email": "ana.souza@exemplo.com"
}
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Obrigatório. Sua chave API.
Body
Valor do parâmetro Mch-Token da URL, sem alteração: 64 caracteres hexadecimais minúsculos.
^[0-9a-f]{64}$"9f2c4be17a0d58e3c6b2f914a7d03e5b81c6f2a94d7e0b35c8a1f6e2d4b79a03"
