> 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 room with a template

> Learn how to create a Docusign Room using a predefined template.

This topic demonstrates how to create a Docusign room using a predefined template. If you've created a template for your organization in either Rooms for Mortgage or Rooms for Real Estate by following the steps in [Using room templates and task lists](/docs/rooms-api/rooms101/templates), you can create rooms based on this template using the Rooms API.

> **Note**
>
> To complete this how-to, the Rooms API must be enabled for your account. For more information, see [creating a Rooms developer account](/docs/rooms-api/rooms101/create-account).

> **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), [PHP](https://github.com/docusign/code-examples-php), [PowerShell](https://github.com/docusign/code-examples-powershell), [Python](https://github.com/docusign/code-examples-python), or [Ruby](https://github.com/docusign/code-examples-ruby).

## 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.                      |
| \{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>/restapi/v2 Where \<domain> is demo.rooms.docusign.com for the developer environment and rooms.docusign.com for production. |
| \{ROLE_ID}        | A room-specific ID that can be allocated to a given user within a room. The role ID is necessary to set permissions on rooms for individuals within your Docusign organization. Retrieve this value with the [Roles:GetRoles](/docs/rooms-api/reference/roles/roles/getroles) method.                         |
| \{TEMPLATE_ID}    | A [GUID](http://guid.one/) value that identifies a Docusign [template](/docs/esign-rest-api/esign101/concepts/templates) that is used to create a Docusign [room](/docs/rooms-api/rooms101/concepts#rooms). This value is automatically generated by Docusign when the template is created.                   |

## Step 1. Obtain your OAuth token

To make the API calls 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.

> **Note**
>
> See [Authentication](/docs/rooms-api/rooms101/auth) for guidance on your options to get an OAuth token.

![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 apiClient = new DocuSignClient(basePath);
apiClient.Configuration.DefaultHeader.Add("Authorization", $"Bearer {accessToken}");
var roomsApi = new RoomsApi(apiClient);
var rolesApi = new RolesApi(apiClient);
```

**`Java`**

```java title="Java"
RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken());
```

**`Node.js`**

```javascript title="Node.js"
let dsApiClient = new docusignRooms.ApiClient();
dsApiClient.setBasePath(args.basePath);
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
```

**`PHP`**

```php title="PHP"
$config = new Configuration();
$config->setHost('https://demo.rooms.docusign.com/restapi');
$config->addDefaultHeader('Authorization', 'Bearer ' . $args['ds_access_token']);
$this->apiClient = new ApiClient($config);
```

**`PowerShell`**

```text title="PowerShell"
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.add("Authorization", "Bearer $accessToken")
$headers.add("Accept", "application/json")
$headers.add("Content-Type", "application/json")
```

**`Python`**

```python title="Python"
api_client = create_rooms_api_client(access_token=args["access_token"])
```

**`Ruby`**

```ruby title="Ruby"
configuration = DocuSign_Rooms::Configuration.new
configuration.host = Rails.configuration.rooms_host

api_client = DocuSign_Rooms::ApiClient.new(configuration)
api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
```

## Step 3. Retrieve a Rooms template ID

To create a room by using a template, you must provide a template ID in the request body. To retrieve the template ID, make a request to the `room_templates` endpoint on the Accounts resource of the Rooms API, passing in your \{API_ACCOUNT_ID}.

**`Bash`**

```bash title="Bash"
request_data=$(mktemp /tmp/request-rmtmp.XXXXXX)

echo ""
echo "Attempting to retrieve default role Id"
echo ""
response=$(mktemp /tmp/response-rmtmp.XXXXXX)
Status=$(curl -w '%{http_code}' -i --request GET "https://demo.rooms.docusign.com/restapi/v2/accounts/${account_id}/roles" \
    "${Headers[@]}" \
    --output ${response})
# If the status code returned is greater than 201 (OK / Accepted), display an error message with the API response.
if [[ "$Status" -gt "201" ]]; then
    echo ""
    echo "Unable to retrieve your account's role settings"
    echo ""
    cat $response
    exit 0
fi
echo ""
echo "Response:"
cat $response
echo ""

# Retrieve the role IDs from the API response and put them in an array.
roleIds=`cat $response | grep -o -P '(?<=roleId\":).*?(?=,")'`
arrRoleIds=($roleIds)

# Get the index of the role based on name and use that index for roleId. 
# Name of the role is 'Default Admin'
roles=`cat $response | grep -o -P '(?<=name\":).*?(?=,)'`
element="Default Admin"


roleId=$(GetRoleId "$roles" "$element" "$roleIds")

# Remove the temporary files
rm "$request_data"
rm "$response"

# Retrieve a Rooms office ID
# Create a temporary file to store the response
request_data=$(mktemp /tmp/request-rmtmp.XXXXXX)

echo ""
echo "Attempting to retrieve default office ID"
echo ""
response=$(mktemp /tmp/response-rmtmp.XXXXXX)
Status=$(curl -w '%{http_code}' -i --request GET "https://demo.rooms.docusign.com/restapi/v2/accounts/${account_id}/offices" \
    "${Headers[@]}" \
    --output ${response})
#If the status code returned is greater than 201 (OK / Accepted), display an error message with the API response.
if [[ "$Status" -gt "201" ]]; then
    echo ""
    echo "Unable to retrieve your account's office ids"
    echo ""
    cat $response
    exit 0
fi
echo ""
echo "Response:"
cat $response
echo ""
officeId=$(cat $response | grep officeId | sed 's/.*\"officeId\"://' | sed 's/,.*//')
```

**`C#`**

```csharp title="C#"
var apiClient = new DocuSignClient(basePath);
apiClient.Configuration.DefaultHeader.Add("Authorization", $"Bearer {accessToken}");
var roomTemplatesApi = new RoomTemplatesApi(apiClient);

// Call the Rooms API to create a room
var response = roomTemplatesApi.GetRoomTemplatesWithHttpInfo(accountId);

response.Headers.TryGetValue("X-RateLimit-Remaining", out string remaining);
response.Headers.TryGetValue("X-RateLimit-Reset", out string reset);

if (reset != null && remaining != null)
{
    DateTime resetDate = DateTimeOffset.FromUnixTimeSeconds(long.Parse(reset)).UtcDateTime;
    Console.WriteLine("API calls remaining: " + remaining);
    Console.WriteLine("Next Reset: " + resetDate);
}

return response.Data;
```

**`Java`**

```java title="Java"
RoomTemplatesApi templatesApi = createRoomTemplatesApiClient(
        this.session.getBasePath(),
        this.user.getAccessToken());
RoomTemplatesSummaryList templatesSummaryList = templatesApi.getRoomTemplates(this.session.getAccountId());
```

**`Node.js`**

```javascript title="Node.js"
let roomsApi = new docusignRooms.RoomsApi(dsApiClient);
  let results = null;
let rolesApi = new docusignRooms.RolesApi(dsApiClient);
  let rolesResult = null;

  rolesResult = await new Promise((resolve, reject) => {
    rolesApi.getRoles(
      args.accountId,
      (err, data, response) => {
      if (err) return reject(err);
      resolve({ data, response });
    });
  });

  let headers = rolesResult.response.headers;
  let remaining = headers['x-ratelimit-remaining'];
  let reset = headers['x-ratelimit-reset'];

  if (remaining && reset) {
    const resetInstant = new Date(Number(reset) * 1000);
    console.log(`API calls remaining: ${remaining}`);
    console.log(`Next Reset: ${resetInstant.toISOString()}`);
  }

args.roleId = rolesResult.data.roles[0].roleId;
```

**`PHP`**

```php title="PHP"
$templates_api = $clientService->getRoomTemplatesApi();
if ($routerService->dsTokenOk($GLOBALS['DS_CONFIG']['minimum_buffer_min'])) {
    try {
        $templates = $templates_api->getRoomTemplatesWithHttpInfo($args['account_id']);

        $remaining = $response[2]['x-ratelimit-remaining'] ?? null;
        $reset = $response[2]['x-ratelimit-reset'] ?? null;

        if ($remaining !== null && $reset !== null) {
            $resetInstant = (new DateTime())->setTimestamp((int)$reset);
            error_log("API calls remaining: $remaining");
            error_log("Next Reset: " . $resetInstant->format(\DateTime::ATOM));
        }
    } catch (ApiException $e) {
        return [];
    }
    return $templates[0]['room_templates'];
} else {
    $clientService->needToReAuth($eg);
}
```

**`PowerShell`**

```text title="PowerShell"
$uri = "https://demo.rooms.docusign.com/restapi/v2/accounts/$APIAccountId/roles"
$uriOfficeId = "https://demo.rooms.docusign.com/restapi/v2/accounts/$APIAccountId/offices"

try {
  $response = Invoke-RestMethod -uri $uri -headers $headers -method GET
  $roles = $response.roles
  $roleId = $roles.Where({$_.name -eq "Default Admin"}).roleId
  $roomTemplateId = $response.roomTemplates.roomTemplateId
  Write-Output "roleID:" $roleId
  $response = Invoke-RestMethod -uri $uriOfficeId -headers $headers -method GET
  $officeId = $response.officeSummaries[0].officeId
}
catch {
  Write-Output "Unable to make RoomsAPI Call"
  # On failure, display a notification, X-DocuSign-TraceToken, error message, and the command that triggered the error
  foreach ($header in $_.Exception.Response.Headers) {
    if ($header -eq "X-DocuSign-TraceToken") { Write-Output "TraceToken : " $_.Exception.Response.Headers }
    $int++
  }
  Write-Output "Error : "$_.ErrorDetails.Message
  Write-Output "Command : "$_.InvocationInfo.Line
}
```

**`Python`**

```python title="Python"
room_templates_api = RoomTemplatesApi(api_client)
(templates, status, headers) = room_templates_api.get_room_templates_with_http_info(account_id=args["account_id"])

remaining = headers.get("X-RateLimit-Remaining")
reset = headers.get("X-RateLimit-Reset")

if remaining is not None and reset is not None:
    reset_date = dt.fromtimestamp(int(reset), tz=timezone.utc)
    print(f"API calls remaining: {remaining}")
    print(f"Next Reset: {reset_date}")
```

**`Ruby`**

```ruby title="Ruby"
@templates = RoomApi::GetDataService.new(session).get_templates
```

## Step 4. Construct the request body

Next, create the request body. To create a room, you need to specify some room attributes.

| Attribute           | Description                                                                                                                                                          |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`              | A string value that identifies the room.                                                                                                                             |
| `roleId`            | A string value that specifies which group of users can control the room.                                                                                             |
| `transactionSideId` | A string value that defines the type of transaction that is occurring (such as `buy`, `list`, or `dual`). You can update this up until the transaction is completed. |

**`Bash`**

```bash title="Bash"
request_data=$(mktemp /tmp/request-rms-001.XXXXXX)
printf \
    '
{
  "name": "Sample Room Creation",
  "roleId": "'"$roleId"'",
  "officeId": "'"$officeId"'",
  "RoomTemplateId": "'"$roomTemplateId"'",
  "transactionSideId": "listbuy",
  "fieldData": {
    "data" : {
     "address1": "123 EZ Street",
     "address2": "unit 10",
     "city": "Galaxian",
     "state": "US-HI",
     "postalCode": "11112",
     "companyRoomStatus": "5",
     "comments": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
      }
     }
}' >>$request_data
```

**`C#`**

```csharp title="C#"
var newRoom = BuildRoom(model, clientRole, templateId);
        private static RoomForCreate BuildRoom(
RoomModel model,
RoleSummary clientRole,
int? templateId)
        {
var newRoom = new RoomForCreate
{
    Name = model.Name,
    RoleId = clientRole.RoleId,
    TemplateId = templateId,
    FieldData = new FieldDataForCreate
    {
        Data = new Dictionary<string, object>
        {
            { "address1", "Street 1" },
            { "address2", "Unit 10" },
            { "city", "New York" },
            { "postalCode", "11112" },
            { "companyRoomStatus", "5" },
            { "state", "US-NY" },
            { "comments", @"New room for sale." },
        },
    },
};

return newRoom;
        }
```

**`Java`**

```java title="Java"
Room createdRoom = CreateRoomWithTemplateService.createRoomFromModel(
        roomsApi,
        this.session.getAccountId(),
        CreateRoomWithTemplateService.createRoom(
                adminRole.getRoleId(),
                args.getRoomName(),
                args.getRoomTemplateId()));
```

**`Node.js`**

```javascript title="Node.js"
let roomWithData = makeRoomsWithData(args);
function makeRoomsWithData(args) {
return {
  body: {
    name: args.roomsArgs.roomName,
    roleId: args.roleId,
    templateId: args.roomsArgs.templateId,
    transactionSideId: 'listbuy',
    fieldData: {
      data: {
        address1: '123 EZ Street',
        address2: 'unit 10',
        city: 'Galaxian',
        state: 'US-HI',
        postalCode: '11112',
        companyRoomStatus: '5',
        comments: `Lorem ipsum dolor sit amet, consectetur adipiscing elit,
                  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
                  Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
                  nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
                  reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
                  pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
                  culpa qui officia deserunt mollit anim id est laborum.`,
      },
    },
  },
};
}
```

**`PHP`**

```php title="PHP"
$room = new RoomForCreate(
    [
        'name'        => $args["room_name"],
        'role_id'     => $role_id,
        'template_id' => $args["template_id"],
        'field_data'  => new FieldDataForCreate(
            ['data' =>
                [
                    'address1'          => '111',
                    'city'              => 'Galaxian',
                    'state'             => 'US-HI',
                    'postalCode'        => '88888',
                ]
            ]
        )
    ]
);
```

**`PowerShell`**

```text title="PowerShell"
$body = @"
{
  "name": "Sample Rooms Creation from Template",
  "roleId": "$roleId",
  "officeId": "$officeId",
  "RoomTemplateId": "$roomTemplateId",
  "transactionSideId": "listbuy",
  "fieldData": {
    "data" : {
     "address1": "123 EZ Street",
     "address2": "unit 10",
     "city": "Galaxian",
     "state": "US-HI",
     "postalCode": "11112",
     "companyRoomStatus": "5",
     "comments": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
      }
     }
}
"@
```

**`Python`**

```python title="Python"
roles_api = RolesApi(api_client)
(roles, status, headers) = roles_api.get_roles_with_http_info(account_id=args["account_id"])

remaining = headers.get("X-RateLimit-Remaining")
reset = headers.get("X-RateLimit-Reset")

if remaining is not None and reset is not None:
    reset_date = dt.fromtimestamp(int(reset), tz=timezone.utc)
    print(f"API calls remaining: {remaining}")
    print(f"Next Reset: {reset_date}")

role_id = [role.role_id for role in roles.roles if role.is_default_for_admin][0]

# Step 3. Create RoomForCreate object
room = RoomForCreate(
    name=args["room_name"],
    role_id=role_id,
    template_id=args['template_id'],
    field_data=FieldDataForCreate(
        data={
            'address1': '123 EZ Street',
            'city': 'Galaxian',
            'state': 'US-HI',
            'postalCode': '11111',
        }
    )
)
```

**`Ruby`**

```ruby title="Ruby"
DocuSign_Rooms::RoomForCreate.new(
  {
    name: args[:room_name],
    roleId: args[:role_id],
    transactionSideId: 'listbuy',
    roomTemplateId: args[:template_id],
    officeId: args[:office_id],
    fieldData: DocuSign_Rooms::FieldDataForCreate.new(
      data: {
        address1: '123 EZ Street',
        address2: 'unit 10',
        city: 'Galaxian',
        state: 'US-HI',
        postalCode: '88888',
        companyRoomStatus: '5',
        comments: 'Lorem ipsum dolor sit amet, consectetur adipiscin'
      }
    )
  }
)
```

## Step 5. Call the Rooms API

Now that you have constructed your API headers and request body, you’re ready to create the room. Make a POST request to the [Rooms:CreateRoom](/docs/rooms-api/reference/rooms/rooms/createroom) endpoint and include the request body.

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/Rooms/eg002CreateRoomWithTemplateController.sh), [C#](https://github.com/docusign/code-examples-csharp/blob/master/launcher-csharp/Rooms/Examples/CreateRoomFromTemplate.cs), [Java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/controller/rooms/services/CreateRoomWithTemplateService.java), [Node](https://github.com/docusign/code-examples-node/blob/master/lib/rooms/examples/createRoomFromTemplate.js), [PHP](https://github.com/docusign/code-examples-php/blob/master/src/Services/Examples/Rooms/CreateRoomWithTemplatesService.php), [PowerShell](https://github.com/docusign/code-examples-powershell/blob/master/examples/Rooms/eg002CreateRoomWithTemplateController.ps1), [Python](https://github.com/docusign/code-examples-python/blob/master/app/rooms/examples/eg002_create_room_with_template.py), or [Ruby](https://github.com/docusign/code-examples-ruby/blob/master/app/services/room_api/eg002_create_room_with_template_service.rb).

**`Bash`**

```bash title="Bash"
Status=$(curl -w '%{http_code}' -i --request POST https://demo.rooms.docusign.com/restapi/v2/accounts/${account_id}/rooms \
    "${Headers[@]}" \
    --data-binary @${request_data} \
    --output ${response})
```

**`C#`**

```csharp title="C#"
var response = roomsApi.CreateRoomWithHttpInfo(accountId, newRoom);

response.Headers.TryGetValue("X-RateLimit-Remaining", out remaining);
response.Headers.TryGetValue("X-RateLimit-Reset", out reset);

if (reset != null && remaining != null)
{
    DateTime resetDate = DateTimeOffset.FromUnixTimeSeconds(long.Parse(reset)).UtcDateTime;
    Console.WriteLine("API calls remaining: " + remaining);
    Console.WriteLine("Next Reset: " + resetDate);
}

return response.Data;
```

**`Java`**

```java title="Java"
return new RoomForCreate()
        .name(roomName)
        .roleId(roleId)
        .templateId(templateId)
        .fieldData(
                new FieldDataForCreate()
                        .putDataItem("address1", "123 EZ Street")
                        .putDataItem("address2", "unit 10")
                        .putDataItem("city", "Galaxian")
                        .putDataItem("state", "US-HI")
                        .putDataItem("postalCode", "11112")
                        .putDataItem("companyRoomStatus", "5")
                        .putDataItem("comments",
                                "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."));
```

**`Node.js`**

```javascript title="Node.js"
results = await new Promise((resolve, reject) => {
  roomsApi.createRoom(
    args.accountId,
    roomWithData,
    null,
    (err, data, response) => {
    if (err) return reject(err);
    resolve({ data, response });
  });
});

headers = results.response.headers;
remaining = headers['x-ratelimit-remaining'];
reset = headers['x-ratelimit-reset'];

if (remaining && reset) {
  const resetInstant = new Date(Number(reset) * 1000);
  console.log(`API calls remaining: ${remaining}`);
  console.log(`Next Reset: ${resetInstant.toISOString()}`);
}
```

**`PHP`**

```php title="PHP"
try {
    $response = $rooms_api->createRoomWithHttpInfo($args['account_id'], $room);

    $remaining = $response[2]['x-ratelimit-remaining'] ?? null;
    $reset = $response[2]['x-ratelimit-reset'] ?? null;

    if ($remaining !== null && $reset !== null) {
        $resetInstant = (new DateTime())->setTimestamp((int)$reset);
        error_log("API calls remaining: $remaining");
        error_log("Next Reset: " . $resetInstant->format(\DateTime::ATOM));
    }
} catch (ApiException $e) {
    $clientService->showErrorTemplate($e);
    exit;
}
```

**`PowerShell`**

```text title="PowerShell"
$uri = "https://demo.rooms.docusign.com/restapi/v2/accounts/$APIAccountId/rooms"

try {
  Write-Output "Response:"
  $response = Invoke-WebRequest -uri $uri -UseBasicParsing -headers $headers -body $body -method POST
  $response.Content | ConvertFrom-Json | ConvertTo-Json
}
catch {
  Write-Output "Unable to create a new room."
  #On failure, display a notification, X-DocuSign-TraceToken, error message, and the command that triggered the error
  foreach ($header in $_.Exception.Response.Headers) {
    if ($header -eq "X-DocuSign-TraceToken") { Write-Output "TraceToken : " $_.Exception.Response.Headers[$int] }
    $int++
  }
  Write-Output "Error : "$_.ErrorDetails.Message
  Write-Output "Command : "$_.InvocationInfo.Line
}
```

**`Python`**

```python title="Python"
rooms_api = RoomsApi(api_client)
(response, status, headers) = rooms_api.create_room_with_http_info(
    body=room,
    account_id=args["account_id"],
)

remaining = headers.get("X-RateLimit-Remaining")
reset = headers.get("X-RateLimit-Reset")

if remaining is not None and reset is not None:
    reset_date = dt.fromtimestamp(int(reset), tz=timezone.utc)
    print(f"API calls remaining: {remaining}")
    print(f"Next Reset: {reset_date}")
```

**`Ruby`**

```ruby title="Ruby"
rooms_api = DocuSign_Rooms::RoomsApi.new(api_client)
results, _status, headers = rooms_api.create_room_with_http_info(args[:account_id], body(args))

remaining = headers['X-RateLimit-Remaining']
reset = headers['X-RateLimit-Reset']

if remaining && reset
  reset_date = Time.at(reset.to_i).utc
  puts "API calls remaining: #{remaining}"
  puts "Next Reset: #{reset_date}"
end
```

## Expected response

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

**`Sample response`**

```json title="Sample response"
roleID: 6xxxx2
TemplateId: 3xx2
Response:
{
  "roomId": "3xxxx6",
  "companyId": "1xxx2",
  "name": "Sample Rooms Creation from Template",
  "officeId": "3xxx2",
  "createdDate": "2020-08-06T21:19:19.37",
  "createdByUserId": "2xxxx4",
  "closedStatusId": ""
}
```

## 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), [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), [PHP](https://github.com/docusign/code-examples-php), [PowerShell](https://github.com/docusign/code-examples-powershell), [Python](https://github.com/docusign/code-examples-python), or [Ruby](https://github.com/docusign/code-examples-ruby).
* See [How to create a room with data](/docs/rooms-api/how-to/create-room-with-data).
* See [How to add forms to a room](/docs/rooms-api/how-to/add-form-to-room).
* Learn more about [Using room templates and task lists](/docs/rooms-api/rooms101/templates).
* See how to [Go-Live](/docs/rooms-api/go-live)  with a completed app and find the base path for API calls in the production environment.