Question

Schedule an event from API

  • 24 October 2023
  • 10 replies
  • 631 views

I'm writing to see if you can help me.
I'm currently working on integrating Calendly with a mobile app and website. For this I am using the Calendly API with great results so far.
I have an account with an organization and a user invited to that account.
I am trying to find in the API document the query to make in order to schedule an appointment for that user based on a certain event.
Now I can access the user's data and their available times, but I can't find the query to schedule an event.
I hope you can help me with my problem to find the information I need in the documentation.
Thank you so much


This topic has been closed for comments

10 replies

Userlevel 2

Hello! We don't currently have a way to schedule events via the API directly, but we do recommend that developers use our embed options to allow scheduling from another application.
 
In the case of a mobile application, developers have had success adding the embed code into a WebView or equivalent.
 
I'd recommend checking out this page in our Developer Portal for more information on dynamically using our embed code, based on a link you have retrieved from the API.
 
If you are using the list event type available times endpoint, you will be able to pass the scheduling_url for a time slot to the embed code too. This will embed the final page of the booking flow (where the invitee enters their name, email, and any custom questions). You can also pre-fill these questions by passing a prefill object, although please note that these questions will be editable to the invitee.

calling event_types works for me, but when i call event_type_available_times with query:

 

{
  event_type: 'https://api.calendly.com/users/HIDDENID',
  start_time: '2023-10-26T02:02:54.664Z',
  end_time: '2023-11-09T02:02:54.664Z'
}

i get invalid resource

 

ive double checked my event is active

is this because im using free account?

Userlevel 2

calling event_types works for me, but when i call event_type_available_times with query:

 

{
  event_type: 'https://api.calendly.com/users/HIDDENID',
  start_time: '2023-10-26T02:02:54.664Z',
  end_time: '2023-11-09T02:02:54.664Z'
}

i get invalid resource

 

ive double checked my event is active

is this because im using free account?

 

You should be able to call this endpoint on any account tier - no paid subscription is needed!

When looking at your example request above, I see that the example URI you provided was https://api.calendly.com/users/HIDDENID, which is the URI of a user. An event type URI will be formatted like https://api.calendly.com/event_types/HIDDENID instead.

You mentioned that you’ve been able to call the list event types endpoint successfully, so just ensure that you are using the exact URI of one of the event types that was returned in that call. This can be found on the uri property of each event type in the collection.

hi, good spot, my mistake,

 

i checked using uri now:
https://api.calendly.com/event_types/XXX and i makesure its active,

but still getting the same error

Userlevel 2

I also just noticed that you’re requesting a range of two weeks in total. Currently, the maximum range you can call at once is one week/7 days.

When retrieving larger periods of availability for an event type, you’ll need to make multiple calls to the endpoint.

I hope trying this will resolve your error!

 

Edit: Just updating the thread because we resolved the issue in a ticket! The request works with the active event type’s URI and a 7 day range when the values are included in query parameters.

@marion-calendly - I have a similar problem. Any help would be appreciated. Thanks.

https://api.calendly.com/event_type_available_times/?event_type=https://api.calendly.com/event_types/XXXXXXXXXX&start_time=2023-11-06T00:00:00.000000Z&end_time=2023-11-10T23:59:00.000000Z

Where XXXXXXXXXX is the URI from the event, which is active. 

I keep getting: 

{

"title": "Invalid Argument",

"message": "The supplied parameters are invalid."

}

I did get a successful response yesterday, left it as is, came back to Postman today, did the exact same call, just hit send, and now get the same error. Nothing has changed, so there is something wrong.

Userlevel 2

Hi @Cesar24375

You mentioned that you got a different result for the same response, so I think the issue may be that the start_time was in the past by the time you made the call the second time.

You will see the invalid parameters error if either of the time parameters are in the past, as well as a case where an invalid range is specified.

Could you please try to update your parameters to a future time in UTC to see if you’re able to successfully make the call again?

Hi @marion-calendly - Indeed, it was the start_time. I was able to sort it out right before you posted. But do appreciate you taking the time to respond. 

I did have an unrelated question. What is the easiest way to get the URI of an Event? Right now, I am looking by user, and then then grabbing the URI. This means I need to sort through several users in order to find all the events I want to target via the API. 

Userlevel 6

Hey @Cesar24375! Mind creating a new topic for your unrelated question? We’re working hard to keep threads like this focused on just one theme or topic so it doesn’t get too confusing for anyone else looking to use the information in here.

Thank you!

Hi @jillian! Of course, just created a new topic:

Thanks.