# Create a new chat room

## Create a new chat room

<mark style="color:green;">`POST`</mark> `https://api.iflychat.com/api/1.1/room/create`

You can use iFlyChat API to programmatically create a new global or private chat room

#### Request Body

| Name           | Type   | Description                                                                                                                                                                                                    |
| -------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| api\_key       | string | The private API key of your website                                                                                                                                                                            |
| room\_name     | string | Name of the chat room to be created                                                                                                                                                                            |
| room\_role     | string | The room role identifier. This determines the access to the chat room based upon user role. For example, in Drupal user role id for anonymous user is 1, and for authenticated user it is 2. Use 0 if not sure |
| room\_private  | string | 1 if the room is going to be private                                                                                                                                                                           |
| room\_moderate | string | 1 if the room is going to be moderated                                                                                                                                                                         |

{% tabs %}
{% tab title="200 The response will contain room\_id of the newly created chat room which you can store in your database for internal mapping  " %}

```
{
  "room_id": 5
}
```

{% endtab %}
{% endtabs %}

### Curl Command

This the sample curl command required to make HTTP request:

```
curl -H "Content-Type: application/json" -X POST https://api.iflychat.com/api/1.1/room/create -d "{\"api_key\":\"Wr4vpoJ_ET3lpBdX9E9TutUic4Dgb-gc7RGzuZvKqZgW5\", \"room_name\": \"test_room\", \"room_role\": \"1\"}"
```
