Fluxos para Desenvolvedores
Construa com a REST API e Webhooks do MyCaly
Entenda como os endpoints do MyCaly se conectam para reservas de horários, inscrições em webinars, sincronização de contatos CRM e webhooks assinados.
Evite explorar dezenas de endpoints isolados. Escolha um fluxo real abaixo, veja a cadeia de requisição e resposta e teste ao vivo na nossa documentação interativa.
https://courses.mycaly.io/api/v1
- JSON REST API v1 (60 req/min)
- Autenticação Bearer Sanctum
- Webhooks assinados com HMAC-SHA256
curl -X POST "https://courses.mycaly.io/api/v1/auth/login" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"email": "you@company.com",
"password": "your-password",
"device_name": "CRM Integration"
}'
# Include the returned token on protected endpoints:
# Authorization: Bearer 1|9xK3...token_hash
Gere um token pessoal em API e Webhooks (ou via POST /api/v1/auth/login) e envie no cabeçalho Bearer em rotas protegidas.
Como autenticação e endpoints se conectam
Rotas protegidas exigem token Bearer em um plano com acesso à REST API, enquanto rotas públicas permitem widgets de agendamento no frontend.
Crie seu token de API
Gere tokens pessoais no painel em API e Webhooks ou crie programaticamente com POST /api/v1/auth/tokens.
Envie autorização Bearer
Inclua Authorization: Bearer <token> e Accept: application/json nas chamadas protegidas. Todas respondem com { success, message, data }.
Endpoints públicos para clientes
Use GET /events/{id}/available-slots e POST /webinars/{id}/register direto em formulários sem expor chaves privadas.
Siga as cadeias de requisição ponta a ponta
Selecione um fluxo e clique em cada etapa para ver como IDs e horários seguem de um endpoint ao próximo.
Crie uma experiência de agendamento personalizada
Carregue seus tipos de evento ativos, consulte horários livres para uma data e crie, reagende ou cancele o compromisso.
curl -X GET "https://courses.mycaly.io/api/v1/events?per_page=10" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
{
"success": true,
"message": "Events retrieved successfully.",
"data": {
"events": [
{
"id": 12,
"name": "30-Min Consultation",
"event_link": "30-min-consultation",
"slot_time": 30,
"event_location": 2,
"status": true,
"share_url": "/s/ali/30-min-consultation"
}
],
"pagination": { "total": 1, "per_page": 10, "current_page": 1, "last_page": 1 }
}
}
curl -X GET "https://courses.mycaly.io/api/v1/events/12/available-slots?date=2026-12-10&timezone=America/New_York" \
-H "Accept: application/json"
{
"success": true,
"message": "Available slots retrieved successfully.",
"data": {
"event_id": 12,
"event_name": "30-Min Consultation",
"slot_duration_minutes": 30,
"date": "2026-12-10",
"slots": [
"09:00 AM - 09:30 AM",
"10:00 AM - 10:30 AM",
"02:00 PM - 02:30 PM"
]
}
}
curl -X POST "https://courses.mycaly.io/api/v1/bookings" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"event_id": 12,
"schedule_date": "2026-12-10",
"slot_time": "09:00 AM - 09:30 AM",
"name": "Alex Rivera",
"email": "alex@example.com",
"phone_number": "+14155550140"
}'
{
"success": true,
"message": "Appointment booked successfully.",
"data": {
"id": 408,
"uuid": "8f3c2e10-7b1d-4d62-a210-91b7c4f0192e",
"event_id": 12,
"schedule_date": "2026-12-10",
"slot_time": "09:00 AM - 09:30 AM",
"status": 1,
"status_text": "Booked",
"source": "api",
"meeting": {
"meeting_url": "https://meethour.io/room-408",
"meeting_id": "mh_408"
}
}
}
POST /bookings/{id}/reschedule
POST /bookings/{id}/cancel
Automatize webinars ao vivo e inscrições
Crie eventos de webinar, inscreva visitantes direto pela sua landing page e gerencie participantes pela API.
curl -X POST "https://courses.mycaly.io/api/v1/webinars" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "Product Launch Live Q&A",
"event_link": "launch-qa",
"slot_time": 60,
"event_location": 2,
"schedule_from": "2026-12-15 14:00:00",
"schedule_to": "2026-12-15 15:00:00"
}'
{
"success": true,
"message": "Webinar created successfully.",
"data": {
"id": 54,
"name": "Product Launch Live Q&A",
"event_link": "launch-qa",
"schedule_from": "2026-12-15 14:00:00",
"schedule_to": "2026-12-15 15:00:00",
"slot_time": 60,
"status": true,
"share_url": "/s/ali/launch-qa"
}
}
PATCH /webinars/{id}/status
curl -X POST "https://courses.mycaly.io/api/v1/webinars/54/register" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "Sara Kim",
"email": "sara@example.com",
"phone_number": "+14155550192"
}'
{
"success": true,
"message": "Webinar registration successful.",
"data": {
"id": 915,
"event_id": 54,
"schedule_date": "2026-12-15",
"slot_time": "10:00 AM - 11:00 AM",
"guest": {
"name": "Sara Kim",
"email": "sara@example.com",
"phone": "+14155550192"
},
"status_text": "Booked"
}
}
curl -X GET "https://courses.mycaly.io/api/v1/webinars/54/attendees?per_page=50" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
{
"success": true,
"message": "Webinar attendees retrieved successfully.",
"data": {
"webinar_id": 54,
"webinar_name": "Product Launch Live Q&A",
"attendees": [
{
"id": 915,
"schedule_date": "2026-12-15",
"guest": { "name": "Sara Kim", "email": "sara@example.com" },
"status_text": "Booked"
}
],
"pagination": { "total": 1, "per_page": 50, "current_page": 1, "last_page": 1 }
}
}
POST /webinars/{id}/attendees/{attendeeId}/cancel
Sincronize contatos e histórico de agendamentos
Pesquise contatos existentes, faça upsert por e-mail sem duplicatas e consulte o histórico de reservas vinculado.
curl -X GET "https://courses.mycaly.io/api/v1/contacts?search=alex&per_page=20" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
{
"success": true,
"message": "Contacts retrieved successfully.",
"data": {
"contacts": [
{
"id": 77,
"name": "Alex Rivera",
"email": "alex@example.com",
"phone_number": "+14155550140",
"billing_address": "123 Market St, San Francisco, CA"
}
],
"pagination": { "total": 1, "per_page": 20, "current_page": 1, "last_page": 1 }
}
}
curl -X POST "https://courses.mycaly.io/api/v1/contacts" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "Alex Rivera",
"email": "alex@example.com",
"phone_number": "+14155550140",
"billing_address": "123 Market St, San Francisco, CA"
}'
{
"success": true,
"message": "Contact saved successfully.",
"data": {
"id": 77,
"name": "Alex Rivera",
"email": "alex@example.com",
"phone_number": "+14155550140",
"billing_address": "123 Market St, San Francisco, CA"
}
}
PUT /contacts/{id}
curl -X GET "https://courses.mycaly.io/api/v1/contacts/77" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
{
"success": true,
"message": "Contact details retrieved successfully.",
"data": {
"contact": {
"id": 77,
"name": "Alex Rivera",
"email": "alex@example.com"
},
"bookings": [
{
"id": 408,
"event_id": 12,
"schedule_date": "2026-12-10",
"slot_time": "09:00 AM - 09:30 AM",
"status_text": "Booked"
}
]
}
}
Assine, teste e audite webhooks em tempo real
Registre endpoints HTTPS para reservas, webinars, contatos e pagamentos, envie um teste imediato e audite logs de entrega.
curl -X POST "https://courses.mycaly.io/api/v1/webhooks" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "CRM Listener",
"target_url": "https://api.yourapp.com/webhooks/mycaly",
"events": ["booking.created", "booking.rescheduled", "webinar.registrant_added"]
}'
{
"success": true,
"message": "Webhook subscription registered successfully.",
"data": {
"id": 9,
"name": "CRM Listener",
"target_url": "https://api.yourapp.com/webhooks/mycaly",
"secret": "a9c8f7d6e5b4...",
"events": ["booking.created", "booking.rescheduled", "webinar.registrant_added"],
"is_active": true
}
}
curl -X POST "https://courses.mycaly.io/api/v1/webhooks/9/test" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
{
"success": true,
"message": "Test webhook dispatched.",
"data": {
"id": 102,
"webhook_endpoint_id": 9,
"event_type": "endpoint.test",
"response_status": 200,
"attempt": 1,
"delivered_at": "2026-12-03T12:45:00+00:00",
"error_message": null
}
}
curl -X GET "https://courses.mycaly.io/api/v1/webhooks/9/deliveries?per_page=20" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
{
"success": true,
"message": "Delivery logs retrieved successfully.",
"data": {
"deliveries": [
{
"id": 102,
"webhook_endpoint_id": 9,
"event_type": "endpoint.test",
"response_status": 200,
"attempt": 1,
"delivered_at": "2026-12-03T12:45:00+00:00",
"error_message": null
}
],
"pagination": { "total": 1, "per_page": 20, "current_page": 1, "last_page": 1 }
}
}
Valide todo Webhook recebido com HMAC-SHA256
Todo webhook enviado inclui três cabeçalhos personalizados e um envelope JSON para validar a autenticidade antes de processar.
Cabeçalhos enviados pelo MyCaly
-
X-SignatureResumo HMAC-SHA256 em hexadecimal do corpo JSON bruto assinado com seu secret.
-
X-Event-TypeNome do evento, como booking.created, booking.rescheduled ou webinar.registrant_confirmed.
-
X-Event-IdIdentificador único do evento (evt_...) útil para controle de idempotência.
Principais eventos suportados
Assine eventos específicos ou use "*" ao registrar o endpoint.
booking.created, booking.pending_approval, booking.confirmed, booking.declined, booking.rescheduled, booking.cancelled
webinar.created, webinar.updated, webinar.registrant_added, webinar.registrant_confirmed, webinar.registrant_cancelled
contact.created, contact.updated, contact.deleted, payment.completed, payment.failed
Exemplo de validação de assinatura
Calcule o HMAC-SHA256 sobre o corpo bruto da requisição com seu secret e compare em tempo constante.
import crypto from 'node:crypto';
// Use express.raw({ type: 'application/json' }) so req.body stays unparsed
const expected = crypto
.createHmac('sha256', process.env.MYCALY_WEBHOOK_SECRET)
.update(req.body)
.digest('hex');
const signature = req.get('X-Signature') || '';
const isValid =
expected.length === signature.length &&
crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
if (!isValid) return res.status(401).send('Invalid webhook signature');
const payload = JSON.parse(req.body.toString('utf8'));
$rawBody = file_get_contents('php://input');
$headerSignature = $_SERVER['HTTP_X_SIGNATURE'] ?? '';
$expected = hash_hmac('sha256', $rawBody, $webhookSecret);
if (! hash_equals($expected, $headerSignature)) {
http_response_code(401);
exit('Invalid webhook signature');
}
$event = json_decode($rawBody, true);
// Process $event['id'], $event['event'], $event['data']
{
"id": "evt_7f8e9d10c2b3a4f5e6d7c8b9",
"event": "booking.created",
"timestamp": "2026-12-03T12:45:00+00:00",
"data": {
"id": 408,
"event_id": 12,
"schedule_date": "2026-12-10",
"slot_time": "09:00 AM - 09:30 AM",
"guest": {
"name": "Alex Rivera",
"email": "alex@example.com"
},
"source": "api"
}
}
Perguntas comuns sobre API e Webhooks
Onde crio e gerencio tokens de API e webhooks?
Entre no seu painel MyCaly e abra API e Webhooks na barra lateral em Integrações. Você pode criar/revogar tokens e gerenciar webhooks lá ou via /api/v1.
Quais endpoints não exigem token Bearer?
POST /api/v1/auth/login, GET /api/v1/events/{id}/available-slots e POST /api/v1/webinars/{id}/register são públicos para que widgets de reserva e formulários funcionem sem expor tokens privados.
Quais são os limites de requisição e requisitos de plano?
O limite padrão é de 60 requisições por minuto por usuário/IP (retorna HTTP 429 se excedido). Rotas protegidas /api/v1 e webhooks exigem um plano com acesso API / Webhooks habilitado.
Como meu servidor deve verificar os webhooks do MyCaly?
Leia o corpo HTTP bruto antes de reserializar o JSON, calcule o HMAC-SHA256 com o secret do endpoint e compare com o cabeçalho X-Signature usando hash_equals (PHP) ou crypto.timingSafeEqual (Node.js).
Sua agenda não deveria atrasar você.
Agende de forma mais inteligente com o MyCaly. Conecte suas agendas, defina suas regras de preço e comece a receber reservas de clientes hoje mesmo.
- Agendamento inteligente
- Pagamentos diretos
- Reuniões em vídeo HD