curl --request POST \
--url https://api.bydoctor.com.br/api/public/v1/appointments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"appointment_type_id": 123,
"patient_id": 123,
"professional_id": 123,
"start_at": "2023-11-07T05:31:56Z",
"note": "<string>",
"room_id": 123
}
'import requests
url = "https://api.bydoctor.com.br/api/public/v1/appointments"
payload = {
"appointment_type_id": 123,
"patient_id": 123,
"professional_id": 123,
"start_at": "2023-11-07T05:31:56Z",
"note": "<string>",
"room_id": 123
}
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({
appointment_type_id: 123,
patient_id: 123,
professional_id: 123,
start_at: '2023-11-07T05:31:56Z',
note: '<string>',
room_id: 123
})
};
fetch('https://api.bydoctor.com.br/api/public/v1/appointments', 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/appointments",
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([
'appointment_type_id' => 123,
'patient_id' => 123,
'professional_id' => 123,
'start_at' => '2023-11-07T05:31:56Z',
'note' => '<string>',
'room_id' => 123
]),
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/appointments"
payload := strings.NewReader("{\n \"appointment_type_id\": 123,\n \"patient_id\": 123,\n \"professional_id\": 123,\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"room_id\": 123\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/appointments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"appointment_type_id\": 123,\n \"patient_id\": 123,\n \"professional_id\": 123,\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"room_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bydoctor.com.br/api/public/v1/appointments")
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 \"appointment_type_id\": 123,\n \"patient_id\": 123,\n \"professional_id\": 123,\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"room_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"appointment_type": {
"id": 123,
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"end_at": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modality": "in_person",
"origin": "staff",
"patient": {
"id": 123,
"name": "<string>",
"phone": "<string>"
},
"professional": {
"id": 123,
"name": "<string>",
"specialty": "<string>"
},
"room": {
"id": 123,
"name": "<string>"
},
"start_at": "2023-11-07T05:31:56Z",
"status": "requested",
"updated_at": "2023-11-07T05:31:56Z"
}Criar um agendamento
Cria um agendamento presencial com status: "scheduled" e origin: "api", no tipo de atendimento informado em appointment_type_id (veja GET /appointment-types) e com o pagador Particular do profissional; o valor vem da tabela de preços da clínica. Requer o escopo appointments:write. Envie Idempotency-Key para poder repetir a chamada com segurança. Responde 409 com code slot_blocked (horário bloqueado na agenda do profissional) ou room_required (a clínica exige sala e a grade do profissional não tem sala padrão para o horário). O corpo da resposta é o mesmo objeto de GET.
curl --request POST \
--url https://api.bydoctor.com.br/api/public/v1/appointments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"appointment_type_id": 123,
"patient_id": 123,
"professional_id": 123,
"start_at": "2023-11-07T05:31:56Z",
"note": "<string>",
"room_id": 123
}
'import requests
url = "https://api.bydoctor.com.br/api/public/v1/appointments"
payload = {
"appointment_type_id": 123,
"patient_id": 123,
"professional_id": 123,
"start_at": "2023-11-07T05:31:56Z",
"note": "<string>",
"room_id": 123
}
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({
appointment_type_id: 123,
patient_id: 123,
professional_id: 123,
start_at: '2023-11-07T05:31:56Z',
note: '<string>',
room_id: 123
})
};
fetch('https://api.bydoctor.com.br/api/public/v1/appointments', 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/appointments",
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([
'appointment_type_id' => 123,
'patient_id' => 123,
'professional_id' => 123,
'start_at' => '2023-11-07T05:31:56Z',
'note' => '<string>',
'room_id' => 123
]),
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/appointments"
payload := strings.NewReader("{\n \"appointment_type_id\": 123,\n \"patient_id\": 123,\n \"professional_id\": 123,\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"room_id\": 123\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/appointments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"appointment_type_id\": 123,\n \"patient_id\": 123,\n \"professional_id\": 123,\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"room_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bydoctor.com.br/api/public/v1/appointments")
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 \"appointment_type_id\": 123,\n \"patient_id\": 123,\n \"professional_id\": 123,\n \"start_at\": \"2023-11-07T05:31:56Z\",\n \"note\": \"<string>\",\n \"room_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"appointment_type": {
"id": 123,
"name": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"end_at": "2023-11-07T05:31:56Z",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modality": "in_person",
"origin": "staff",
"patient": {
"id": 123,
"name": "<string>",
"phone": "<string>"
},
"professional": {
"id": 123,
"name": "<string>",
"specialty": "<string>"
},
"room": {
"id": 123,
"name": "<string>"
},
"start_at": "2023-11-07T05:31:56Z",
"status": "requested",
"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 agendamento. O agendamento nasce presencial, com
status: "scheduled" e origin: "api", no tipo informado e com o pagador
Particular do profissional; o valor vem da tabela de preços da clínica.
id de um tipo de atendimento ativo da clínica (GET /appointment-types).
patient.id de um paciente ativo da clínica.
professional.id de um profissional ativo da clínica que atende pacientes.
Início do atendimento, ISO 8601. Sem fuso horário, é lido em America/Sao_Paulo. Os segundos devem ser 00.
Observação interna do agendamento, até 2000 caracteres.
2000room.id de uma sala ativa. Omitido, usa a sala padrão da grade do profissional, se houver.
Response
Tipo de atendimento do agendamento, como "Consulta" ou "Retorno".
Show child attributes
Show child attributes
in_person- Presencialtelehealth- Teleconsulta
in_person, telehealth staff- Equipepatient_booking- Agendamento onlineapi- API pública
staff, patient_booking, api Paciente do agendamento.
Show child attributes
Show child attributes
Profissional responsável pelo atendimento.
Show child attributes
Show child attributes
Sala em que o atendimento acontece, quando a clínica usa salas.
Show child attributes
Show child attributes
One of: requested, scheduled, confirmed, checked_in, completed, no_show, cancelled.
requested, scheduled, confirmed, checked_in, completed, no_show, cancelled