ClockifyClient 1.2.8
dotnet add package ClockifyClient --version 1.2.8
NuGet\Install-Package ClockifyClient -Version 1.2.8
<PackageReference Include="ClockifyClient" Version="1.2.8" />
<PackageVersion Include="ClockifyClient" Version="1.2.8" />
<PackageReference Include="ClockifyClient" />
paket add ClockifyClient --version 1.2.8
#r "nuget: ClockifyClient, 1.2.8"
#:package ClockifyClient@1.2.8
#addin nuget:?package=ClockifyClient&version=1.2.8
#tool nuget:?package=ClockifyClient&version=1.2.8
Clockify Client
This project provides a strongly-typed C# client for interacting with the Clockify time tracking API. The client is automatically generated from Clockify's OpenAPI specification using Microsoft Kiota, ensuring type safety and up-to-date API coverage.
Prerequisites
- .NET Standard 2.0 / .NET 8.0 or later
- Clockify API key (Get your API key)
Installation
Get the ClockifyClient package from NuGet:
dotnet add package ClockifyClient
Usage
using ClockifyClient;
// Initialize the client with your API key
var client = ClockifyApiClientFactory.Create("your-api-key-here");
// Get user information
var user = await client.User.GetAsync();
Console.WriteLine($"Hello, {user.Name}!");
// Get workspaces
var workspaces = await client.Workspaces.GetAsync();
foreach (var workspace in workspaces)
{
Console.WriteLine($"Workspace: {workspace.Name}");
}
// Get active times for the active workspace
var timeEntries = await client.V1.Workspaces[user.ActiveWorkspace].TimeEntries.Status.InProgress.GetAsync();
Error Handling
The client provides structured error handling:
try
{
var user = await client.User.GetAsync();
}
catch (ApiException ex)
{
Console.WriteLine($"API Error: {ex.ResponseStatusCode} - {ex.Message}");
}
catch (HttpRequestException ex)
{
Console.WriteLine($"Network Error: {ex.Message}");
}
Inspect Request & Response Bodies
Sometimes it's not enough to just know that the request failed, but you want to inspect the actual data sent or received.
var timeEntryRequest = new CreateTimeEntryRequest
{
Description = "Important Work!",
Start = DateTimeOffset.utcNow,
};
var inspectionOptions = new BodyInspectionHandlerOption
{
InspectRequestBody = true,
InspectResponseBody = true
};
try
{
await _clockifyClient.V1.Workspaces[workspaceId].TimeEntries.PostAsync(timeEntryRequest, c => c.Options.Add(inspectionOptions));
}
catch (ApiException ex)
{
Console.WriteLine($"API Error: {ex.ResponseStatusCode} - {ex.Message}");
using var streamRequestReader = new StreamReader(inspectionOptions.RequestBody);
Console.WriteLine(await streamRequestReader.ReadToEndAsync());
using var streamResponseReader = new StreamReader(inspectionOptions.ResponseBody);
Console.WriteLine(await streamResponseReader.ReadToEndAsync());
}
Development
Generating the Client
The client is generated using Microsoft Kiota. To regenerate the client:
# Install Kiota CLI
dotnet tool install --global Microsoft.OpenApi.Kiota
# Download the latest OpenAPI specification
curl -o clockify-openapi.json https://docs.clockify.me/openapi.json
# Apply modifications, see below
# Generate the client from OpenAPI spec
kiota generate --language CSharp --openapi clockify-openapi.json --class-name ClockifyApiClient --namespace-name ClockifyClient --output ClockifyClient --structured-mime-types application/json
Modifications
The OpenAPI specification provided by Clockify doesn't work out of the box with Kiota and requires some modifications.
Fix Cyclic Dependency
Remove a cyclic dependency, by deleting the self-reference from
"FeaturePlan": {
"type": "object",
"oneOf": [
{
"$ref": "#/components/schemas/FeaturePlan"
}
],
...
to
"FeaturePlan": {
"type": "object",
...
Fixing Enum Types
Replace the following part of the specification
"adminOnlyPages": {
"type": "string",
"description": "Represents a unique list of protected page enums.",
"example": "[\"PROJECT\",\"TEAM\",\"REPORTS\"]",
"enum": [
"PROJECT",
"TEAM",
"REPORTS"
]
},
with this part instead
"adminOnlyPages": {
"type": "array",
"description": "Represents a unique list of protected page enums.",
"items": {
"type": "string",
"enum": ["PROJECT", "TEAM", "REPORTS"]
},
"example": "[\"PROJECT\", \"TEAM\", \"REPORTS\"]"
},
Remove the (outer) default property value for ImportTimeEntriesAndExpensesRequestV1.expenseFieldsForDetailedGroup.
Fixing Media Types
Replace occurrences of */* with application/json.
Except for the file / export endpoints that use byte as format, namely:
/v1/workspaces/{workspaceId}/expenses/{expenseId}/files/{fileId}/v1/workspaces/{workspaceId}/invoices/{invoiceId}/export
For example, like this:
"responses": { "200": { "content": { "*/*": { "schema": { "$ref": "#/components/schemas/TimeEntrySummaryReportDto" } } }, "description": "OK" } },
"responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TimeEntrySummaryReportDto" } } }, "description": "OK" } },
License
This project is licensed under the MIT License - see the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Kiota.Bundle (>= 1.22.2)
-
net8.0
- Microsoft.Kiota.Bundle (>= 1.22.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.8 | 0 | 5/7/2026 |
| 1.2.7 | 0 | 5/7/2026 |
| 1.2.6 | 110 | 3/23/2026 |
| 1.2.5 | 107 | 3/4/2026 |
| 1.2.4 | 106 | 2/26/2026 |
| 1.2.3 | 120 | 2/7/2026 |
| 1.2.2 | 212 | 1/23/2026 |
| 1.2.1 | 195 | 1/22/2026 |
| 1.1.21 | 126 | 1/22/2026 |
| 1.1.20 | 240 | 12/19/2025 |
| 1.1.18 | 241 | 12/19/2025 |
| 1.1.17 | 151 | 12/12/2025 |
| 1.1.16 | 215 | 11/26/2025 |
| 1.1.15 | 213 | 11/25/2025 |
| 1.1.14 | 422 | 11/20/2025 |
| 1.1.13 | 427 | 11/19/2025 |
| 1.1.12 | 431 | 11/19/2025 |
| 1.1.11 | 423 | 11/18/2025 |
| 1.1.10 | 354 | 11/17/2025 |
| 1.1.9 | 220 | 11/15/2025 |