> Calendly developer docs. For page Markdown, append .md to any URL.
> Index: https://developer.calendly.com/llms.txt
> API catalog: https://developer.calendly.com/.well-known/api-catalog
> OpenAPI: https://developer.calendly.com/openapi/calendly-api.yaml
> OAuth authorization server: https://calendly.com/.well-known/oauth-authorization-server
> MCP protected resource: https://mcp.calendly.com/.well-known/oauth-protected-resource
> Scheduling MCP endpoint: https://mcp.calendly.com
> Docs search MCP: https://developer.calendly.com/_mcp/server

# Send Scheduling Link

You may use the following combination of APIs to retrieve and send a scheduling link, as well as display the available times for a given event.

## Retrieve a scheduling link for an event

Use `GET https://api.calendly.com/event_types` to get a collection of your event types. `scheduling_url` is the link for booking the event type and `pooling_type` tells you what kind of event you will be sharing.

```ruby
require 'faraday'

token = '<your oauth token>'
user  = "https://api.calendly.com/users/<user_uuid>"

params  = { user: user }
headers = {
  'Content-Type'  => 'application/json',
  'Authorization' => "Bearer #{token}"
}

res = Faraday.get('https://api.calendly.com/event_types', params, headers)

if res.status == 200
  event_types    = JSON.parse(res.body)['collection']
  scheduling_uri = event_types[0]['scheduling_uri']
  pooling_type   = event_types[0]['pooling_type']
end
```

Example response (truncated):

```json
{
  "collection": [
    {
      ...
      "uri": "http://api.calendly.com/event_types/88323028-5ef5-448b-9776-bc0c71b062a4",
      "name": "15 Minute Meeting",
      "scheduling_url": "https://calendly.com/acmesales",
      "pooling_type": "round_robin"
      ...
    }
  ]
}
```

Return a specific event type by name:

```ruby
event_types.find { |obj| obj['name'] == 'my_event_name' }
```

Filter by pooling type (`round_robin`, `collective`, or `null`):

```ruby
event_types.find { |obj| obj['pooling_type'] == 'round_robin' }
```

## Retrieve available times for display

Using the `uri` from `GET /event_types`, get available times with `GET https://api.calendly.com/event_type_available_times`.

> **Note**
>
> `start_time` and `end_time` are required, must be in the future, and cannot span more than 31 days. Ranges longer than 31 days require additional API calls.

```ruby
require 'faraday'

params = {
  event_type: event_type_uri, # chosen from previous API response
  start_time:  '2024-02-16T24:00:00.000000Z',
  end_time:    '2024-02-20T24:00:00.000000Z'
}
headers = {
  'Content-Type'  => 'application/json',
  'Authorization' => "Bearer #{token}"
}

res = Faraday.get('http://api.calendly.com/event_type_available_times', params, headers)
```

Example response (truncated):

```json
{
  "collection": [
    {
      ...
      "status": "available",
      "start_time": "2024-02-16T24:00:00.000000Z"
      ...
    }
  ]
}
```