---
title: "Handle Calendly OAuth callback"
method: GET
path: "/api/calendly/callback"
tags: ["Calendly"]
---

# Handle Calendly OAuth callback

`GET /api/calendly/callback`

## Request

- Base URL: `https://api.production.yourmedley.com`
- URL: `https://api.production.yourmedley.com/api/calendly/callback`
- Auth: HTTP bearer

OAuth callback endpoint that exchanges the authorization code for tokens,
validates the coach's Calendly plan (Standard+ required), stores tokens,
creates a webhook subscription, and auto-selects event types if only one exists.

## Query parameters

- `code` string, required
- `state` string, required

## Response `200`

Calendly connected successfully

- object
  - `success` boolean
  - `data` CoachCalendlySettings (unresolved $ref)

## Other responses

- `400`: Invalid code, plan validation failed, or missing parameters
- `401`: Authentication required

---

[API](https://skmtc.dev/withmedley/apis/medley-api.md) - [All operations](https://skmtc.dev/withmedley/apis/medley-api/llms.txt) - [OpenAPI document](https://skmtc.dev/withmedley/apis/medley-api/revisions/40aaac5ca6bd?raw)
