Create Time-Off Request using API


I’m encountering an unauthorized error while attempting to create a time-off request for myself using my own Clockify API key, side note I do not have administrator rights. However, I can successfully create time-off requests using the web-based Clockify platform without any issues.

To provide context, our company is integrating Slack with Clockify for leave application. We have implemented the necessary functionality and created relevant policies. However, while trying to make API calls to create time off request, I run into the unauthorized error.

I have a few questions:

  1. When creating a time off request via the API, is it necessary for each user to utilize their personal x-api-key (API key), or can we use an administrator/owner API key to make calls for everyone, since we can input userId as parameter?
    • If personal API keys are required, how can we retrieve them, are there any available API?
  2. For the policies, is it mandatory to include users and usergroup for users to apply for the time off request?
  3. What is the different between ‘Create time off request (for day policies)’ and ‘Create time off request’ in the developer api?

(Error creating time-off request)

Any insights or guidance on these queries would be greatly appreciated. Thank you in advance for your assistance.

Here is an example of the policy that was created.

Screenshot 2024-02-19 at 11.27.14 AM