# Create Envelope From File — Docusign

> Create and optionally send a single-document DocuSign envelope from a file path or URL. This action places a SignHere tab by anchor text, such as /sn1/, in the uploaded document. Set Client User ID when you need embedded signing, then use…

- Key: `docusign-create-envelope-from-file`
- Type: Action (Write)
- Version: 0.0.4
- App: Docusign (`docusign`) — https://pipedream.com/apps/docusign.md
- This page (HTML): https://pipedream.com/apps/docusign/actions/create-envelope-from-file
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/docusign/actions/create-envelope-from-file/create-envelope-from-file.mjs

## Description

Create and optionally send a single-document DocuSign envelope from a file path or URL. This action places a SignHere tab by anchor text, such as `/sn1/`, in the uploaded document. Set Client User ID when you need embedded signing, then use **Create Recipient View** with the same value. [See the documentation](https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `account` | `string` | No | Your DocuSign account. Leave blank to automatically use your default account, or provide an Account ID (you can use List Accounts to retrieve available accounts). Options are loaded from the connected account. |
| `filePath` | `string` | Yes | The document to send. Provide either a file URL or a path to a file in /tmp, for example /tmp/contract.pdf. |
| `syncDir` | `dir` | No | SyncDir |
| `emailSubject` | `string` | Yes | Subject line of email |
| `signerName` | `string` | Yes | The full name of the recipient |
| `signerEmail` | `string` | Yes | Email address of signature request recipient |
| `status` | `string` | Yes | Use sent to send immediately or created to save as a draft. |
| `documentName` | `string` | No | Optional document name shown in DocuSign. Defaults to the uploaded file name. |
| `fileExtension` | `string` | No | Optional file extension. Defaults to the uploaded file extension, or pdf if one cannot be detected. |
| `signerRecipientId` | `string` | No | Recipient ID to assign to the new signer in this envelope. |
| `routingOrder` | `string` | No | Routing order for the signer. |
| `clientUserId` | `string` | No | Set this for embedded signing recipients. The same value is required when creating a recipient view URL. |
| `signHereAnchorString` | `string` | Yes | Text in the document where DocuSign should place the signature tab. The text is not shown to signers. Example: /sn1/. |
| `anchorXOffset` | `string` | No | Horizontal offset in pixels for the signature tab relative to the anchor text. |
| `anchorYOffset` | `string` | No | Vertical offset in pixels for the signature tab relative to the anchor text. |
| `signerOverridesJson` | `string` | No | Optional JSON object merged into the signer object using ...signerOverrides for advanced recipient settings. Example: {"note":"Please sign by Friday"}. If signerOverridesJson includes a tabs key, it overwrites the generated signHereTabs from signHereAnchorString; omit tabs or include signHereTabs in the override to preserve anchor signing. |

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

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: "docusign-create-envelope-from-file",
  arguments: {
    account: "Account",
    filePath: "File Path or URL",
  },
})
```

**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: "docusign-create-envelope-from-file",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    docusign: { authProvisionId: "apn_xxxxxxx" },
    account: "Account",
    filePath: "File Path or URL",
  },
})

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": "docusign-create-envelope-from-file",
    "configured_props": {
      "docusign": { "authProvisionId": "apn_xxxxxxx" },
      "account": "Account",
      "filePath": "File Path or URL"
    }
  }'
```

---

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