# Create Candidate — Gem

> Creates a new candidate in Gem. See the documentation

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

## Description

Creates a new candidate in Gem. [See the documentation](https://api.gem.com/v0/reference#tag/Candidates/paths/~1v0~1candidates/post)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `createdBy` | `string` | Yes | Who the candidate was created by Options are loaded from the connected account. |
| `firstName` | `string` | No | Candidate's first name |
| `lastName` | `string` | No | Candidate's last name |
| `nickname` | `string` | No | Candidate's nickname |
| `primaryEmail` | `string` | Yes | Candidate's primary email address |
| `additionalEmails` | `string[]` | No | List of candidate's additional email addresses |
| `linkedInHandle` | `string` | No | Enter your candidate's unique LinkedIn identifier (e.g., "satyanadella"). This helps the system check for duplicates before creating a new candidate entry. |
| `title` | `string` | No | Candidate's job title |
| `company` | `string` | No | Candidate's company name |
| `location` | `string` | No | Candidate's location |
| `school` | `string` | No | Candidate's school |
| `educationInfoNumber` | `integer` | No | The number of education info objects to be created |
| `workInfoNumber` | `integer` | No | The number of work info objects to be created |
| `profileUrls` | `string[]` | No | If Profile URLs is provided with an array of urls, social profiles will be generated based on the provided urls and attached to the candidate |
| `phoneNumber` | `string` | No | Candidate's phone number |
| `projectIds` | `string[]` | No | If Project IDs is provided with an array of project ids, the candidate will be added into the projects once they are created. Options are loaded from the connected account. |
| `customFields` | `object` | No | An object containing new custom field values. Only custom fields specified are updated. Format: {"custom_field_id": "value"}. See the documentation for further details. |
| `sourcedFrom` | `string` | No | Where the candidate was sourced from |
| `autofill` | `boolean` | No | Requires Linked In Handle to be non-null. Attempts to fill in any missing fields. |

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

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

---

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