# Create Text Annotation Task — Scale AI

> Create a text annotation task. See the documentation

- Key: `scale_ai-create-text-annotation-task`
- Type: Action (Write)
- Version: 0.0.3
- App: Scale AI (`scale_ai`) — https://pipedream.com/apps/scale-ai.md
- This page (HTML): https://pipedream.com/apps/scale-ai/actions/create-text-annotation-task
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/scale_ai/actions/create-text-annotation-task/create-text-annotation-task.mjs

## Description

Create a text annotation task. [See the documentation](https://docs.scale.com/reference/text-collection)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `project` | `string` | No | The name of the project to associate this task with. Options are loaded from the connected account. |
| `batch` | `string` | No | The name of the batch to associate this task with. Note that if a batch is specified, you need not specify the project, as the task will automatically be associated with the batch's project. For Scale Rapid projects specifying a batch is required. See Batches section for more details. |
| `instruction` | `string` | No | A markdown-enabled string or iframe embedded Google Doc explaining how to do the task. You can use markdown to show example images, give structure to your instructions, and more. See our instruction best practices for more details. For Scale Rapid projects, DO NOT set this field unless you specifically want to override the project level instructions. |
| `callbackUrl` | `string` | No | The full url (including the scheme http:// or https://) or email address of the callback that will be used when the task is completed. |
| `title` | `string` | No | The title of the task to be shown to scalers. |
| `description` | `string` | No | The description of the task to be shown to scalers. |
| `responsesRequired` | `integer` | No | The number of responses required for the task to build consensus before returning the callback response. Upper bound of 100. |
| `priority` | `integer` | No | A value of 10, 20, or 30 that defines the priority of a task within a project. The higher the number, the higher the priority. |
| `uniqueId` | `string` | No | A arbitrary ID that you can assign to a task and then query for later. This ID must be unique across all projects under your account, otherwise the task submission will be rejected. See Avoiding Duplicate Tasks for more details. |
| `clearUniqueIdOnError` | `boolean` | No | If set to be true, if a task errors out after being submitted, the Unique ID on the task will be unset. This param allows workflows where you can re-submit the same Unique ID to recover from errors automatically. |
| `numberOfFields` | `integer` | Yes | The number of fields to be labeled |
| `numberOfAttachments` | `integer` | Yes | The number of attachments to be labeled |

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

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: "scale_ai-create-text-annotation-task",
  arguments: {
    project: "Project",
    batch: "Batch",
  },
})
```

**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: "scale_ai-create-text-annotation-task",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    scale_ai: { authProvisionId: "apn_xxxxxxx" },
    project: "Project",
    batch: "Batch",
  },
})

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": "scale_ai-create-text-annotation-task",
    "configured_props": {
      "scale_ai": { "authProvisionId": "apn_xxxxxxx" },
      "project": "Project",
      "batch": "Batch"
    }
  }'
```

---

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