> For the complete documentation index, see [llms.txt](https://doc.datagram.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.datagram.network/apis/api-reference/alias/create-alias.md).

# Create Alias

### Request

The Create Alias endpoint allows you to generate a new alias. This alias can be configured with specific parameters such as expiration time and authentication type (Basic or JWT), enabling secure and time-bound access control.

**Endpoint:**

```
POST /organization/api/v1/alias/create
```

**URL:**

```
https://link.api.datagram.network/organization/api/v1/alias/create
```

### Body Parameters

<table><thead><tr><th width="103">Parameter</th><th width="108">Type</th><th width="92">Required</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><strong>type</strong></td><td>string</td><td>✅ Yes</td><td>The type of alias. Valid values: “live”, “conference”.</td><td><code>conference</code></td></tr><tr><td><strong>name</strong></td><td>string</td><td>❌ No</td><td>Custom name for the alias.</td><td><code>WeeklySyncMeeting</code></td></tr><tr><td><strong>passcode</strong></td><td>string</td><td>❌ No</td><td>Optional passcode for basic authentication.</td><td><code>secure123</code></td></tr><tr><td><strong>jwt_secret</strong></td><td>string</td><td>❌ No</td><td>Optional JWT secret for advanced authentication.</td><td><code>eyJhbGciOi...</code> or null</td></tr><tr><td><strong>stream_key</strong></td><td>string</td><td>❌ No</td><td>Optional stream key used for streaming.</td><td><code>stream_4571AB</code> or null</td></tr><tr><td><strong>expired_at</strong></td><td>integer</td><td>✅ Yes</td><td>Expiry time for the alias in UNIX timestamp (seconds).</td><td><code>30</code></td></tr></tbody></table>

#### Example Request

```
POST /organization/api/v1/alias/create HTTP/1.1
Host: link.api.datagram.network
Authorization: Bearer <your_token>
Content-Type: application/json

{
  "type": "live",
  "name": "New Alias Name",
  "passcode": "pass",
  "jwt_secret": null,
  "stream_key": null,
  "expired_at": 1737456308
}
```

### Responses

{% tabs %}
{% tab title="201" %}
Alias successfully created.

**Response Body Parameters**

<table><thead><tr><th width="120">Parameter</th><th width="109">Type</th><th width="146">Description</th><th>Example</th></tr></thead><tbody><tr><td><strong>id</strong></td><td>string</td><td>Unique identifier for the created alias.</td><td><code>xxyzx</code></td></tr><tr><td><strong>type</strong></td><td>string</td><td>Type of alias (“live” or “conference”).</td><td><code>"live"</code></td></tr><tr><td><strong>name</strong></td><td>string</td><td>Name of the alias.</td><td><code>DemoSessionAlias</code></td></tr><tr><td><strong>passcode</strong></td><td>string</td><td>Passcode for basic authentication.</td><td><code>demo1234</code></td></tr><tr><td><strong>jwt_secret</strong></td><td>string</td><td>JWT secret for advanced authentication. May be null if not provided.</td><td><code>eyJhbGciOi...</code></td></tr><tr><td><strong>stream_key</strong></td><td>string</td><td>Stream key associated with the alias. May be null if not used.</td><td><code>stream_XYZ123</code></td></tr><tr><td><strong>expired_at</strong></td><td>integer</td><td>Expiration time of the alias in UNIX timestamp format (seconds).</td><td><code>1737456308</code></td></tr></tbody></table>

**Example**

```
{
  "data": {
    "id": "xxyzx",
    "type": "live",
    "name": "New Alias Name",
    "passcode": "pass",
    "jwt_secret": null,
    "stream_key": null,
    "expired_at": 1737456308
  }
}
```

{% endtab %}

{% tab title="400" %}

| Field       | Type    | Description                           | Example       |
| ----------- | ------- | ------------------------------------- | ------------- |
| **message** | string  | Describes the type of error           | `"NOT_FOUND"` |
| **status**  | integer | HTTP status code indicating the error | `400`         |

**Example Response**

```
{
    "error": {
        "message": "NOT_FOUND",
        "status": 400
    }
}
```

<br>
{% endtab %}

{% tab title="401" %}
Authentication failed. The token is missing, invalid, or expired.

<table><thead><tr><th width="111">Field </th><th width="104">Type</th><th width="139">Description</th><th>Example</th></tr></thead><tbody><tr><td><strong>error</strong></td><td>object</td><td>Contains the error details object.</td><td><p><code>"UNAUTHORIZED"</code></p><p></p></td></tr></tbody></table>

**Example Response**

```
{
    "error": {
        "message": "UNAUTHORIZED"
    }
}
```

{% endtab %}
{% endtabs %}
