npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

todoist-rest-api

v1.3.4

Published

A full-featured node.js wrapper for Todoist REST API

Downloads

8

Readme

Todoist REST API

Build and release Coverage Status CodeFactor npm (tag) npm David GitHub GitHub Release Date

A full-featured node.js wrapper for Todoist REST API

Install

$ npm install todoist-rest-api

Usage

import todoist from 'todoist-rest-api';
// or const todoist = require('todoist-rest-api').default;

const api = todoist('1234567890abcdef1234567890abcdef12345678');
const tasks = await api.v1.task.findAll();

API

If you want to know more about specific types see types.ts or read the API docs from Todoist.

todoist

function todoist(token: string) => TodoistRESTAPI

token

Type: string
*required

An API token.

Example:

import todoist from 'todoist-rest-api';

const api = todoist('1234567890abcdef1234567890abcdef12345678');

TodoistRESTAPI

interface TodoistRESTAPI {
  v1: TodoistRESTV1;
  // v2 when the API is updated
}

TodoistRESTAPIV1

export interface TodoistRESTV1 {
  task: TaskAdapter;
  project: ProjectAdapter;
  label: LabelAdapter;
  comment: CommentAdapter;
  section: SectionAdapter;
}

Example:

import todoist from 'todoist-rest-api';

const api = todoist('1234567890abcdef1234567890abcdef12345678');
const taskAdapter = api.v1.task;
const projectAdapter = api.v1.project;
const labelAdapter = api.v1.label;
const commentAdapter = api.v1.comment;
const sectionAdapter = api.v1.section;

TaskAdapter (instance)

class TaskAdapter {
  public async find(id: number) => TodoistTask
  public async findAll(options?: {
    project_id?: number;
    label_id?: number;
    filter?: string;
    lang?: string;
  }) => TodoistTask[]
  public async create(task: TodoistTaskOptions) => TodoistTask
  public async update(id: number, task: TodoistTaskOptions) => boolean
  public async close(id: number) => boolean
  public async reopen(id: number) => boolean
  public async remove(id: number) => boolean
}

Example:

import todoist from 'todoist-rest-api';

const api = todoist('1234567890abcdef1234567890abcdef12345678');
let task;
// Or use top-level await if that's available to you
(async () => {
  task = await api.v1.task.find(1).catch(error => {
    // Handle error
  });

  // Do something with task
})();

ProjectAdapter (instance)

class ProjectAdapter {
  public async find(id: number) => TodoistProject
  public async findAll() => TodoistProject[]
  public async create(project: TodoistProjectOptions) => TodoistProject
  public async update(id: number, project: TodoistProjectOptions) => boolean
  public async remove(id: number) => boolean
}

Example:

import todoist from 'todoist-rest-api';

const api = todoist('1234567890abcdef1234567890abcdef12345678');
let project;
// Or use top-level await if that's available to you
(async () => {
  project = await api.v1.project
    .create({ name: 'Next Actions' })
    .catch(error => {
      // Handle error
    });

  // Do something with project
})();

LabelAdapter (instance)

class LabelAdapter {
  public async find(id: number) => TodoistLabel
  public async findAll() => TodoistLabel[]
  public async create(label: TodoistLabelOptions) => TodoistLabel
  public async update(id: number, label: TodoistLabelOptions) => boolean
  public async remove(id: number) => boolean
}

Example:

import todoist from 'todoist-rest-api';

const api = todoist('1234567890abcdef1234567890abcdef12345678');
let label;
// Or use top-level await if that's available to you
(async () => {
  label = await api.v1.label.update(3, { name: 'amsterdam' }).catch(error => {
    // Handle error
  });

  // Do something with label
})();

CommentAdapter (instance)

class CommentAdapter {
  public async find(id: number) => TodoistComment
  public async findAll({
    id,
    parent,
  }: {
    id: number;
    parent: 'task' | 'project';
  }) => TodoistComment[]
  public async create(comment: TodoistCommentOptions) => TodoistComment
  public async update(id: number, comment: TodoistCommentOptions) => boolean
  public async remove(id: number) => boolean
}

Example:

import todoist from 'todoist-rest-api';

const api = todoist('1234567890abcdef1234567890abcdef12345678');
let comment;
// Or use top-level await if that's available to you
(async () => {
  comment = await api.v1.comment
    .findAll({ id: 2, parent: 'task' })
    .catch(error => {
      // Handle error
    });

  // Do something with comment
})();

SectionAdapter (instance)

class SectionAdapter {
  public async find(id: number) => TodoistSection
  public async findAll() => TodoistSection[]
  public async create(section: TodoistSectionOptions) => TodoistSection
  public async update(id: number, section: TodoistSectionOptions) => boolean
  public async remove(id: number) => boolean
}

Example:

import todoist from 'todoist-rest-api';

const api = todoist('1234567890abcdef1234567890abcdef12345678');
// Or use top-level await if that's available to you
(async () => {
  await api.v1.section.remove(13).catch(error => {
    // Handle error
  });
})();

Changelog

View CHANGELOG.md

Contributing

Instructions

  • Fork and clone the repo

    git clone https://github.com/YOUR-USERNAME/todoist-rest-api

  • Install dependencies

    npm install

Build

Create a new build with

npm run build

Run tests

Run AVA test suite with:

npm run test

OR

npm run test:prod

Commits

For commits I follow the angular commit guidelines and use semantic release to automate builds, semver version updates and changelog creation. The way to make sure this all works is to run:

npm run commit

Which guides you through the motions

License

License MIT © Martien Oranje