# 创建房间 (/zh-CN/api-reference/meeting/restful/api/create-room)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

创建会议房间 API。

会议房间创建后，默认保留 5 天。

## URL [#url]

`POST /{region}/conference/apps/{appId}/v1/rooms/{roomUuid}`

域名详见[保障 REST 服务高可用](/zh-CN/realtime-media/meeting/build/high-availability)。

### 路径参数 [#路径参数]

| 参数 | 类型 | 是否必填 | 描述 |
| --- | --- | --- | --- |
| `region` | String | 必填 | 服务区域，目前仅支持设为 `cn`，代表中国大陆。 |
| `appId` | String | 必填 | 项目 App ID，详见[获取 App ID](/zh-CN/realtime-media/meeting/build/enable-service#获取-app-id)。 |
| `roomUuid` | String | 必填 | [create-room-restful-html-0-3-3 details](#table-slot-create-room-restful-html-0-3-3) |

<a id="table-slot-create-room-restful-html-0-3-3"></a>

**create-room-restful-html-0-3-3 details**

会议房间 UUID 是会议房间的唯一标识符。一般情况下，长度在 64 字符以内；如果房间需要使用页面录制，长度在 50 字符以内。支持的字符集范围（共 88 个字符，空格不支持）：

- 26 个小写英文字母 a~z
- 26 个大写英文字母 A~Z
- 10 个数字 0-9
- "!"、"#"、"$"、"%"、"&"、"("、")"、"+"、"-"、":"、";"、"&lt;"、"="、"."、"&gt;"、"?"、"@"、"["、"]"、"^"、"_"、"&#123;"、"&#125;"、"|"、"~"、","

## 请求 [#请求]

本节展示 HTTP 请求内容。

### 请求 Header [#请求-header]

- `Content-Type`：`application/json`。代表指定请求 Body 的类型为 JSON，以 `UTF-8` 字符编码进行编码。

- `Authorization`：用于 HTTP Token 认证的鉴权字段。每次发送 HTTP 请求时，都必须填入 `Authorization` 字段。详见[实现 HTTP Token 认证](/zh-CN/realtime-media/meeting/build/http-token-auth)。

### 请求 Body [#请求-body]

| 字段 | 类型 | 是否必填 | 描述 |
| --- | --- | --- | --- |
| `roomTemplate` | String | 必填 | 房间模板。对于会议房间，需设为 `conf_finity_v1`。 |
| `roomName` | String | 必填 | 房间名称。非房间的唯一标识符，一般代表用户的会议主题。最长不可超过 64 字符。 |
| `roomProperties` | Object | 非必填 | 房间属性。 |
| `roomProperties.schedule` | Object | 非必填 | 会议计划，包含开始时间、持续时长、拖堂时长等属性。 |
| `roomProperties.schedule.startTime` | Integer | 非必填 | 会议开始时的 Unix 时间戳，单位为毫秒，UTC 时间。该字段不可更新。 |
| `roomProperties.schedule.duration` | Integer | 非必填 | 会议持续时长，单位为秒。 会议持续时长结束时，当前会议进入[会议结束状态](/zh-CN/realtime-media/meeting/reference/webhook-events#会议状态变更事件)，此时用户依然可以正常进入会议和逗留。 如果同时设置了会议持续时长和拖堂时长，那么当开启录制时，会按照二者之和向上取整设置最长录制时间（`maxRecordingHour`）。 |
| `roomProperties.schedule.closeDelay` | Integer | 非必填 | 会议拖堂时长，单位为秒。 会议持续时长结束后，会议拖堂时间也结束时，当前会议进入[会议房间关闭状态](/zh-CN/realtime-media/meeting/reference/webhook-events#会议状态变更事件)，此时会议内用户会被踢出，用户也无法再进入会议。 如果同时设置了会议持续时长和拖堂时长，那么当开启录制时，会按照二者之和向上取整设置最长录制时间（`maxRecordingHour`）。 |
| `roomProperties.security` | Object | 非必填 | 安全模块。 |
| `roomProperties.security.shareScreen` | Object | 非必填 | 屏幕共享开启设置。 |
| `roomProperties.security.shareScreen.enable` | Integer | 非必填 | [create-room-restful-html-0-10-3 details](#table-slot-create-room-restful-html-0-10-3) |
| `roomProperties.security.startVideo` | Object | 非必填 | 视频开启设置。 |
| `roomProperties.security.startVideo.enable` | Integer | 非必填 | [create-room-restful-html-0-12-3 details](#table-slot-create-room-restful-html-0-12-3) |
| `roomProperties.security.startAudio` | Object | 非必填 | 音频开启设置。 |
| `roomProperties.security.startAudio.enable` | Integer | 非必填 | [create-room-restful-html-0-14-3 details](#table-slot-create-room-restful-html-0-14-3) |
| `roomProperties.security.joinWithMuteAudio` | Object | 非必填 | 加入时静音设置。 |
| `roomProperties.security.joinWithMuteAudio.enable` | Integer | 非必填 | [create-room-restful-html-0-16-3 details](#table-slot-create-room-restful-html-0-16-3) |
| `roomProperties.aimm` | Integer | 非必填 | AI 会议纪要。 |
| `roomProperties.aimm.state` | Integer | 非必填 | [create-room-restful-html-0-18-3 details](#table-slot-create-room-restful-html-0-18-3) |
| `roomProperties.webhookConfig` | Object | 非必填 | Webhook 回调事件配置。 配置接收事件的地址和订阅事件列表后，你可以在这些事件发生后收到通知。 |
| `roomProperties.webhookConfig.urls` | Array[String] | 非必填 | 你的服务器地址，必须为 HTTPS 地址。该地址用于接收 Webhook 回调事件。 接收事件时需要实现 POST 方法，`Content-Type` 为 `application/json`。 |
| `roomProperties.webhookConfig.cmds` | Array[Integer] | 非必填 | [create-room-restful-html-0-21-3 details](#table-slot-create-room-restful-html-0-21-3) |
| `roomProperties.roleConfig.cohost.limit` | Integer | 非必填 | 助理主持人（`cohost`）的数量上限。 |
| `roomProperties.roleConfig.participant.limit` | Integer | 非必填 | 参会人（`participant`）的数量上限。 |

<a id="table-slot-create-room-restful-html-0-10-3"></a>

**create-room-restful-html-0-10-3 details**

是否允许开启屏幕共享：

- `1`：允许。
- `0`：不允许。

<a id="table-slot-create-room-restful-html-0-12-3"></a>

**create-room-restful-html-0-12-3 details**

是否允许开启视频：

- `1`：允许。
- `0`：不允许。

<a id="table-slot-create-room-restful-html-0-14-3"></a>

**create-room-restful-html-0-14-3 details**

是否允许开启音频：

- `1`：允许。
- `0`：不允许。

<a id="table-slot-create-room-restful-html-0-16-3"></a>

**create-room-restful-html-0-16-3 details**

用户加入房间时，是否对该用户静音（不开启音频）：

- `1`：禁音。
- `0`：不禁音。

<a id="table-slot-create-room-restful-html-0-18-3"></a>

**create-room-restful-html-0-18-3 details**

是否开启 AI 会议纪要：

- `1`：开启。
- `0`：不开启。

<a id="table-slot-create-room-restful-html-0-21-3"></a>

**create-room-restful-html-0-21-3 details**

可订阅的 Webhook 事件列表：

- `1`：会议状态变更。
- `20`：用户进出会议。
- `1001`：页面录制状态变更。
- `1002`：页面录制文件上传成功。
- `1003`：AI 会议纪要生成成功。

### 请求示例 [#请求示例]

```shell
curl -X POST 'https://api.sd-rtn.com/{region}/conference/apps/{yourAppId}/v1/rooms/{roomUuid}' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Authorization: agora token={apaasToken}' \
--data-raw '{
    "roomName": "test_conference",
    "roomTemplate": "conf_finity_v1",
    "roomProperties": {
        "schedule": {
            "startTime": 1655452800000,
            "duration": 600,
            "closeDelay": 300
        },
        "roleConfig": {
            "cohost":{
                "limit": 10
            },
            "participant":{
                "limit": 200
            }
        },
        "security": {
            "joinWithMuteAudio": {
                "enable": 1
            },
            "startVideo": {
                "enable": 1
            }
        }
    }
}'
```

## 响应 [#响应]

本节展示 HTTP 响应内容。

### 响应 Body [#响应-body]

| 字段 | 类型 | 描述 |
| --- | --- | --- |
| `code` | Integer | [create-room-restful-html-1-1-2 details](#table-slot-create-room-restful-html-1-1-2) |
| `msg` | String | 响应的文字信息。 |
| `ts` | Number | 当前服务端的 Unix 时间戳。UTC 时间，单位为毫秒。 |

<a id="table-slot-create-room-restful-html-1-1-2"></a>

**create-room-restful-html-1-1-2 details**

响应状态码：

- `0`：请求成功。
- 非 0：请求失败。详见[响应状态码](/zh-CN/realtime-media/meeting/reference/response-code)。

### 响应示例 [#响应示例]

```json
{
  "code": 0,
  "msg": "Success",
  "ts": 1610167740309
}
```
