Skip to main content

Hello,
I'm currently working on integrating Calendly into my application, and I'm encountering an issue when trying to fetch availability schedules using the "List User Availability Schedules" API. Whenever I make the request, I get the following error message:

{
"title": "Invalid Argument",
"message": "The supplied parameters are invalid.",
"details": [
{
"parameter": "string",
"message": "string",
"code": "string"
}
]
}

Thank you in advance for your help!

Can you share the details of your request? Please don’t include any personal info or access credentials.

Are you specifying a valid value for the “user” query parameter?

I just tried reproducing the issue with my account and it worked as expected.


Thank you for the quick response!

To give you more details, here’s the flow I’m following:

  1. I’ve used OAuth to obtain the authorization code.
  2. After that, I retrieved the access token successfully.

Now, I’m trying to get the list of user availability schedules using the API endpoint nhttps://stoplight.io/mocks/calendly/api-docs/395/user_availability_schedules]. I’m passing the access token from step 2, but I’m encountering two issues:

  1. In the API documentation, it asks for a "user ID." I tried using the "Get Current User" API to fetch the ID, but I didn’t receive any user ID in the response. Could you clarify where to get the user ID from?

  2. The second issue is the error I’m getting when I try to use the "List User Availability Schedules" API. The error message returned is as follows:

import axios from "axios";

const options = {
method: 'GET',
url: 'https://stoplight.io/mocks/calendly/api-docs/395/user_availability_schedules',
params: {
user: 'user_id'
},
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer access_token'}
};

axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
{
"title": "Invalid Argument",
"message": "The supplied parameters are invalid.",
"details":
{
"parameter": "string",
"message": "string",
"code": "string"
}
]
}

 


To get the user ID for the current user, you need to make a GET call to https://api.calendly.com/users/me with your access token passed in the headers.

See the example request on https://developer.calendly.com/api-docs/005832c83aeae-get-current-user for the right format. From the dropdown you can select Node / Axios to get sample code similar to yours.

Once you get the response, grab the “uri” field, which looks like “https://api.calendly.com/users/AAAAAAAAAAAAAAAA”. That is the URI that represents your user and what you need to pass to other API calls that require a URI, such as the List User Availability Schedules API.

Once you have the URI for the user, to retrieve its availability schedules, check out the API docs at https://developer.calendly.com/api-docs/8098de44af94c-list-user-availability-schedules.

The correct endpoint for this API is https://api.calendly.com/user_availability_schedules. It seems to me that you are using the “mock server” url in your Axios request, while you want to interact with the Live Server.

In your request, make sure to pass the value of the “uri” field you grabbed in the first API call in the “user” parameter, and you should be good to go. 


Thanks for your response! It's working now.

In your reply, you mentioned that I was using the mock server URL. I tried switching to the live server URI to obtain the access token, but I encountered a 401 error. However, when I send the same request to the mock server, it works fine. Is this expected behavior?

The error message I received was:
"Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method."

I used my Calendly client account for this request.


Here is the code 

    // Base64 encode the credentials
const authHeader = `Basic ${Buffer.from(
`${CLIENT_ID}:${CLIENT_SECRET}`
).toString("base64")}`;

// Making the POST request to get the access token
const options = {
method: "POST",
url: "https://auth.calendly.com/oauth/token",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: authHeader,
},
data: {
grant_type: "authorization_code",
code: authorizationCode,
code_verifier: codeVerifier,
redirect_uri: REDIRECT_URI,
},
};

 


The mock server can be used to test requests but it doesn’t actually validate your credentials. Instead, it returns predefined responses that you can use to validate your logic. In your case, you need to interact with the live server.

The OAuth used to authenticate and authorize your users actually involves multiple steps. See https://developer.calendly.com/create-a-developer-account for the details, but essentially you have to first register your application, then initiate the OAuth authorization flow (https://developer.calendly.com/api-docs/60a14408d6743-get-authorization-code) and finally retrieve an access token (https://developer.calendly.com/api-docs/be9b32ef4b44c-get-access-token).

My guess is that you are trying to make the last call without having gone through the previous steps.

I don’t know if it applies to your use case, but another option to authenticate requests is using Personal Access Tokens, which involves a much simpler flow. See https://developer.calendly.com/when-to-choose-between-personal-access-tokens-and-oauth to understand if it can be a solution to your problem.


Thank you for the resources! I was able to successfully obtain both the access token and user details.

However, I'm encountering an error when attempting to use the Create One-Off Event Type endpoint. The error message I receive is:

Status 500

{
title: 'Internal Server Error',
message: 'The server encountered an unexpected condition that prevented it from fulfilling the request.'
}

Here is the code and data I’m using:

  const data = {
name: "My Meeting",
host: uri,
co_hosts: :],
duration: 30,
date_setting: {
type: "date_range",
start_date: "2025-2-6",
end_date: "2025-3-6",
},
location: {
kind: "physical",
location: "Main Office",
additional_info: "string",
},
};

const options = {
method: "POST",
url: "https://api.calendly.com/one_off_event_types",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${accessToken}`,
},
data,
};

 


Glad to hear that you were successful in making authenticated API calls.

Can you please open another thread for the new issue so that it is easier for us to track it and for others to contribute?


Reply