> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Wrike plugin

> Work management with Wrike - search and manage tasks, work with folders and projects, log and read time entries, comment on tasks, and read contacts and account settings.

Use **Wrike** through Corsair: one client, typed API calls.

Create a permanent access token in Wrike under **Apps & Integrations → API**, or use an OAuth 2.0 token. It goes in `Authorization: bearer`, lowercase as Wrike's own docs write it, against `/api/v4`.

* **Three regional hosts.** Wrike runs the same v4 API on `www.wrike.com`, `app-eu.wrike.com` and `app-us2.wrike.com`, and an account lives on exactly one. Nothing in a token says which, so pass `host: 'eu'` or `'us2'`; the default is `www`. A test asserts the routing.
* **Both auth failures are a 401 `not_authorized`.** The `errorDescription` is what separates them: `Authorization method unknown` means no header was sent at all, and `Access token is unknown or invalid` means one was sent and is wrong. Both are auth errors, but the distinction tells you whether a credential was configured.
* **There is no account-level task create.** A task always lives in a folder, so `tasks.create` takes a `folderId` and posts to `/folders/{folderId}/tasks`. For the account root, use the `rootFolderId` that `account.get` returns — it is a virtual folder, which is why reading the account once is worth doing.
* **Every response is `{ kind, data: [...] }`.** Even a single task comes back inside an array, so the output schemas unwrap by index rather than pretending a get returns one object.
* **Ids carry a prefix.** `IEAA…` is a task, `IEA…` a folder, `KU…` a contact, `TL…` a timelog. The prefix is part of the id and is never stripped or rewritten.
* **List filters are JSON arrays.** `status`, `responsibles` and `authors` go in the query string as JSON (`status=["Active"]`); Wrike refuses a comma-joined value as invalid, so the plugin encodes the array for you. Date filters take a date or a `start,end` range.
* **Folder paging needs a filter.** With no filter `folders.list` returns the whole folder tree, which Wrike does not page; set `project`, `title` or `permalink` to page with `pageSize` and `nextPageToken`. Comments and contacts have no paging: `comments.list` takes a `limit` instead.
* **Dates go in one `dates` object.** Wrike has no top-level start or due parameter, so `startDate` and `dueDate` on `tasks.create` and `tasks.update` are folded into `dates`; `dates: { type: 'Backlog' }` clears a schedule.
* **A task delete is recoverable.** Wrike moves it to the recycle bin, and `tasks.update` with `restore: true` brings it back — which is why it is destructive but undoable.
* **A folder delete takes its contents with it.** Wrike moves the folder and every folder and task inside it to the recycle bin unless they have parents outside the deleted folder. There is no flag that refuses a non-empty folder. Check `folders.tasks` first if that matters.
* **A timelog needs `trackedDate`, `hours` and `comment`.** The date is the day the work belongs to, not when it was entered, and `hours` is what every report totals. Wrike requires the comment, though it may be empty.
* **Comments are plain text.** The plugin sends `plainText: true`, so Wrike strips HTML tags instead of rendering them, and the text comes back as written. A comment can be edited only in the 5 minutes after it is posted.
* **No webhooks here.** Wrike has REST routes for webhooks, but this plugin does not implement them.

**What you get:**

* 23 typed API operations

## Setup

**1. Install**

```bash npm theme={null}
npm install corsair @corsair-dev/wrike better-sqlite3
npm install --save-dev @types/better-sqlite3
```

```bash yarn theme={null}
yarn add corsair @corsair-dev/wrike better-sqlite3
yarn add --dev @types/better-sqlite3
```

```bash pnpm theme={null}
pnpm install corsair @corsair-dev/wrike better-sqlite3
pnpm install --save-dev @types/better-sqlite3
```

```bash bun theme={null}
bun add corsair @corsair-dev/wrike better-sqlite3
bun add --dev @types/better-sqlite3
```

**2. Add the plugin**

```ts corsair.ts theme={null}
import Database from 'better-sqlite3';
import { createCorsair } from 'corsair';
import { wrike } from '@corsair-dev/wrike';

export const corsair = createCorsair({
	plugins: [
		wrike(),
	],
	database: new Database('corsair.db'),
	kek: process.env.CORSAIR_KEK!,
	multiTenancy: true,
	hub: {
		projectApiKey: process.env.CORSAIR_API_KEY!,
		signingSecret: process.env.CORSAIR_SIGNING_SECRET!,
	},
});
```

With `multiTenancy: true`, scope calls with `corsair.withTenant(id)`. See [Quick start](https://docs.corsair.dev/quick-start.md) for KEK + Hub keys, and [Multi-tenancy](https://docs.corsair.dev/concepts/multi-tenancy.md) for account isolation.

**3. Choose authentication**

> [tab] API Key (Recommended)
>
> No setup required yet. When you make your first request as a tenant, Corsair prompts for the API key.
>
> ```ts theme={null}
> wrike()
> ```
>
> More: [API Key](https://docs.corsair.dev/concepts/api-key)

**4. Connect a tenant**

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see [Connect / OAuth](https://docs.corsair.dev/management/connect).

```ts theme={null}
const { connectUrl } = await corsair.manage.connect.createLink({
	plugin: 'wrike',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**Page through active tasks**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.wrike.api.tasks.list({ pageSize: 25 });
```

**Create a task in a folder**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.wrike.api.tasks.create({ folderId: 'IEAABCDEF12345', title: 'Ship the new checkout' });
```

See the full list on the [API](https://docs.corsair.dev/plugins/wrike/api.md) page.

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/wrike/api.md)
>
> Every `wrike.api.*` operation with input and output types.

> [card] [Connect / OAuth](https://docs.corsair.dev/management/connect)
>
> createLink, Hub delivery, and tenant connect flows.

> [card] [Use with agents](https://docs.corsair.dev/mcp-adapters/mcp-adapters)
>
> Expose this plugin's operations as MCP tools.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.