# Create Job — Click2Mail

> Creates a new new job in your account. See the documentation.

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

## Description

Creates a new new job in your account. [See the documentation](https://developers.click2mail.com/reference/post_2).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `documentClass` | `string` | Yes | The general type of the document. |
| `layout` | `string` | Yes | The specific type of the product |
| `envelope` | `string` | Yes | If this is an enveloped product this determines the envelope in which the product is to be mailed; otherwise provide no value. |
| `color` | `string` | Yes | Print in color or black and white. |
| `paperType` | `string` | Yes | Sets the paper the mailing is to be printed on. |
| `printOption` | `string` | Yes | Sets simplex or duplex printing. |
| `documentId` | `string` | No | ID of the document to print Options are loaded from the connected account. |
| `addressId` | `string` | No | This required if the product required a recipient address list. Options are loaded from the connected account. |
| `rtnName` | `string` | No | Return address Name. |
| `rtnOrganization` | `string` | No | Return address Organization. |
| `rtnaddress1` | `string` | No | Return address line 1. |
| `rtnaddress2` | `string` | No | Return address line 2. |
| `rtnCity` | `string` | No | Return address City. |
| `rtnState` | `string` | No | Return address State. |
| `rtnZip` | `string` | No | Return address Zip. |
| `mailClass` | `string` | No | Overrides the default of First Class for mailed products. |
| `appSignature` | `string` | No | This is a short signature to identify orders that come from your app. |
| `projectId` | `integer` | No | Use to place this job in a pre-existing project in your account Options are loaded from the connected account. |
| `mailingDate` | `string` | No | Used to schedule the mailing date in the future. Format YYYYMMDD. If not provided the order will be mailed on the next available on the next business day. The business day cut off is 8PM EST. |
| `quantity` | `string` | No | For products that do not use mailing lists. Quantity to print. |
| `jobDocumentId` | `string` | No | Document ID of the job version of the document. Options are loaded from the connected account. |
| `jobAddressId` | `string` | No | Address List Id of the job version. |
| `businessReplyAddressId` | `integer` | No | If you are mailing a business reply mail product use this to specify the business reply address and permit information already in your account. |
| `courtesyReplyAddressId` | `integer` | No | If you are mailing a courtesy reply mail product use this to specify a courtesy reply address already in your account. |
| `returnAddressId` | `integer` | No | You may use the return address id to specify a return address already in your 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": "click2mail2",
      },
    },
  },
)

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: "click2mail2-create-job",
  arguments: {
    documentClass: "Document Class",
    layout: "Layout",
  },
})
```

**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: "click2mail2-create-job",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    click2mail2: { authProvisionId: "apn_xxxxxxx" },
    documentClass: "Document Class",
    layout: "Layout",
  },
})

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": "click2mail2-create-job",
    "configured_props": {
      "click2mail2": { "authProvisionId": "apn_xxxxxxx" },
      "documentClass": "Document Class",
      "layout": "Layout"
    }
  }'
```

---

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