# Create Task — Motion

> Create a new task. See the documentation

- Key: `motion-create-task`
- Type: Action (Write)
- Version: 0.0.2
- App: Motion (`motion`) — https://pipedream.com/apps/motion.md
- This page (HTML): https://pipedream.com/apps/motion/actions/create-task
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/motion/actions/create-task/create-task.mjs

## Description

Create a new task. [See the documentation](https://docs.usemotion.com/docs/motion-rest-api/0846d1205f9b3-create-task)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `workspaceId` | `string` | Yes | The id of the workspace. Options are loaded from the connected account. |
| `projectId` | `string` | No | The id of the project. Options are loaded from the connected account. |
| `dueDate` | `string` | No | ISO 8601 Due date on the task. REQUIRED for scheduled tasks Example: 2023-06-28T10:11:14.320-06:00 |
| `duration` | `string` | No | A duration can be one of the following... NONE, REMINDER, or a integer greater than 0. |
| `name` | `string` | Yes | Name / title of the task. |
| `description` | `string` | No | Input as GitHub Flavored Markdown. |
| `priority` | `string` | No | The level priority of the task. |
| `assigneeId` | `string` | No | The user id the task should be assigned to. Options are loaded from the connected account. |
| `labels` | `string[]` | No | A list of labels to the task. Options are loaded from the connected account. |
| `status` | `string` | No | The id of the task status. Options are loaded from the connected account. |

## 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": "motion",
      },
    },
  },
)

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: "motion-create-task",
  arguments: {
    workspaceId: "Workspace Id",
    projectId: "Project Id",
  },
})
```

**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: "motion-create-task",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    motion: { authProvisionId: "apn_xxxxxxx" },
    workspaceId: "Workspace Id",
    projectId: "Project Id",
  },
})

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": "motion-create-task",
    "configured_props": {
      "motion": { "authProvisionId": "apn_xxxxxxx" },
      "workspaceId": "Workspace Id",
      "projectId": "Project Id"
    }
  }'
```

---

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