Skip to main content

Todoist API Python Client

This is the official Python SDK for the Todoist API.

Installation

pip install todoist-api-python

Or add the project as a dependency in pyproject.toml:

dependencies = [
  "todoist-api-python>=3.1.0,<4",
]

Supported Python Versions

Python version 3.10 and above.

Usage

Here's an example of initializing the API client, fetching a task, and paginating through its comments:

from todoist_api_python.api import TodoistAPI

api = TodoistAPI("YOUR_API_TOKEN")

task = api.get_task("6X4Vw2Hfmg73Q2XR")
print(f"Task: {task.content}")

comments_iter = api.get_comments(task_id=task.id)
for comments in comments_iter:
    for comment in comments:
        print(f"Comment: {comment.content}")

Async usage

Always close TodoistAPIAsync explicitly, either via async with (recommended) or by calling await api.close().

from todoist_api_python.api_async import TodoistAPIAsync

async with TodoistAPIAsync("YOUR_API_TOKEN") as api:
    task = await api.get_task("6X4Vw2Hfmg73Q2XR")
    print(task.content)

Documentation

For more detailed reference documentation, have a look at the SDK documentation and the API documentation.

Migrating from 3.x

Version 4.x introduces a breaking HTTP stack migration from requests to httpx.

  • TodoistAPI(..., session=...) is now TodoistAPI(..., client=...) with httpx.Client.
  • TodoistAPIAsync(..., session=...) is now TodoistAPIAsync(..., client=...) with httpx.AsyncClient.
  • Error handling should catch httpx.HTTPStatusError instead of requests.exceptions.HTTPError.

Development

To install Python dependencies:

$ uv sync

To install pre-commit:

$ uv run pre-commit install

You can try your changes via REPL by running:

$ uv run python

You can then import the library as described in Usage without having to create a file. If you decide to use TodoistAPIAsync, please keep in mind that you have to import asyncio and run asyncio.run(yourmethod()) to make your async methods run as expected.

Releases

This API client is public, and available in a PyPI repository.

A new update is automatically released by GitHub Actions, by creating a release with a tag in the format vX.Y.Z (v<Major>.<Minor>.<Patch>).

Users of the API client can then update to the new version in their pyproject.toml file.

Feedback

Any feedback, bugs, questions, comments, etc., can be reported as Issues in this repository.

Contributions

We would love contributions! Pull requests are welcome.

Release files for todoist_api_python 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for todoist_api_python 4.0.0
File Size Uploaded
todoist_api_python-4.0.0.tar.gz 24.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for todoist_api_python 4.0.0
File Interpreter ABI Platform
todoist_api_python-4.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 53.2 kB

Release files / todoist_api_python-4.0.0.tar.gz

Download URL todoist_api_python-4.0.0.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2e8acbaa4ea7aae05a640bd24690ca020ef8044610b0dcf4df85b8a788a43872
BLAKE2b-256 checksum
How to use checksums
0c43a3dcb178937026abbb8a7d8f7ddd86d8c390f3752766dfc26c072684d5b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.11

Release files / todoist_api_python-4.0.0-py3-none-any.whl

Download URL todoist_api_python-4.0.0-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b435f5fbf48da2faf7cb846a0de3b6719a33461958512d2adb4546494c195de
BLAKE2b-256 checksum
How to use checksums
f0437728ffb2118934a0b356316adfd0bc564400b1844ca804c24ecab2be424e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.11

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.1.7

2 release files

2.1.6

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page