# Create or update a transcoding template (/en/api-reference/api-ref/cloud-transcoding/template-create)

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

Creates or updates a transcoding template.

- OpenAPI: /openapi/cloud-transcoding/cloud-transcoding.en.yaml
- Operation ID: create-or-update-transcoding-template
- Method: POST
- Path: /v1/projects/{appId}/rtls/abr/config/codecs/{codecId}
- Endpoint: https://api.sd-rtn.com/v1/projects/{appId}/rtls/abr/config/codecs/{codecId}

## Servers

- https://api.sd-rtn.com

Create or update a transcoding template under the specified App ID.


## Authorization

This endpoint requires authentication.

- `basicAuth`

## Parameters

- `Content-Type` (header, required, string) - The request content type. Use `application/json`.
  - Allowed: `application/json`
- `appId` (path, required, string) - The App ID of the project
- `codecId` (path, required, string) - The ID of the transcoding template.

## Request body

- `enabled` (boolean, required) - Whether to enable this transcoding template:
- `true`: Enable the template
- `false`: Do not enable the template
- `video` (object, required)
  - `video.width` (number, required) - **Maximum value**: `1920`

 The width of the transcoded output video (px).
  - `video.height` (number, required) - **Maximum value**: `1920`

 The height of the transcoded output video (px).
  - `video.fps` (number, required) - **Maximum value**: `60`

 The frame rate (fps) of the transcoded output video.

### Request body example

```json
{
  "enabled": true,
  "video": {
    "width": 1280,
    "height": 720,
    "fps": 15
  }
}
```

## Request examples

### curl

```bash
curl --request post \
      --url https://api.sd-rtn.com/v1/projects/:appId/rtls/abr/config/codecs/:codecId \
      --header 'Authorization: Basic <credentials>' \
      --header 'Content-Type: <string>'
```

### Python

```python
import requests

    url = "https://api.sd-rtn.com/v1/projects/:appId/rtls/abr/config/codecs/:codecId"

    headers = {
        "Authorization": "Basic <credentials>",
        "Content-Type": "<string>"
    }

    response = requests.request("post", url, headers=headers)

    print(response.text)
```

### Node.js

```javascript
const url = 'https://api.sd-rtn.com/v1/projects/:appId/rtls/abr/config/codecs/:codecId';
    const options = {
      method: 'post',
      headers: {Authorization: 'Basic <credentials>', 'Content-Type': '<string>'}
    };

    fetch(url, options)
      .then(res => res.json())
      .then(json => console.log(json))
      .catch(err => console.error(err));
```


### Response

- If the returned status code is `200`, the request was successful. The response body contains the result of the request.

- If the returned status code is not `200`, the request failed. The response body includes the `detail` and `reason` for failure. Refer to [status codes](/en/api-reference/api-ref/cloud-transcoding/status-codes) to understand the possible reasons for failure.


## Responses

### 200

The request succeeded.

- `status` (string) - The status of the request.

Status of this request:

 - success: The request was successful.
 - error: The request failed.
  - Allowed: `success` | `error`
### default

The request failed.

- `message` (string) - Describes why the request failed.
- `status` (string) - The status of the request.

Status of this request:

 - success: The request was successful.
 - error: The request failed.
  - Allowed: `success` | `error`

## Response examples

### 200

```json
{
  "status": "success"
}
```
### default

```json
{
  "status": "error",
  "message": "Description of the reason for the request failure."
}
```

### Response example

```json
{
      "status": "Status of this request:\n- `success`: Request was successful.\n- `error`: Request failed.\n"
    }
```
