# Create Job — ServiceM8

> Create a job. See the documentation

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

## Description

Create a job. [See the documentation](https://developer.servicem8.com/reference/createjobs)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `companyUuid` | `string` | Yes | Client/company for this job (billing and contact relationship). Options are loaded from the connected account. |
| `createdByStaffUuid` | `string` | No | Staff member who created the job (created_by_staff_uuid). Options are loaded from the connected account. |
| `date` | `string` | No | Job date (date); format as accepted by the API (e.g. YYYY-MM-DD HH:MM:SS). |
| `billingAddress` | `string` | No | Invoice address (billing_address; max 500). |
| `status` | `string` | Yes | Initial job status (status; max 20 characters). |
| `paymentDate` | `string` | No | Payment date (payment_date). |
| `paymentActionedByUuid` | `string` | No | Staff member (payment_actioned_by_uuid). Options are loaded from the connected account. |
| `paymentMethod` | `string` | No | Payment method (payment_method). Options are distinct method values from job payments; paste a value if yours is not listed. Options are loaded from the connected account. |
| `paymentAmount` | `string` | No | Payment amount (payment_amount) in the account currency. |
| `categoryUuid` | `string` | No | Job category (category_uuid). Options are loaded from the connected account. |
| `purchaseOrderNumber` | `string` | No | Client PO reference (purchase_order_number; max 100 characters). |
| `invoiceSent` | `boolean` | No | Whether an invoice has been sent (invoice_sent). |
| `queueUuid` | `string` | No | Queue this job belongs to (queue_uuid). Options are loaded from the connected account. |
| `queueAssignedStaffUuid` | `string` | No | Staff assigned to this job in the queue (queue_assigned_staff_uuid). Options are loaded from the connected account. |
| `badges` | `string[]` | No | Badge UUIDs (list badges). Sent as a JSON array string for the API. Options are loaded from the connected account. |
| `jobAddress` | `string` | Yes | Work site address (job_address; max 500 characters). |
| `jobDescription` | `string` | No | Scope or work requested (job_description). |
| `workDoneDescription` | `string` | No | Description of work completed (work_done_description). |
| `paymentProcessed` | `boolean` | No | Exported to accounting (payment_processed). |
| `paymentReceived` | `boolean` | No | Full payment received (payment_received). |
| `completionDate` | `string` | No | When status became Completed (completion_date). |
| `unsuccessfulDate` | `string` | No | When status became Unsuccessful (unsuccessful_date). |
| `note` | `string` | No | Optional diary note (creates a Note linked to the new job after create). |

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

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: "servicem8-create-job",
  arguments: {
    companyUuid: "Company",
    createdByStaffUuid: "Created by staff",
  },
})
```

**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: "servicem8-create-job",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    servicem8: { authProvisionId: "apn_xxxxxxx" },
    companyUuid: "Company",
    createdByStaffUuid: "Created by staff",
  },
})

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": "servicem8-create-job",
    "configured_props": {
      "servicem8": { "authProvisionId": "apn_xxxxxxx" },
      "companyUuid": "Company",
      "createdByStaffUuid": "Created by staff"
    }
  }'
```

---

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