# Create A Live Entity

## /v1/live\_entities

<mark style="color:green;">`POST`</mark> `https://api.uiza.sh/v1/live_entities`

#### Request Body

| Name        | Type    | Description                                                                                                                                                                                              |
| ----------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name        | string  | The live entity name with maximum 100 characters.                                                                                                                                                        |
| region      | string  | Select one available region in Usa Network that is closest to the streamer location                                                                                                                      |
| description | string  | An arbitrary string attached to the object. Often useful for displaying to users.                                                                                                                        |
| dvr         | boolean | Indicates whether Digital Video Recorder (DVR) is enabled for the `live_entity`. Set as `true` to enable and as `false` to disable. The default value is false.                                          |
| encode      | boolean | Indicates whether encoding mode is enabled for the `live_entity`. Set as `true` to enable and as `false` to disable. The default value is `false`, when the encode is `true`, it required a `preset_id`. |
| preset\_id  | string  | The identifier of the `video_preset` to be applied when encoding your signal.                                                                                                                            |
| relay       | array   | A list of ingest servers to be relayed. Contains `url` and `key` and `name` (optional) in each ingest server.                                                                                            |

{% tabs %}
{% tab title="200 " %}
{% tabs %}
{% tab title=" live\_entities with encoding" %}

```
{
    "id": "b7f02d48-d0ec-4c34-86d1-247a38eda4e1",
    "name": "Test event with encoding",
    "description": "Event for Test",
    "ingest": null,
    "playback": null,
    "relay": [
        {
            "url": "rtmp://youtu.be/live",
            "key": "Abco1",
            "name": "Youtube 1"
        }
    ],
    "region": "in-bangalore-1",
    "status": "init",
    "dvr": false,
    "encode": true,
    "preset": {
        "id": "9432fa62-5988-11ea-883b-028fc5698662",
        "name": "Uiza LIVE 720p",
        "description": "",
        "is_default": true,
        "profiles": [
            {
                "id": "85844e8b-6281-11ea-883b-028fc5698662",
                "name": "720p H264 30fps Normal Latency",
                "segment_duration": 4,
                "orientation": "landscape",
                "video_profile": {
                    "video_resolution": "720",
                    "video_codec": "H264",
                    "video_bitrate": "2000K",
                    "video_frame_rate": "30"
                },
                "audio_profile": {
                    "audio_channel": "2",
                    "audio_codec": "AAC",
                    "audio_bitrate": "128K",
                    "audio_frame_rate": "1"
                }
            }
        ],
        "created_at": "2020-02-27T17:42:52Z",
        "updated_at": "2020-02-29T16:47:34Z"
    },
    "created_at": "2020-03-23T07:22:34Z",
    "updated_at": "2020-03-23T07:22:34Z"
}
```

{% endtab %}

{% tab title=" live\_entities without encoding" %}

```
{
  "id": "2b970a39-874a-4d2a-be8a-fd445646d74c",
  "name": "Test event without encoding",
  "description": "Event for Test",
  "region": "in-bangalore-1",
  "status": "init",
  "dvr": false,
  "encode": false,
  "ingest": null,
  "playback": null,
  "relay": [
    {
      "url": "rtmp://youtu.be/live",
      "key": "Abco1",
      "name": "Youtube 1"
    }
  ],
  "preset": null,
  "created_at": "2020-03-23T07:22:34Z",
  "updated_at": "2020-03-23T07:22:34Z"
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="400 " %}
{% tabs %}
{% tab title="Missing name" %}

```
{
 "message": "Your request is missing name parameter. Please, verify and resubmit.",
 "error_type": "invalid_request_error"
}
```

{% endtab %}

{% tab title="Missing region" %}

```
{
 "message": "Your request is missing region parameter. Please, verify and resubmit.",
 "error_type": "invalid_request_error"
}
```

{% endtab %}

{% tab title="Invalid region" %}

```
{
 "message": "The requested region is invalid. See the list of available regions here: docs.uiza.io/getting-started/regions.",
 "error_type": "invalid_request_error"
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="401 " %}

```
{
 "message": "You are unauthorized to access the requested resource. Please verify and resubmit.",
 "error_type": "invalid_request_error"
}
```

{% endtab %}

{% tab title="500 " %}

```
{
 "message": "An unexpected error occurred on Uiza's end.",
 "error_type": "api_error"
}
```

{% endtab %}
{% endtabs %}

{% code title="\[Live entity without encoding] Sample Request" %}

```
curl --location --request POST 'https://api.uiza.sh/v1/live_entities' \
--header 'Authorization: uap-c1ffbff4db954ddcb050c6af0b43ba56-41193b64' \
--data-raw '{
    "name": "Test event with encoding",
    "region": "in-bangalore-1",
    "description": "Event for Test",
    "encode": false,
    "relay": [
        {
            "url": "rtmp://youtu.be/live",
            "key": "Abco1",
            "name": "Youtube 1"
        }
    ]
}'
```

{% endcode %}

{% code title="\[Live entity with encoding] Sample Request" %}

```
curl --location --request POST 'https://api.uiza.sh/v1/live_entities' \
--header 'Authorization: uap-c1ffbff4db954ddcb050c6af0b43ba56-41193b64' \
--data-raw '{
    "name": "Test event with encoding",
    "region": "in-bangalore-1",
    "description": "Event for Test",
    "encode": true,
    "preset_id": "9432fa62-5988-11ea-883b-028fc5698662",
    "relay": [
        {
            "url": "rtmp://youtu.be/live",
            "key": "Abco1"
        }
    ]
}'
```

{% endcode %}

{% hint style="info" %}
Defining your region helps Uiza allocate the resources that are closest to your streamers' locations. This will minimize the risks of network issues. While we are adding more and more regions to our network, here are the currently available regions.&#x20;

`in-bangalore-1` (Bangalore - India)

`in-mumbai-1` (Mumbai - India)

`sg-singapore-1` (Singapore - Singapore)
{% endhint %}
