> 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

# How to create a workspace

> See how to create a workspace using API calls.

This topic demonstrates how to create a workspace using the Workspaces API.

> **Note**
>
> Run this code example from our [Quickstart](/docs/esign-rest-api/quickstart) or launcher projects: [Bash](https://github.com/docusign/code-examples-bash), [C#](https://github.com/docusign/code-examples-csharp), [Java](https://github.com/docusign/code-examples-java), [Node.js](https://github.com/docusign/code-examples-node), [PowerShell](https://github.com/docusign/code-examples-powershell).

## Required data

Running the code in this how-to requires this data:

| Data element            | Description                                                                                                                                                                                                                                                                                                            |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \{API_ACCOUNT_ID}       | A [GUID](http://guid.one/) value that identifies your account. This value is automatically generated by Docusign for any account you create. Copy the value from the **API Account ID** field on the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=appsAndKeys) page.                               |
| \{WORKSPACES_BASE_PATH} | A string value that forms the root of the URL required to make API calls. The base path value in the example code is set to target the developer environment at `https://<domain>` Where `<domain>` is `https://api-d.docusign.com/v1` for the developer environment and `https://api.docusign.com/v1` for production. |

## Step 1. Obtain your OAuth token

To make the API call shown in this how-to, you need a valid OAuth access token. Docusign supports access tokens for three different recommended OAuth grant types: Public Authorization Code Grant, Confidential Authorization Code Grant, and JSON Web Token (JWT) Grant. Choose the OAuth grant type appropriate for your scenario.

Wondering which grant type suits your integration? See [Authenticate](/platform/auth) for guidance on your options to get an OAuth token.

Workspaces OAuth access tokens are the same ones used for our eSignature REST API, although you must request the `signature` scope and one or more Workspaces scopes to call the Workspaces API.

> **Note**
>
> See [Workspaces authentication](/docs/workspaces-api/auth) for details and the full list of Workspaces scopes.

![Three icons that represent the three methods a user can use to obtain an OAuth token: JSON Web Token (JWT), Public Authorization Code Grant (ACG), and Confidential Authorization Code grant](/_fern-files/_img/64f473773042ee439449a096bf7673292b1585b86a4ccc55f82ba0dda41f61a1.webp)

## Step 2. Construct your API headers

After you have a valid OAuth access token, you are ready to construct the API headers that you will pass to the API call. Construct your headers like this, but make sure to substitute your valid OAuth access token for \{ACCESS_TOKEN}.

**`Bash`**

```bash title="Bash"
declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
    '--header' "Accept: application/json" \
    '--header' "Content-Type: application/json")
```

**`C#`**

```csharp title="C#"
var client = CreateAuthenticatedClient(accessToken);
```

**`Java`**

```java title="Java"
var accessToken = user.getAccessToken();
```

**`Node.js`**

```javascript title="Node.js"
const client = new iam.IamClient({ accessToken: args.accessToken });
```

**`PowerShell`**

```text title="PowerShell"
$headers = @{
    'Authorization' = "Bearer $accessToken";
    'Accept'        = 'application/json';
    'Content-Type'  = 'application/json';
}
```

## Step 3. Construct the request body

Next, create the request body. The only body field required to create a workspace is name.

**`Bash`**

```bash title="Bash"
printf \
'{
    "name" : "'"${workspace_name}"'"
}' >> $request_data
```

**`C#`**

```csharp title="C#"
var createWorkspaceBody = new CreateWorkspaceBody
{
    Name = workspaceName,
};
```

**`Java`**

```java title="Java"
var workspaceName = args.getWorkspaceName();
```

**`Node.js`**

```javascript title="Node.js"
const createWorkspaceBody = {
  name: args.workspaceName,
};
```

**`PowerShell`**

```text title="PowerShell"
$body = @{
    name = $workspaceName;
} | ConvertTo-Json
```

## Step 4. Call the Workspaces API

Now that you have constructed your API headers and request body, make a POST request to the [Workspaces: createWorkspace](/docs/workspaces-api/reference/workspaces/workspaces/createworkspace) endpoint and include the request body to create the workspace. Here’s how you make the call, but make sure to substitute your API account ID for `<{account_id}>`.

> **Note**
>
> View the source code for this how-to on GitHub: [Bash](https://github.com/docusign/code-examples-bash/blob/master/examples/Workspaces/eg001CreateWorkspace.sh), [C#](https://github.com/docusign/code-examples-csharp/blob/master/launcher-csharp/Workspaces/Examples/CreateWorkspace.cs), [Java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/controller/workspaces/examples/Work001CreateWorkspaceController.java), [Node.js](https://github.com/docusign/code-examples-node/blob/master/lib/workspaces/examples/createWorkspace.js), [PowerShell](https://github.com/docusign/code-examples-powershell/blob/master/examples/Workspaces/eg001CreateWorkspace.ps1).

**`Bash`**

```bash title="Bash"
Status=$(curl -s -w "%{http_code}\n" -i \
     --request POST ${base_path}/accounts/${account_id}/workspaces \
    "${Headers[@]}" \
    --data-binary @${request_data} \
    --output ${response})
```

**`C#`**

```csharp title="C#"
return await client.Workspaces.Workspaces.CreateWorkspaceAsync(accountId, createWorkspaceBody);
```

**`Java`**

```java title="Java"
var workspace = CreateWorkspaceService.createWorkspace(accessToken, accountId, workspaceName);
```

**`Node.js`**

```javascript title="Node.js"
return await client.workspaces1.workspaces.createWorkspace({ accountId: args.accountId, createWorkspaceBody });
```

**`PowerShell`**

```text title="PowerShell"
$response = $(Invoke-WebRequest `
    -Uri "${apiUri}/accounts/${accountId}/workspaces" `
    -Method 'POST' `
    -headers $headers `
    -body $body)
```

## Expected response

If you run this code example from our Quickstart or launcher projects, you should see a JSON response similar to the code shown.

**`Expected response`**

```json title="Expected response"
{"workspace_id":"090d5aa9-0fa9-4128-8380-137cc2cb24fc","name":"Example workspace","created_date":"2025-05-22T16:30:18.653","created_by_user_id":"2d80e7fa-b563-48c8-9199-dd12625f8b4d","workspace_owner_ids":["2d80e7fa-b563-48c8-9199-dd12625f8b4d"]}

Workspace created! ID: 090d5aa9-0fa9-4128-8380-137cc2cb24fc
```

## Next steps

* Run this code example from our [Quickstart](/docs/esign-rest-api/quickstart) or launcher projects: [Bash](https://github.com/docusign/code-examples-bash), [PowerShell](https://github.com/docusign/code-examples-powershell).
* See [How to add a document to workspace](/docs/workspaces-api/how-to/add-a-document)
* See [How to send an envelope with recipient info](/docs/workspaces-api/how-to/send-envelope-with-recipient-information)
* See how to [Go-Live](/docs/workspaces-api/go-live) with a completed app.