> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# Add a document to a workspace via file contents upload

POST https://api-d.docusign.com/v1/accounts/{accountId}/workspaces/{workspaceId}/documents
Content-Type: multipart/form-data

**Note:** This endpoint is in beta.

This operation adds a document to a workspace via file contents upload. The file is passed in the request body as a multipart/form-data file. The file name is used as the document name.

Once added, it may be used to create an envelope associated with the workspace.

[Required authentication scopes](/docs/workspaces-api/auth/): `dtr.documents.write`

Reference: https://developers.docusign.com/docs/workspaces-api/reference/workspaces/workspacedocuments/addworkspacedocument

## Authentication

- `Authorization` header (bearer token, required) — JWT Bearer token from Docusign authorization server

## Servers

- `https://api-d.docusign.com` (Demo, default)
- `https://api.docusign.com` (Production)

## Request

### Path parameters

- `accountId` (string, required) — The ID of the account
- `workspaceId` (string, required) — The ID of the workspace

### Body (multipart/form-data)

This endpoint expects a multipart form containing an optional file.

- `file` (file, optional) — The file within the multipart/form-data. Maximum allowed size: 50MB

## Response

### 201

Document successfully added

- `document_id` (string, optional)
- `name` (string, optional, nullable)
- `owner_id` (string, optional, nullable)
- `size` (long, optional, nullable)
- `created_date` (datetime, optional, nullable)
- `last_updated_date` (datetime, optional, nullable)
- `owner` (CreateWorkspaceDocumentOwner, optional)

## Errors

### 400 Bad Request Error

Bad request. See ErrorCode and Message for details

- `message` (string, optional, nullable) — A brief message describing the error condition
- `errorCode` (string, optional, nullable) — A standardized code that generalizes the specific error

### 401 Unauthorized Error

Not authorized to make this request

- `message` (string, optional, nullable) — A brief message describing the error condition
- `errorCode` (string, optional, nullable) — A standardized code that generalizes the specific error

### 500 Internal Server Error

Internal Server Error

- `message` (string, optional, nullable) — A brief message describing the error condition
- `errorCode` (string, optional, nullable) — A standardized code that generalizes the specific error

## Types

### CreateWorkspaceDocumentOwner

- `user_id` (string, optional, nullable)
- `first_name` (string, optional, nullable)
- `last_name` (string, optional, nullable)

## Examples

**Request**

```json
{
  "file": "<file: <file1>>"
}
```

**Response**

```json
{
  "document_id": "9e2f4a8b-3c7d-4e5f-a1b2-8c9d6e3f4a7b",
  "name": "Contract Agreement.pdf",
  "owner_id": "211e2d22-f070-4c8d-b6a7-ecb14ceb81b4",
  "size": 245760,
  "created_date": "2025-09-01T12:00:00Z",
  "last_updated_date": "2025-09-01T12:00:00Z",
  "owner": {
    "user_id": "211e2d22-f070-4c8d-b6a7-ecb14ceb81b4",
    "first_name": "John",
    "last_name": "Doe"
  }
}
```