# Take a Screenshot — screenshotbase

> Take a screenshot with ScreenshotBase. See the documentation

- Key: `screenshotbase-take-screenshot`
- Type: Action (Write)
- Version: 0.0.1
- App: screenshotbase (`screenshotbase`) — https://pipedream.com/apps/screenshotbase.md
- This page (HTML): https://pipedream.com/apps/screenshotbase/actions/take-screenshot
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/screenshotbase/actions/take-screenshot/take-screenshot.mjs

## Description

Take a screenshot with ScreenshotBase. [See the documentation](https://screenshotbase.com/docs/take)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `url` | `string` | Yes | Website to render |
| `format` | `string` | Yes | The format of the image returned |
| `filename` | `string` | Yes | The filename (including extension) that will be used to save the file in /tmp |
| `quality` | `integer` | No | The quality of the image returned. Only supported when the format is jpg or jpeg |
| `fullPage` | `boolean` | No | Whether to take a screenshot of the full page |
| `viewportWidth` | `integer` | No | The width of the browser viewport in pixels. The browser's viewport is the window area where you can see the website. Default value is 1280. |
| `viewportHeight` | `integer` | No | The height of the browser viewport in pixels. The browser's viewport is the window area where you can see the website. Default value is 800. |
| `syncDir` | `dir` | Yes | SyncDir |

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

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: "screenshotbase-take-screenshot",
  arguments: {
    url: "URL",
    format: "Format",
  },
})
```

**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: "screenshotbase-take-screenshot",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    screenshotbase: { authProvisionId: "apn_xxxxxxx" },
    url: "URL",
    format: "Format",
  },
})

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": "screenshotbase-take-screenshot",
    "configured_props": {
      "screenshotbase": { "authProvisionId": "apn_xxxxxxx" },
      "url": "URL",
      "format": "Format"
    }
  }'
```

---

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