# Create Page from Data Source — Notion (API Key)

> Create a page from a data source. See the documentation

- Key: `notion_api_key-create-page-from-database`
- Type: Action (Write)
- Version: 0.0.3
- App: Notion (API Key) (`notion_api_key`) — https://pipedream.com/apps/notion-api-key.md
- This page (HTML): https://pipedream.com/apps/notion-api-key/actions/create-page-from-database
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/notion_api_key/actions/create-page-from-database/create-page-from-database.mjs

## Description

Create a page from a data source. [See the documentation](https://developers.notion.com/reference/post-page)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `parentDataSource` | `string` | Yes | Select a parent data source or provide a data source ID Options are loaded from the connected account. |
| `Name` | `string` | No | The name of the page. Use this only if the data source has a title property named Name. Otherwise, use the Properties prop below to set the title property. |
| `properties` | `object` | No | The values of the page's properties. The schema must match the parent data source's properties. See the documentation for information on various property types. Example: { "Tags": [ "tag1" ], "Link": "https://pipedream.com" } |
| `icon` | `string` | No | Page Icon Emoji |
| `cover` | `string` | No | Cover External URL |
| `pageContent` | `string` | No | The content of the page, using Markdown syntax. See the documentation for more information |

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

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: "notion_api_key-create-page-from-database",
  arguments: {
    parentDataSource: "Parent Data Source ID",
    Name: "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: "notion_api_key-create-page-from-database",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    notion_api_key: { authProvisionId: "apn_xxxxxxx" },
    parentDataSource: "Parent Data Source ID",
    Name: "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": "notion_api_key-create-page-from-database",
    "configured_props": {
      "notion_api_key": { "authProvisionId": "apn_xxxxxxx" },
      "parentDataSource": "Parent Data Source ID",
      "Name": "Name"
    }
  }'
```

---

- App: https://pipedream.com/apps/notion-api-key.md · All apps: https://pipedream.com/apps
