# Run Project — Hex

> Trigger a run of the latest published version of a project. See the documentation

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

## Description

Trigger a run of the latest published version of a project. [See the documentation](https://learn.hex.tech/docs/api/api-reference#operation/RunProject)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `projectId` | `string` | Yes | The ID of the project to run. Options are loaded from the connected account. |
| `inputParams` | `object` | No | Specify input parameters for this project run. These should be structured as a dictionary of key/value pairs, where the key name matches the name of the variable in the Hex project. Only parameters that are added to the published app can be set via this request parameter. Any additional inputs will be ignored. It is invalid to pass in both a viewId and inputParams. If no input parameters are provided, the project will be run with the default input values. |
| `dryRun` | `boolean` | No | When true, this endpoint will perform a dry run that does not run the project. This can be useful for validating the structure of an API call, and inspecting a dummy response, without running a project. |
| `notifications` | `string[]` | No | Specify a list of notification details that will be delivered once a project run completes. Notifications can be configured for delivery to Slack channels, Hex users, or Hex groups. E.g. [{"type": "SUCCESS", "includeSuccessScreenshot": "general"}]. See the documentation for more details. |
| `updatePublishedResults` | `boolean` | No | When true, the cached state of the published app will be updated with the latest run results. You must have at least "Can Edit" permissions on the project to do so. Note: this cannot be set to true if custom input parameters are provided. |
| `useCachedSqlResults` | `boolean` | No | When false, the project will run without using any cached SQL results, and will update those cached SQL results. |
| `viewId` | `string` | No | Specify a SavedView viewId to use for the project run. If specified, the saved view's inputs will be used for the project run. It is invalid to pass in both a viewId and inputParams. If not specified, the default inputs will be used. |

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

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: "hex-run-project",
  arguments: {
    projectId: "Project ID",
    inputParams: "Input Parameters",
  },
})
```

**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: "hex-run-project",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    hex: { authProvisionId: "apn_xxxxxxx" },
    projectId: "Project ID",
    inputParams: "Input Parameters",
  },
})

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": "hex-run-project",
    "configured_props": {
      "hex": { "authProvisionId": "apn_xxxxxxx" },
      "projectId": "Project ID",
      "inputParams": "Input Parameters"
    }
  }'
```

---

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