Fetch user calendar slots availability via API

I was planning to use YCBM APIs to find out “Calendar” Slots a user is offering up in you can book me - required to build some analytics on top of this data.
Specifically, I would like to know for a specific user which are her free slots (available slots based on their calendar availability).

Is there any specific API that I can use for that? I was not really lucky to find the right endpoint.

Thanks

@nicor88 you can check on more information with the API here:
https://ycbm.stoplight.io/

for this you will need to GET the teamMember Ids from the profile you are looking to get the free times for.

with this:
https://api.youcanbook.me/v1/profiles/{profileId}?fields=teamMembers,teamMembers.items,teamMembers.items.name,teamMembers.items.id

Then you will need to POST to create an intent with these selections:
https://api.youcanbook.me/v1/intents
{
“subdomain” :“{pageSubdomain}”,
“selections” : {
“teamMemberId” : “{teamMemberId}”}
}

Once you have this intent made you can take the returned intentId and run a GET here:
https://api.youcanbook.me/v1/intents/{intentId}/availabilitykey

Then once you have the availabilityKey use that with a GET here:
https://api.youcanbook.me/v1/availabilities/{availbilityKey}

This will return the Unix timestamp of availability based off of the selections you have made in the intent.

Once you have the time you can create the booking by running a PATCH here:
https://api.youcanbook.me/v1/intents/{intentId}/selections

Add in your startsAt with the unix stamp and any form question that need to be answered:
{“form” : [ {
“id” : “LNAME”,
“value” : “Test”
}, {
“id” : “EMAIL”,
“value” : “ben@domain.com
}, {
“id” : “FNAME”,
“value” : “Ben”
} ],
“startsAt” : {unixTimeStamp}
}

Then run an empty PATCH to https://api.youcanbook.me/v1/intents/{intentId}/confirm

Thanks really helpful.
I was indeed using the page https://ycbm.stoplight.io/ to understand how can do the above, but I got a bit lost.

Alight, overall the answer make sense.
But I’m just unsure about the step where I have to create an “intent”, could you explain to me what exactly an intent? Bear in mind that I’m interested on a read only use case, so I’m afraid that creating an intent I will modify an existing entities in YCBM, and that’s not my intention.

At the end of then day I just care about getting availability, and not create any booking.

Thanks

@nicor88 intents act as preselections and options for a booking and are not an actual booking, so if you only need to get read only data you would POST to the intents endpoint with the teamMemberId and then run through to get the availabilityKey for that intent, this will show you when that specific team member is available. You do not need to add a form and confirm the booking if you aren’t looking to make a booking programmatically.

@Ben thanks, after playing a bit more with APIs I got what an intent is.

Is it possible to get availability in the past?
I was adding

params = {
    'startSearchAt': '2024-06-01',
}

as GET parameter for availabilitykey API request, but I always get availabilities in the future.

As we are interested on availability in the past, I put a startSearchAt in the past, but I get availabilities in the future. Is even possible to get past availabilities?

No, there is not a way to get past availability. The concept of availability on our side is a snap shot at a certain time that is requested. We don’t have a way via the API to pull in any information from the past.