curl --request POST \
--url https://api.bydoctor.com.br/api/public/v1/patients \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"birth_date": "2023-12-25",
"cpf": "<string>",
"email": "jsmith@example.com",
"phone": "<string>"
}
'import requests
url = "https://api.bydoctor.com.br/api/public/v1/patients"
payload = {
"name": "<string>",
"birth_date": "2023-12-25",
"cpf": "<string>",
"email": "jsmith@example.com",
"phone": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
birth_date: '2023-12-25',
cpf: '<string>',
email: 'jsmith@example.com',
phone: '<string>'
})
};
fetch('https://api.bydoctor.com.br/api/public/v1/patients', 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.bydoctor.com.br/api/public/v1/patients",
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([
'name' => '<string>',
'birth_date' => '2023-12-25',
'cpf' => '<string>',
'email' => 'jsmith@example.com',
'phone' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.bydoctor.com.br/api/public/v1/patients"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"birth_date\": \"2023-12-25\",\n \"cpf\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.bydoctor.com.br/api/public/v1/patients")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"birth_date\": \"2023-12-25\",\n \"cpf\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bydoctor.com.br/api/public/v1/patients")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"birth_date\": \"2023-12-25\",\n \"cpf\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"active": true,
"created_at": "2023-11-07T05:31:56Z",
"id": 123,
"name": "<string>",
"phone": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}Criar um paciente
Cria um paciente e devolve o objeto com o id a usar como patient_id em POST /appointments. Requer o escopo patients:write. Envie Idempotency-Key para poder repetir a chamada com segurança. Responde 409 com code patient_cpf_exists quando outro paciente da clínica já tem o mesmo CPF: busque-o com GET /patients?cpf=. CPF, e-mail, data de nascimento e sexo são gravados, mas não voltam na resposta.
curl --request POST \
--url https://api.bydoctor.com.br/api/public/v1/patients \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"birth_date": "2023-12-25",
"cpf": "<string>",
"email": "jsmith@example.com",
"phone": "<string>"
}
'import requests
url = "https://api.bydoctor.com.br/api/public/v1/patients"
payload = {
"name": "<string>",
"birth_date": "2023-12-25",
"cpf": "<string>",
"email": "jsmith@example.com",
"phone": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
birth_date: '2023-12-25',
cpf: '<string>',
email: 'jsmith@example.com',
phone: '<string>'
})
};
fetch('https://api.bydoctor.com.br/api/public/v1/patients', 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.bydoctor.com.br/api/public/v1/patients",
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([
'name' => '<string>',
'birth_date' => '2023-12-25',
'cpf' => '<string>',
'email' => 'jsmith@example.com',
'phone' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.bydoctor.com.br/api/public/v1/patients"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"birth_date\": \"2023-12-25\",\n \"cpf\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.bydoctor.com.br/api/public/v1/patients")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"birth_date\": \"2023-12-25\",\n \"cpf\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bydoctor.com.br/api/public/v1/patients")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"birth_date\": \"2023-12-25\",\n \"cpf\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"active": true,
"created_at": "2023-11-07T05:31:56Z",
"id": 123,
"name": "<string>",
"phone": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}Authorizations
Chave de API no formato bd_live_xxxxxxxx.xxxx...
Headers
Chave opcional (até 255 caracteres) que torna a criação idempotente: repetir a mesma requisição com a mesma chave em até 24 horas devolve o registro já criado, com o cabeçalho Idempotent-Replayed: true, em vez de criar outro. A mesma chave com um corpo diferente, ou em outro endpoint, responde 422.
Body
Corpo para criar um paciente. Só name e gender são obrigatórios.
F (feminino), M (masculino) ou O (outro).
M- MF- FO- O
M, F, O Nome completo.
255Data de nascimento, AAAA-MM-DD.
Com ou sem pontuação. Validado pelo dígito.
20100Celular com DDD. Sem +, números de 10 ou 11 dígitos são lidos como brasileiros.
40Response
Paciente da clínica. CPF, e-mail, data de nascimento e sexo são aceitos na escrita, mas nunca devolvidos: por minimização de dados (LGPD, art. 6º, III), a API só retorna o necessário para agendar.