Skip to navigation

How to create a workspace with a brand

View as Markdown

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. See How to create a brand for details about creating a brand with the eSignature API.

Run this code example from our launcher projects: Bash, PowerShell.

Required data

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

Data elementDescription
{API_ACCOUNT_ID}A GUID 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 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 value that identifies a brand. For more information, see 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 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.

See Workspaces authentication 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

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

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)

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}.

declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
'--header' "Accept: application/json" \
'--header' "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.

printf \
'{
"name" : "Example workspace",
"brand_id" : "'"${brand_id}"'"
}' >> $request_data

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 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}>.

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

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
{
"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