> 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 with a brand

> Learn how to create a workspace using the Docusign Workspaces API and associate it with an existing eSignature brand for consistent, branded experiences.

This topic demonstrates how to create a workspace with a brand using the Workspaces API and associate it with an eSignature brand.

**Note:** This code example requires the brand ID of a brand in your developer account. You can either specify the ID of an existing brand, create one in your account to use with this example, or let the code example automatically create a sample brand in your account. To create a brand in eSignature, follow the steps in [Add a Signing Brand for Recipients ](https://support.docusign.com/s/document-item?language=en_US\&bundleId=pik1583277475390\&topicId=byg1583277338658.html&_LANG=enus). See [How to create a brand](/docs/esign-rest-api/how-to/create-brand) for details about creating a brand with the eSignature API.

> **Note**
>
> Run this code example from our launcher projects:  [Bash](https://github.com/docusign/code-examples-bash),  [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. |
| \{BRAND_ID}             | A [GUID](http://guid.one/) value that identifies a brand. For more information, see [Branding](/docs/esign-rest-api/esign101/concepts/branding).                                                                                                                                                                       |

## 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. Retrieve the brand_id

This example checks for a brand in your account.

If  `config/BRAND_ID` does not exist, the script attempts to run the [How to create a brand](/docs/esign-rest-api/how-to/create-brand) code example to create a sample brand in your account. Once a brand is available, its `brand_id` is loaded for use in the next steps.

**`Bash`**

```bash title="Bash"
if [[ ! -s config/BRAND_ID ]]; then
  echo "No brand_id found. Attempting to run eg028CreatingABrand.sh..."
  if [[ -x ./examples/eSignature/eg028CreatingABrand.sh ]]; then
    bash ./examples/eSignature/eg028CreatingABrand.sh
  else
    echo "eg028CreatingABrand.sh not found or not executable."
    echo "Please run the eSignature Create a Brand example first."
    exit 1
  fi
fi

# Re-check after attempt
if [[ ! -s config/BRAND_ID ]]; then
  echo "Brand creation did not produce a brand_id. Please create a brand first."
  exit 1
fi
brand_id=$(cat config/BRAND_ID)
```

**`PowerShell`**

```text title="PowerShell"
# check that a brand exists
$path = ".\config\BRAND_ID"
if (-not (Test-Path $path) -or [string]::IsNullOrWhiteSpace((Get-Content $path))) {
    Write-Host "No brand_id found. Attempting to run eg028CreatingABrand.ps1..."
    Invoke-Script -Command "`"./examples/eSignature/eg028CreatingABrand.ps1`""
}

# re-check after attempt
$brandId = Get-Content .\config\BRAND_ID
if ([string]::IsNullOrWhiteSpace($brandId)) {
    Write-Host "Brand creation did not produce a brand_id. Please create a brand first."
    exit 1
}
```

## Step 3. 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")
```

**`PowerShell`**

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

## Step 4. Construct the workspace definition

Next, create the request body. The only body field required to create a workspace is `name`. You can also optionally include a `brand_id` to associate the workspace with an existing eSignature brand. When you include the `brand_id`, the workspace adopts the colors, logo, and email styling defined by that brand in your Docusign account.

**`Bash`**

```bash title="Bash"
printf \
'{
    "name" : "Example workspace",
    "brand_id" : "'"${brand_id}"'"
}' >> $request_data
```

**`PowerShell`**

```text title="PowerShell"
$body = @{
    name     = "Example workspace";
    brand_id = "$brandId"
} | ConvertTo-Json
```

## Step 5. 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}>`.

**`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})
```

**`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.

**`Sample response`**

```json title="Sample response"
{
  "workspace_id": "4f7c12d3-xxxx-xxxx-xxxx-123456789abc",
  "name": "Example workspace",
  "created_date": "2025-10-21T14:45:40.013Z",
  "created_by_user_id": "92b4d8ef-xxxx-xxxx-xxxx-abcdef123456",
  "workspace_owner_ids": ["92b4d8ef-xxxx-xxxx-xxxx-abcdef123456"]
}
Workspace created! ID: 4f7c12d3-xxxx-xxxx-xxxx-123456789abc
Brand used: f5a72b10-xxxx-xxxx-xxxx-7890fedcba12
```

## Next steps

* Discover how [branding](/docs/esign-rest-api/esign101/concepts/branding) works through the Docusign eSignature API.
* Learn how to [add documents to your workspace](/docs/workspaces-api/how-to/add-a-document).