Todoist.Net
11.2.0
See the version list below for details.
dotnet add package Todoist.Net --version 11.2.0
NuGet\Install-Package Todoist.Net -Version 11.2.0
<PackageReference Include="Todoist.Net" Version="11.2.0" />
<PackageVersion Include="Todoist.Net" Version="11.2.0" />
<PackageReference Include="Todoist.Net" />
paket add Todoist.Net --version 11.2.0
#r "nuget: Todoist.Net, 11.2.0"
#:package Todoist.Net@11.2.0
#addin nuget:?package=Todoist.Net&version=11.2.0
#tool nuget:?package=Todoist.Net&version=11.2.0
Todoist.Net
A Todoist API client for .NET.
Upgrading from 10.x? Version 11.0.0 moves to the unified Todoist API v1 and renames much of the public surface (
Items→Tasks,Notes→Comments, and more). See the 11.0.0 release notes for the full migration table.
Installation
The library is available as a Nuget package.
Install-Package Todoist.Net
Get started
Creating Todoist client
ITodoistClient client = new TodoistClient("API token");
OAuth with refresh tokens
Applications authorized through Todoist OAuth get an access token which expires after an hour, and a refresh token to get a new one. The client refreshes the tokens on its own before they expire, or when Todoist rejects the access token, and sends the request again.
Todoist rotates the refresh token on every refresh, so the previous one stops working. Store the tokens passed to
the callback every time it is called, or the user will have to authorize the application again.
The OAuth types live in the Todoist.Net.OAuth namespace.
var options = new TodoistOAuthOptions
{
ClientId = "CLIENT_ID",
ClientSecret = "CLIENT_SECRET"
};
var tokens = new TodoistTokens(accessToken, refreshToken, expiresAt);
using var client = new TodoistClient(options, tokens, refreshedTokens => tokenStore.SaveAsync(userId, refreshedTokens));
When two clients of the same user refresh with the same refresh token at once, Todoist gives the new refresh token to the first one only. The second one gets the access token alone and does not call the callback, so it never overwrites the stored refresh token.
Create clients from the stored tokens when you need them instead of keeping several long-lived clients for the same user. A client holding a refresh token another client has already used, which refreshes more than a minute later, looks like a replay attack to Todoist: it revokes all the tokens of the user, who has to authorize the application again.
The tokens can also be refreshed ahead of time, and the access token revoked (revoking requires the client secret):
var refreshedTokens = await client.RefreshTokensAsync();
await client.RevokeTokensAsync();
Todoist can revoke access tokens only, so the refresh token keeps working after RevokeTokensAsync. Delete the stored
tokens to give up the access for good; the authorization ends when the user removes the application in the Todoist settings.
Dependency injection
AddTodoistClient registers ITodoistClientFactory, which creates clients on top of IHttpClientFactory.
Configure the OAuth application to create clients with the tokens of each user through ITodoistOAuthClientFactory:
services.AddTodoistClient(options =>
{
options.ClientId = configuration["Todoist:ClientId"];
options.ClientSecret = configuration["Todoist:ClientSecret"];
});
public class TodoistSync(ITodoistOAuthClientFactory clientFactory, ITokenStore tokenStore)
{
public async Task SyncAsync(string userId)
{
var tokens = await tokenStore.GetAsync(userId);
// The callback captures the user, so the refreshed tokens are stored for the right one.
using var client = clientFactory.CreateClient(tokens, refreshedTokens => tokenStore.SaveAsync(userId, refreshedTokens));
var projects = await client.Projects.GetAsync();
}
}
Clients created with an API token keep working as before:
using var client = serviceProvider.GetRequiredService<ITodoistClientFactory>().CreateClient("API token");
Quick add
Implementation of the Quick Add Task available in the official clients.
var quickAddTask = new QuickAddTask("Task title @Label1 #Project1 +ExampleUser");
var task = await client.Tasks.QuickAddAsync(quickAddTask);
Simple API calls
// Get all resources (labels, projects, tasks, comments etc.).
var resources = await client.SyncResourcesAsync();
// Get only projects and labels.
var projectsAndLabels = await client.SyncResourcesAsync(new[] { ResourceType.Projects, ResourceType.Labels });
// Get only projects.
var projectsOnly = await client.SyncResourcesAsync(new[] { ResourceType.Projects });
// Alternatively you can use this API to get projects.
var projects = await client.Projects.GetAsync();
// Add a task with a comment.
var taskId = await client.Tasks.AddAsync(new AddTask("New task"));
await client.Comments.AddToTaskAsync(new Comment("Task description"), taskId);
Transactions (Batching)
Batching: reading and writing of multiple resources can be done in a single HTTP request.
Add a new project, task and comment in one request.
// Create a new transaction.
var transaction = client.CreateTransaction();
// These requests are queued and will be executed later.
var projectId = await transaction.Projects.AddAsync(new AddProject("New project"));
var taskId = await transaction.Tasks.AddAsync(new AddTask("New task", projectId));
await transaction.Comments.AddToTaskAsync(new Comment("Task description"), taskId);
// Execute all the requests in the transaction in a single HTTP request.
await transaction.CommitAsync();
Sending null values when updating entities.
When updating entities, Todoist API only updates properties included in the request body, using a PATCH request style.
That's why all properties with null values are not included by default, to allow updating without fetching the entity first,
since including null properties will update them to null.
However, if you want to intentionally send a null value to the API, you need to use the Unset extension method, for example:
// This code removes a task's due date.
var task = new UpdateTask("TASK_ID");
task.Unset(t => t.DueDate);
await client.Tasks.UpdateAsync(task);
| 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 was computed. 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 is compatible. 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. |
-
.NETFramework 4.6.2
- Microsoft.CSharp (>= 4.7.0)
- System.Text.Json (>= 10.0.4)
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Http (>= 10.0.4)
- System.Text.Json (>= 10.0.4)
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 | |
|---|---|---|---|
| 12.0.0 | 78 | 10/16/2026 | |
| 11.2.0 | 97 | 10/6/2026 | |
| 11.1.0 | 123 | 9/2/2026 | |
| 11.0.0 | 104 | 9/2/2026 | |
| 11.0.0-beta.1 | 3,051 | 2/13/2026 | |
| 10.0.0 | 5,981 | 10/22/2025 | |
| 9.0.0 | 615 | 2/3/2025 | |
| 8.1.0 | 246 | 1/25/2025 | |
| 8.0.0 | 3,402 | 7/10/2024 | |
| 7.0.0 | 539 | 6/3/2024 | |
| 6.1.0 | 861 | 2/5/2024 | |
| 6.0.0 | 732 | 11/1/2023 | |
| 5.1.0 | 2,200 | 8/31/2023 | |
| 5.0.0 | 922 | 4/2/2023 | |
| 4.0.0 | 1,175 | 12/27/2022 | |
| 3.0.1 | 1,906 | 10/10/2022 | |
| 3.0.0 | 1,262 | 10/10/2022 | |
| 2.2.2 | 1,719 | 12/21/2021 | |
| 2.2.1 | 1,171 | 12/20/2021 | |
| 2.2.0 | 4,313 | 11/25/2021 |