# Create Job — Ascora

> Create a job in the Ascora system. See the documentation

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

## Description

Create a job in the Ascora system. [See the documentation](https://www.ascora.com.au/Assets/Guides/AscoraApiGuide.pdf)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `siteCustomer` | `string` | Yes | The site customer of the job Options are loaded from the connected account. |
| `jobName` | `string` | No | The name of the job |
| `jobDescription` | `string` | No | The description of the job |
| `workUndertaken` | `string` | No | The work undertaken for the job |
| `pricingMethod` | `string` | No | The pricing method for the job. Example: FIXED-PRICE |
| `totalIncTax` | `string` | No | The total including tax for the job |
| `totalExTax` | `string` | No | The total excluding tax for the job |
| `addressLine1` | `string` | No | The first line of the address of the job |
| `addressLine2` | `string` | No | The second line of the address of the job |
| `suburb` | `string` | No | The suburb of the address of the job |
| `postcode` | `string` | No | The postcode of the address of the job |
| `country` | `string` | No | The country of the address of the job |
| `billingCustomer` | `string` | No | The billing customer of the job Options are loaded from the connected account. |
| `completedDate` | `string` | No | The completed date of the job. Example: 2021-01-12T20:55:03.837 |

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

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: "ascora-create-job",
  arguments: {
    siteCustomer: "Site Customer",
    jobName: "Job Name",
  },
})
```

**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: "ascora-create-job",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    ascora: { authProvisionId: "apn_xxxxxxx" },
    siteCustomer: "Site Customer",
    jobName: "Job Name",
  },
})

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": "ascora-create-job",
    "configured_props": {
      "ascora": { "authProvisionId": "apn_xxxxxxx" },
      "siteCustomer": "Site Customer",
      "jobName": "Job Name"
    }
  }'
```

---

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