# Update Document — Linear (API key)

> Update an existing Linear document: rename it, rewrite its body, move it to another project, initiative, team or issue, change its owner, or change its icon or color. Only the fields you provide are changed; set at least one besides…

- Key: `linear_app-update-document`
- Type: Action (Write)
- Version: 0.0.2
- App: Linear (API key) (`linear_app`) — https://pipedream.com/apps/linear-app.md
- This page (HTML): https://pipedream.com/apps/linear-app/actions/update-document
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/linear_app/actions/update-document/update-document.mjs

## Description

Update an existing Linear document: rename it, rewrite its body, move it to another project, initiative, team or issue, change its owner, or change its icon or color. Only the fields you provide are changed; set at least one besides `documentId`. **`content` replaces the whole body.** To append to or edit part of a document, first read the current body with **Get Document**, then send the full combined markdown. Leave `content` unset for a rename so the body is kept. To move the document, set at most one of `projectId`, `initiativeId`, `teamId` or `issueId`. Use **Search Documents** to find the document ID. To create a new document, use **Create Document**. The response does not echo the body back; use **Get Document** to read it. Example (rename): `documentId: "10b5bc2940c7"`, `title: "[DRAFT] Q3 Hiring Plan"` → returns `{success: true, document: {id: "29a25062-...", title: "[DRAFT] Q3 Hiring Plan", slugId: "10b5bc2940c7", url: "https://linear.app/..."}}`. Example (replace body): `documentId: "10b5bc2940c7"`, `content: "# Q3 Hiring Plan\n\nUpdated goals..."`. [See the documentation](https://studio.apollographql.com/public/Linear-API/variant/current/schema/reference/objects/Mutation?query=documentUpdate)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `documentId` | `string` | Yes | The UUID or slugId of the document. A UUID looks like a1b2c3d4-0000-0000-0000-000000000001; a slugId is the short alphanumeric code at the end of the document URL (e.g. 10b5bc2940c7). Use Search Documents to find document IDs. |
| `title` | `string` | No | The new title of the document. Example: Q3 Hiring Plan (final). |
| `content` | `string` | No | The new document body in markdown. Replaces the existing body in full. To keep existing text, read it first with Get Document and send the combined markdown. Example: # Q3 Hiring Plan\n\nUpdated goals.... |
| `projectId` | `string` | No | Move the document to this project (UUID or identifier, e.g. a1b2c3d4-0000-0000-0000-000000000001 or P-LIN-123). Set at most one of projectId, initiativeId, teamId or issueId. Use List Projects to find valid project IDs. |
| `initiativeId` | `string` | No | Move the document to this initiative (UUID or identifier, e.g. b2c3d4e5-0000-0000-0000-000000000002 or I-12). Set at most one of projectId, initiativeId, teamId or issueId. Use List Initiatives to find valid initiative IDs. |
| `teamId` | `string` | No | Move the document to this team (UUID, e.g. 9d1c3f7e-2b48-4c6a-9f1e-5a7b8c9d0e1f). The short team key such as ENG is rejected. Set at most one of projectId, initiativeId, teamId or issueId. Use Get Teams to find valid team IDs. |
| `issueId` | `string` | No | Move the document to this issue (UUID or identifier, e.g. 7df5e7f9-a357-4539-ae94-4a004fec635f or ENG-123). Set at most one of projectId, initiativeId, teamId or issueId. Use Search Issues to find valid issues. |
| `ownerId` | `string` | No | The UUID of the user to make the document owner (e.g. abc12345-0000-0000-0000-000000000001). Use List Users to find valid user IDs. |
| `icon` | `string` | No | The new document icon, as an emoji shortcode. Raw emoji such as 📄 are rejected. Example: :page_facing_up:. |
| `color` | `string` | No | The new icon color, as a hex code. Example: #5e6ad2. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "linear_app",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "linear_app-update-document",
  arguments: {
    documentId: "Document ID",
    title: "Title",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "linear_app-update-document",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    linear_app: { authProvisionId: "apn_xxxxxxx" },
    documentId: "Document ID",
    title: "Title",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "linear_app-update-document",
    "configured_props": {
      "linear_app": { "authProvisionId": "apn_xxxxxxx" },
      "documentId": "Document ID",
      "title": "Title"
    }
  }'
```

---

- App: https://pipedream.com/apps/linear-app.md · All apps: https://pipedream.com/apps
