# Create Source — DocsBot AI

> Create a new source for a bot. See the documentation

- Key: `docsbot_ai-create-source`
- Type: Action (Write)
- Version: 0.0.3
- App: DocsBot AI (`docsbot_ai`) — https://pipedream.com/apps/docsbot-ai.md
- This page (HTML): https://pipedream.com/apps/docsbot-ai/actions/create-source
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/docsbot_ai/actions/create-source/create-source.mjs

## Description

Create a new source for a bot. [See the documentation](https://docsbot.ai/documentation/developer/source-api#create-source)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `teamId` | `string` | Yes | The ID of the team Options are loaded from the connected account. |
| `botId` | `string` | Yes | The ID of the bot Options are loaded from the connected account. |
| `type` | `string` | Yes | The source type |
| `title` | `string` | No | The source title. Required if type is document |
| `url` | `string` | No | The source URL. Required if type is url, sitemap, or rss |
| `file` | `string` | No | The source file path. Required if type is urls, csv, document, or wp. You can upload a file using the Upload Source File action and use the returned file property here |
| `faqs` | `string[]` | No | Required if type is qa. An array of objects like { "question": "Question text", "answer":"The answer." } |
| `scheduleInterval` | `string` | No | The source refresh scheduled interval. Can be daily, weekly, monthly, or none depending on your plan |

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

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: "docsbot_ai-create-source",
  arguments: {
    teamId: "Team ID",
    botId: "Bot ID",
  },
})
```

**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: "docsbot_ai-create-source",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    docsbot_ai: { authProvisionId: "apn_xxxxxxx" },
    teamId: "Team ID",
    botId: "Bot ID",
  },
})

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": "docsbot_ai-create-source",
    "configured_props": {
      "docsbot_ai": { "authProvisionId": "apn_xxxxxxx" },
      "teamId": "Team ID",
      "botId": "Bot ID"
    }
  }'
```

---

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