Skip to main content
This quickstart walks you through the end-to-end flow of connecting to the ByDoctor API for the first time. By the end you will have a working API key, a list of appointments, a newly created booking, and an active webhook subscription — all in under five minutes.
1

Create a ByDoctor account

If you don’t already have an account, sign up for free at app.bydoctor.com.br/auth/sign-up. Complete the clinic onboarding flow to provision your tenant. You need an active clinic account before you can issue API keys or access any data.
The account you create during sign-up is automatically assigned the Admin role, which is required to generate API keys.
2

Generate your API key

In your ByDoctor dashboard, navigate to Settings → API and click New API Key. Name it something descriptive like quickstart-test, select the read and write scopes, and click Create.Copy the key immediately — it is shown only once. Store it as an environment variable for the commands below:
All subsequent examples read from this variable so you never have to paste the key directly into a command.
3

List your appointments

Fetch the list of appointments for your clinic with a GET request to /appointments. The response is a paginated array of appointment objects.
A successful response looks like this:
Use the query parameters starts_at and ends_at to filter appointments by date range, and professional_id to scope results to a specific doctor. For example: GET /appointments?starts_at=2024-08-01&ends_at=2024-08-31.
4

Create your first appointment

Send a POST request to /appointments with the required fields. The starts_at and ends_at fields must be ISO 8601 timestamps with a timezone offset.
On success, the API returns 201 Created with the full appointment object:
The status field starts as "scheduled" when you create an appointment programmatically. The lifecycle values are:
5

Set up a webhook

Register a webhook endpoint to receive real-time notifications whenever an appointment is created. Send a POST request to /webhooks with your listener URL and the events you want to subscribe to.
The API responds with 201 Created and your new webhook registration:
From now on, ByDoctor will send a signed POST request to your URL each time a new appointment is created. Use the secret field to verify the webhook signature and confirm that payloads originate from ByDoctor.
Store the webhook secret securely. ByDoctor includes a signature in the X-ByDoctor-Signature header of every delivery — always validate it before processing the payload.

Next Steps

You’ve made your first API calls and have a live webhook running. Explore the rest of the documentation to go deeper.

Explore the Data Model

Understand how clinics, professionals, patients, and appointments relate to each other in ByDoctor’s multi-tenant data structure.

Set Up Webhooks

Learn every available event type, how to validate webhook signatures, and best practices for building reliable event consumers.

API Reference

Browse the full reference for the Appointments resource — all query parameters, request body fields, and response schemas.

Scheduling Integration Guide

Follow a step-by-step guide to building a two-way sync between ByDoctor’s calendar and an external scheduling system.