# Create Candidate — CATS

> Create a new candidate in your CATS database. See the documentation

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

## Description

Create a new candidate in your CATS database. [See the documentation](https://docs.catsone.com/api/v3/#candidates-create-a-candidate)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `checkDuplicate` | `boolean` | Yes | When this flag is set to true, if a duplicate record is found to the one being created, an error will be thrown instead of creating a duplicate record. |
| `firstName` | `string` | Yes | The first name of the record. |
| `middleName` | `string` | No | The middle name of the record. |
| `lastName` | `string` | Yes | The last name of the record. |
| `title` | `string` | No | The record's job title. |
| `emails` | `string[]` | No | An array of email objects. Each email object should contain two keys: email and is_primary, as described here. Format: {"email":"example@email.com", "is_primary":"true"} |
| `phones` | `string[]` | No | An array of phone objects. Each phone object should contain three keys: number, extension, and type, as described here. Format: {"number":"+16124063451", "extension":"8371", "type":"mobile"}. Type can be mobile, home, work, fax, main or other |
| `addressStreet` | `string` | No | The street of the record's address. |
| `addressCity` | `string` | No | The city of the record's address. |
| `addressState` | `string` | No | The state of the record's address. |
| `addressPostalCode` | `string` | No | The postal code of the record's address. |
| `countryCode` | `string` | No | The country code of the record. |
| `socialMediaUrls` | `string[]` | No | The social media URLs of the record. |
| `website` | `string` | No | The website of the record. |
| `bestTimeToCall` | `string` | No | The best time to call the record. Format: HH:MM. |
| `currentEmployer` | `string` | No | The current employer of the record. |
| `dateAvailable` | `string` | No | The date the record is available for an opening. Format: YYYY-MM-DD. |
| `currentPay` | `string` | No | The current pay of the record. |
| `desiredPay` | `string` | No | The desired pay for the record. |
| `isWillingToRelocate` | `boolean` | No | Whether the record is willing to relocate. |
| `keySkills` | `string` | No | The key skills of the record. |
| `notes` | `string` | No | Any notes about the record. |
| `source` | `string` | No | The source of the record. |
| `ownerId` | `integer` | No | The user id of the record owner. Options are loaded from the connected account. |
| `isActive` | `boolean` | No | A flag indicating if the candidate is active. |
| `isHot` | `boolean` | No | Whether the record is marked as hot. |
| `password` | `string` | No | The candidate's password if they are "registering". |
| `customFields` | `string[]` | No | An array of custom field objects. Options are loaded from the connected account. |
| `workHistory` | `string[]` | No | An array of work history objects. Example: {"title": "Engineer", "employer": { "linked": false, "name": "<employer name>", "location": { "city": "<employer city>", "state": "<employer state>" }}, "supervisor": { "linked": false, "name": "<supervisor name>", "phone": "<supervisor phone number>" }, "is_verified": true, "is_current": false, "start_date": "YYYY-MM-DD", "end_date": "YYYY-MM-DD", "reason_for_leaving": "foo"} |

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

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: "cats-create-candidate",
  arguments: {
    checkDuplicate: true,
    firstName: "First 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: "cats-create-candidate",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    cats: { authProvisionId: "apn_xxxxxxx" },
    checkDuplicate: true,
    firstName: "First 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": "cats-create-candidate",
    "configured_props": {
      "cats": { "authProvisionId": "apn_xxxxxxx" },
      "checkDuplicate": true,
      "firstName": "First Name"
    }
  }'
```

---

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