[
    {
        "role": "user",
        "content": "How%20do%20I%20get%20my%20todoist%20token%20api%20for%20running%20in%20an%20app%3F"
    },
    {
        "role": "assistant",
        "content": "To use the Todoist API in your app, you\u2019ll need to grab your API token (sometimes called \u201cpersonal token\u201d) or use OAuth if you're making a public integration. Here\u2019s how to get your token (for your own account) and the difference if you\u2019re building an app for others.\n\n---\n\n## 1. Personal API Token (for your own account)\n\nIf you're just using the API yourself (not asking others to authorize your app), this is the easiest method.\n\n1. Go to the Todoist website and log in via your browser.  \n2. Click your avatar (top left).  \n3. Select **Settings**.  \n4. Go to the **Integrations** tab.  \n5. Click **Developer**.  \n6. Under **Developer**, you\u2019ll find your **API token**. Click *Copy API token*. ([lp-regional-test.todoist.com](https://lp-regional-test.todoist.com/help/todoist/integrations/find-your-api-token-Jpzx9IIlB?utm_source=openai))\n\nIf you want, you can also issue a brand-new token (e.g. if you believe it\u2019s compromised or want to revoke access everywhere). There is an \u201cIssue a new API token\u201d action. ([lp-regional-test.todoist.com](https://lp-regional-test.todoist.com/help/todoist/integrations/find-your-api-token-Jpzx9IIlB?utm_source=openai))\n\n---\n\n## 2. Using OAuth (for apps other people use or publish)\n\nIf you're building an integration you\u2019ll share or distribute (for teams, users, etc.), Todoist uses OAuth 2.0 so that each user grants your app specific access. The process is:\n\n- Register your app via the Todoist **App Management Console** \u2192 get a **Client ID** and **Client Secret**. ([developer.todoist.com](https://developer.todoist.com/api/v1/?utm_source=openai))  \n- Redirect users to the authorization URL (`/oauth/authorize`) where they log in and accept permissions (scopes). ([developer.todoist.com](https://developer.todoist.com/api/v1/?utm_source=openai))  \n- After they accept, your app gets back an authorization code via your redirect URI.  \n- You exchange that code for an access token (and, depending on setup, a refresh token) using `/oauth/access_token`. ([developer.todoist.com](https://developer.todoist.com/api/v1/?utm_source=openai))  \n\nThis way each user gets their own token. Tokens usually expire (often in an hour). If refresh tokens are enabled, you can use the refresh token to get a new access token without having the user go through the login flow again. ([developer.todoist.com](https://developer.todoist.com/api/v1/?utm_source=openai))\n\n---\n\n## 3. Accessing the Token in Code\n\nFor personal token-based workflows:\n\n- Store the token securely (e.g. environment variable, OS keychain, encrypted storage).\n- When making an API REST call, add this HTTP header:  \n  `Authorization: Bearer YOUR_API_TOKEN`  \n  Replace `YOUR_API_TOKEN` with your actual token. ([developer.todoist.com](https://developer.todoist.com/rest/v1/?shell=&utm_source=openai))\n\nFor OAuth:\n\n- Once you have the access token, use it similarly with `Authorization: Bearer ACCESS_TOKEN`.\n- When the access token expires, use the refresh token with your client ID/secret to get a new one. ([developer.todoist.com](https://developer.todoist.com/api/v1/?utm_source=openai))\n\n---\n\nIf you tell me whether your app is only for your own use or you plan to share it with others, I can help you decide whether personal token or OAuth is right and guide you on implementing it in your language of choice."
    }
]