> 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/update-alias.md).

# Update Alias

### Request

Update an existing alias to modify its metadata, including name, authentication settings, stream key, or expiration time. This endpoint helps keep alias configurations current and secure.

**Endpoint:**

```
POST /organization/api/v1/alias/update/:id
```

**URL:**

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

### Query Parameter

#### Path Parameters

| Parameter | Type   | Required | Description                                  | Example       |
| --------- | ------ | -------- | -------------------------------------------- | ------------- |
| **id**    | string | ✅ Yes    | Unique identifier of the alias to be updated | `"abc123xyz"` |

#### Body Parameters

| Parameter       | Type    | Required | Description                                                          | Example                   |
| --------------- | ------- | -------- | -------------------------------------------------------------------- | ------------------------- |
| **type**        | string  | ✅ Yes    | The valid values alias.                                              | `"live"` , `"conference"` |
| **name**        | string  | ❌ No     | Optional alias name.                                                 | `"Weekly Sync"`           |
| **passcode**    | string  | ❌ No     | Optional passcode for basic authentication. Can be null to clear it. | `"secure123"` or null     |
| **jwt\_secret** | string  | ❌ No     | Optional JWT secret for advanced authentication.                     | `"jwtSecretKey123"`       |
| **stream\_key** | string  | ❌ No     | Optional stream key used for broadcasting.                           | `"streamKeyXYZ"`          |
| **expired\_at** | integer | ❌ No     | Optional expiration time in UNIX timestamp format (seconds).         | `"1737456308"`            |

#### Example Request

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

{
  "type": "conference",
  "name": "Updated Alias Name",
  "passcode": null
}
```

### Responses

{% tabs %}
{% tab title="200" %}
Alias updated successfully.

**Response Body Parameters**

| Parameter       | Type    | Description                                          | Example                     |
| --------------- | ------- | ---------------------------------------------------- | --------------------------- |
| **id**          | string  | ID of the updated alias.                             | `"abc123xyz"`               |
| **type**        | string  | Type of alias.                                       | `"live"`, or `"conference"` |
| **name**        | string  | Updated alias name.                                  | `"Monthly Meeting"`         |
| **passcode**    | string  | Updated passcode (or null if removed).               | `"newpass456"` or null      |
| **jwt\_secret** | string  | JWT secret value (may be null).                      | `"jwtSecretKey123"` or null |
| **stream\_key** | string  | Stream key (may be null).                            | `"streamKeyABC"` or null    |
| **expired\_at** | integer | Updated expiration time in UNIX timestamp (seconds). | `"1737456308"`              |

**Example**

```
{
  "data": {
    "id": "xxyzx",
    "type": "conference",
    "name": "Updated Alias Name",
    "passcode": null,
    "jwt_secret": null,
    "stream_key": null,
    "expired_at": 1737456308
  }
}
```

{% endtab %}

{% tab title="400" %}
Returned when:

* Required parameters are missing
* The alias does not exist
* The body format is incorrect

**Example**

```
{
  "error": {
    "message": "Invalid request body or alias not found"
  }
}
```

{% endtab %}

{% tab title="401" %}
Returned when authentication fails due to a missing or invalid token.

**Example**

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

{% endtab %}
{% endtabs %}
