# Update a cloud transcoding task (/en/api-reference/api-ref/cloud-transcoding/update)

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

Updates an existing Cloud Transcoding task.

- OpenAPI: /openapi/cloud-transcoding/cloud-transcoding.en.yaml
- Operation ID: update-cloud-transcoding-task
- Method: PATCH
- Path: /v1/projects/{appId}/rtsc/cloud-transcoder/tasks/{taskId}
- Endpoint: https://api.sd-rtn.com/v1/projects/{appId}/rtsc/cloud-transcoder/tasks/{taskId}

## Servers

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

Use this endpoint to `Update` a Cloud Transcoding task.


## Authorization

This endpoint requires authentication.

- `basicAuth`

## Parameters

- `Content-Type` (header, required, string) - The request content type. Use `application/json`.
  - Allowed: `application/json`
- `X-Request-ID` (header, optional, string) - UUID (Universally Unique Identifier), used to identify this request.

If the request fails, print out the value in the log to troubleshoot the problem. If the response status code of the request is not 2XX, then the response header may not contain this field.
- `appId` (path, required, string) - The App ID of your project from Agora Console.
- `taskId` (path, required, string) - The transcoding task UUID used to identify the cloud transcoder for this request.
- `builderToken` (query, required, string) - The `tokenName` you obtained in the response body of the `Acquire` method. See Acquire a builder token.
- `sequenceId` (query, required, string) - The sequence number of the `Update` request. Each subsequent `Update` request must use a value greater than the previous one. A value equal to or lower than the current one is rejected with a `400` error.
- `updateMask` (query, required, string) - Specifies the configuration item to be updated. Set it to `services.cloudTranscoder.config` to indicate a full update.
  - Allowed: `services.cloudTranscoder.config`

### Request

- When updating a cloud transcoder, the request body must contain all the fields from the `Create` request in the request body. For fields that you do not need to update, use the original values. See [Updatable fields](#updatable-fields) for the Cloud Transcoding parameters you can modify.


## Request body

- `services` (object, required)
  - `services.cloudTranscoder` (object, required)
    - `services.cloudTranscoder.serviceType` (string, required) - Should be `"cloudTranscoderV2"`.

The service type. Use "cloudTranscoderV2".
      - Allowed: `cloudTranscoderV2`
    - `services.cloudTranscoder.config` (object, required) - Same as the fields you set in the `Create` request body.
      - `services.cloudTranscoder.config.transcoder` (object, required)
        - `services.cloudTranscoder.config.transcoder.idleTimeout` (number) - The maximum period, in seconds, that Cloud Transcoder can be idle. If the idle state exceeds this value, Cloud Transcoder is automatically destroyed.
          - Default: `300`
          - Range: `[1, 86400]`
        - `services.cloudTranscoder.config.transcoder.streamProcessMode` (string) - If this parameter is not specified, the working mode of Cloud transcoder is the merge mode. You can specify the following modes:
- `heterogeneous-single`: Heterogeneous single stream mode. The types of input stream and output stream can be different or the same. The currently supported stream types are RTC and CDN.
- `single`: RTC stream relay mode. Relays the host's audio and video data and signaling in the source channel to the destination channel.
          - Allowed: `mix` | `heterogeneous-single` | `single`
          - Default: `mix`

          :::info[Note]
          - If you set `streamProcessMode` to `heterogeneous-single` or `single`, then the `audioInputs` or `videoInputs` list may contain at most one item.
          
          - If you need to mix audio, combine images, or mix audio and combine images, no `streamProcessMode` settings are required.
          :::
        - `services.cloudTranscoder.config.transcoder.audioInputs` (array) - Audio input source list, supports two types: RTC audio stream and CDN audio stream. If you specify multiple input audio sources, the streams are mixed.

          :::info[Note]
          Either `rtc` or `streamUrl` must be filled in.
          :::
          - `services.cloudTranscoder.config.transcoder.audioInputs.items` (object)
            - `services.cloudTranscoder.config.transcoder.audioInputs.items.streamUrl` (string) - The URL of the audio source stream. Required when the audio input source is CDN.
            - `services.cloudTranscoder.config.transcoder.audioInputs.items.volume` (number) - The volume of the audio source stream. This parameter only takes effect when the audio input source is CDN.
              - Default: `100`
              - Range: `[0, 200]`
            - `services.cloudTranscoder.config.transcoder.audioInputs.items.repeat` (number) - The number of times to play the media stream. `1` means play once, `-1` means loop, and any positive integer specifies a playback count.
              - Default: `1`
            - `services.cloudTranscoder.config.transcoder.audioInputs.items.rtc` (object) - When the audio input source is RTC, this object is required.
              - `services.cloudTranscoder.config.transcoder.audioInputs.items.rtc.rtcChannel` (string, required) - The RTC channel name for the input source. Currently, you can only subscribe to audio and video sources from a single channel; the audio and video sources must belong to the same channel.
              - `services.cloudTranscoder.config.transcoder.audioInputs.items.rtc.rtcUid` (number, required) - The UID of the input source user. This UID uniquely identifies the user whose audio or video stream is being transcoded in the RTC channel.
              - `services.cloudTranscoder.config.transcoder.audioInputs.items.rtc.rtcToken` (string, required) - The token that Cloud Transcoder uses to join the input RTC channel for transcoding. Using
a token ensures channel security and prevents malicious users from disrupting other
users in the channel. See [Token authentication](/en/realtime-media/rtc/build/authenticate-users/authentication-workflow) for details.

Cloud Transcoder's UID in the input RTC channel is randomly assigned by Agora.
When generating this token, set `uid` to `0`.
        - `services.cloudTranscoder.config.transcoder.videoInputs` (array) - Video input source list, supports RTC video stream and CDN video stream. If you specify multiple input video sources, the streams are merged.
          - `services.cloudTranscoder.config.transcoder.videoInputs.items` (object)
            - `services.cloudTranscoder.config.transcoder.videoInputs.items.streamUrl` (string) - The URL of the video source stream. Required when the video input source is CDN.
            - `services.cloudTranscoder.config.transcoder.videoInputs.items.repeat` (number) - The number of times to play the media stream. `1` means play once, `-1` means loop, and any positive integer specifies a playback count.
              - Default: `1`
            - `services.cloudTranscoder.config.transcoder.videoInputs.items.rtc` (object) - This object is required when the video input source is RTC.
              - `services.cloudTranscoder.config.transcoder.videoInputs.items.rtc.rtcChannel` (string, required) - The RTC channel name for the input source. Currently, you can only subscribe to audio and video sources from a single channel; the audio and video sources must belong to the same channel.
              - `services.cloudTranscoder.config.transcoder.videoInputs.items.rtc.rtcUid` (number, required) - The UID of the input source user. This UID uniquely identifies the user whose audio or video stream is being transcoded in the RTC channel.
              - `services.cloudTranscoder.config.transcoder.videoInputs.items.rtc.rtcToken` (string, required) - The token that Cloud Transcoder uses to join the input RTC channel for transcoding. Using
a token ensures channel security and prevents malicious users from disrupting other
users in the channel. See [Token authentication](/en/realtime-media/rtc/build/authenticate-users/authentication-workflow) for details.

Cloud Transcoder's UID in the input RTC channel is randomly assigned by Agora.
When generating this token, set `uid` to `0`.
            - `services.cloudTranscoder.config.transcoder.videoInputs.items.placeholderImageUrl` (string) - The URL of the placeholder image displayed when the user is offline. It must be a valid image URL and contain the `jpg` or `png` suffix.
            - `services.cloudTranscoder.config.transcoder.videoInputs.items.region` (object, required)
              - `services.cloudTranscoder.config.transcoder.videoInputs.items.region.x` (number, required) - The x coordinate of the image on the canvas (px). The x coordinate is the horizontal displacement of the upper left corner of the image relative to the origin, where the upper left corner of the canvas is the origin.
                - Range: `[0, 1920]`
              - `services.cloudTranscoder.config.transcoder.videoInputs.items.region.y` (number, required) - The y coordinate of the image on the canvas (px). The y coordinate is the vertical displacement of the upper left corner of the image relative to the origin, where the upper left corner of the canvas is the origin.
                - Range: `[0, 1920]`
              - `services.cloudTranscoder.config.transcoder.videoInputs.items.region.width` (number, required) - The width of the video region (px). The region must fit within the canvas and can't exceed 1920 × 1080.
                - Range: `[120, 1920]`
              - `services.cloudTranscoder.config.transcoder.videoInputs.items.region.height` (number, required) - The height of the video region (px). The region must fit within the canvas and can't exceed 1920 × 1080.
                - Range: `[120, 1920]`
              - `services.cloudTranscoder.config.transcoder.videoInputs.items.region.zOrder` (number, required) - The layer order of the host screen. `0` represents the bottom layer. `100` represents the top layer.
                - Range: `[0, 100]`
        - `services.cloudTranscoder.config.transcoder.canvas` (object, required)
          - `services.cloudTranscoder.config.transcoder.canvas.width` (number, required) - The width of the canvas (px).
            - Range: `[120, 1920]`
          - `services.cloudTranscoder.config.transcoder.canvas.height` (number, required) - The height of the canvas (px).
            - Range: `[120, 1920]`
          - `services.cloudTranscoder.config.transcoder.canvas.color` (number, required) - The background color of the canvas as a decimal RGB value.
            - Range: `[0, 16777215]`
          - `services.cloudTranscoder.config.transcoder.canvas.backgroundImage` (string) - Canvas background image. Must be a valid image URL with a `jpg` or `png` suffix. If omitted, there is no canvas background image.
          - `services.cloudTranscoder.config.transcoder.canvas.fillMode` (string) - Fill mode for the canvas background image.
            - Allowed: `FILL` | `FIT`
            - Default: `FILL`
        - `services.cloudTranscoder.config.transcoder.waterMarks` (array) - Watermark list. To add no watermarks, omit this field. An empty list isn't accepted.
          - Min items: `1`
          - `services.cloudTranscoder.config.transcoder.waterMarks.items` (object)
            - `services.cloudTranscoder.config.transcoder.waterMarks.items.imageUrl` (string, required) - The URL of the watermark image.
            - `services.cloudTranscoder.config.transcoder.waterMarks.items.region` (object, required)
              - `services.cloudTranscoder.config.transcoder.waterMarks.items.region.x` (number, required) - The x coordinate of the watermark on the canvas (px). The x coordinate is the horizontal displacement of the upper left corner of the watermark relative to the upper left corner of the canvas.
                - Range: `[0, 1920]`
              - `services.cloudTranscoder.config.transcoder.waterMarks.items.region.y` (number, required) - The y coordinate of the watermark on the canvas (px). The y coordinate is the vertical displacement of the upper left corner of the watermark relative to the upper left corner of the canvas.
                - Range: `[0, 1920]`
              - `services.cloudTranscoder.config.transcoder.waterMarks.items.region.width` (number, required) - The width of the watermark (px).
                - Range: `[120, 1920]`
              - `services.cloudTranscoder.config.transcoder.waterMarks.items.region.height` (number, required) - The height of the watermark (px).
                - Range: `[120, 1920]`
              - `services.cloudTranscoder.config.transcoder.waterMarks.items.region.zOrder` (number, required) - The layer order of the watermark. `0` represents the bottom layer. `100` represents the top layer.
                - Range: `[0, 100]`
            - `services.cloudTranscoder.config.transcoder.waterMarks.items.fillMode` (string) - Watermark fill mode:
- `"FILL"`: Scale the image and crop it in the center while maintaining the aspect ratio.
- `"FIT"`: Scale the image to fill the display while maintaining the aspect ratio.
              - Allowed: `FILL` | `FIT`
              - Default: `FILL`
        - `services.cloudTranscoder.config.transcoder.outputs` (array, required) - Configure output settings to publish to a single RTC channel or to CDN addresses.
The array can contain only one output.

RTC and CDN outputs are mutually exclusive. You must specify either `streamUrl` or `rtc`, but not both.
          - Min items: `1`
          - Max items: `1`
          - `services.cloudTranscoder.config.transcoder.outputs.items` (object)
            - `services.cloudTranscoder.config.transcoder.outputs.items.streamUrl` (array) - The CDN addresses to publish the transcoded stream to. You can specify up to 10 addresses. All addresses share the `audioOption` and `videoOption` settings of this output.
              - Min items: `1`
              - Max items: `10`
              - `services.cloudTranscoder.config.transcoder.outputs.items.streamUrl.items` (string)
            - `services.cloudTranscoder.config.transcoder.outputs.items.rtc` (object) - Required for publishing to an RTC channel. Currently, you can publish to only one RTC channel.
              - `services.cloudTranscoder.config.transcoder.outputs.items.rtc.rtcChannel` (string, required) - The RTC channel name for the transcoded audio and video.
              - `services.cloudTranscoder.config.transcoder.outputs.items.rtc.rtcUid` (number, required) - The UID of Cloud Transcoder in the output RTC channel. Make sure this value is different from the UID of other users in the channel.
              - `services.cloudTranscoder.config.transcoder.outputs.items.rtc.rtcToken` (string, required) - The token that the Cloud Transcoder uses to join the output RTC channel. Using a token
ensures channel security and prevents malicious users from disrupting other users in the
channel. See [Token authentication](/en/realtime-media/rtc/build/authenticate-users/authentication-workflow) for details.

When generating this token, set `uid` to the value of `outputs.rtc.rtcUid`.
            - `services.cloudTranscoder.config.transcoder.outputs.items.audioOption` (object)
              - `services.cloudTranscoder.config.transcoder.outputs.items.audioOption.profileType` (string) - Audio properties of the transcoded output:
- `"AUDIO_PROFILE_DEFAULT"`: 48 kHz sampling rate, music encoding, mono channel, maximum encoding bitrate is 64 Kbps.
- `"AUDIO_PROFILE_SPEECH_STANDARD"`: 32 kHz sampling rate, speech encoding, mono channel, maximum encoding bitrate is 18 Kbps.
- `"AUDIO_PROFILE_MUSIC_STANDARD"`: 48 KHz sampling rate, music encoding, mono channel, maximum encoding bitrate is 64 Kbps.
- `"AUDIO_PROFILE_MUSIC_STANDARD_STEREO"`: 48 KHz sampling rate, music encoding, stereo channel, maximum encoding bitrate is 80 Kbps.
- `"AUDIO_PROFILE_MUSIC_HIGH_QUALITY"`: 48 KHz sampling rate, music encoding, mono channel, maximum encoding bitrate is 96 Kbps.
- `"AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO"`: 48 kHz sampling rate, music encoding, dual channels, and a maximum encoding bitrate of 128 Kbps.
                - Allowed: `AUDIO_PROFILE_DEFAULT` | `AUDIO_PROFILE_SPEECH_STANDARD` | `AUDIO_PROFILE_MUSIC_STANDARD` | `AUDIO_PROFILE_MUSIC_STANDARD_STEREO` | `AUDIO_PROFILE_MUSIC_HIGH_QUALITY` | `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO`
                - Default: `AUDIO_PROFILE_DEFAULT`
            - `services.cloudTranscoder.config.transcoder.outputs.items.videoOption` (object)
              - `services.cloudTranscoder.config.transcoder.outputs.items.videoOption.width` (number, required) - The width of the transcoded output video (px). The output resolution can't exceed 1920 × 1080.
                - Range: `[120, 1920]`
              - `services.cloudTranscoder.config.transcoder.outputs.items.videoOption.height` (number, required) - The height of the transcoded output video (px). The output resolution can't exceed 1920 × 1080.
                - Range: `[120, 1920]`
              - `services.cloudTranscoder.config.transcoder.outputs.items.videoOption.bitrate` (number, required) - The bitrate of the transcoded output video.
                - Range: `[1, 10000]`
              - `services.cloudTranscoder.config.transcoder.outputs.items.videoOption.codec` (string, required) - The codec used to transcode the output video.

 **Possible values**:
- `"H264"`: Standard H.264 encoding. Supported for RTC and CDN outputs.
- `"H265"`: Standard H.265 encoding. Supported for RTC and CDN outputs.
- `"VP8"`: Standard VP8 encoding. Supported for RTC outputs only.
                - Allowed: `H264` | `H265` | `VP8`
              - `services.cloudTranscoder.config.transcoder.outputs.items.videoOption.fps` (number) - The frame rate (fps) of the transcoded output video.
                - Default: `15`
                - Range: `[1, 30]`
              - `services.cloudTranscoder.config.transcoder.outputs.items.videoOption.mode` (string) - Can be set to `RAW`, which means the output video is not transcoded. The encoding format of the input video remains unchanged.

 If the output video is transcoded, do not set this field.
 In `RAW` mode, the number of inputs set in `videoInputs` can only be 1.
              - `services.cloudTranscoder.config.transcoder.outputs.items.videoOption.lowBitrateHighQuality` (boolean) - Whether to enable low-bitrate high-quality mode.

### Request body example

```json
{
  "services": {
    "cloudTranscoder": {
      "serviceType": "cloudTranscoderV2",
      "config": {
        "transcoder": {
          "idleTimeout": 300,
          "audioInputs": [
            {
              "rtc": {
                "rtcChannel": "test01",
                "rtcUid": 123,
                "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
              }
            }
          ],
          "canvas": {
            "width": 960,
            "height": 480,
            "color": 0,
            "backgroundImage": "https://example.jpg",
            "fillMode": "FIT"
          },
          "waterMarks": [
            {
              "imageUrl": "https://example.com/watermark.png",
              "region": {
                "x": 0,
                "y": 0,
                "width": 120,
                "height": 120,
                "zOrder": 50
              }
            }
          ],
          "videoInputs": [
            {
              "rtc": {
                "rtcChannel": "test01",
                "rtcUid": 123,
                "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
              },
              "placeholderImageUrl": "https://example.jpg",
              "region": {
                "x": 0,
                "y": 0,
                "width": 320,
                "height": 360,
                "zOrder": 2
              }
            }
          ],
          "outputs": [
            {
              "rtc": {
                "rtcChannel": "test",
                "rtcUid": 1000,
                "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
              },
              "audioOption": {
                "profileType": "AUDIO_PROFILE_MUSIC_STANDARD"
              },
              "videoOption": {
                "fps": 30,
                "codec": "H264",
                "bitrate": 800,
                "width": 960,
                "height": 480,
                "lowBitrateHighQuality": false
              }
            }
          ]
        }
      }
    }
  }
}
```

## Request examples

### curl

```bash
# Use a sequenceId greater than the previous update request.
# Send the full configuration; keep unchanged fields at their original values.
curl --request PATCH \
        --url 'https://api.sd-rtn.com/v1/projects/<app_id>/rtsc/cloud-transcoder/tasks/<task_id>?builderToken=<builder_token>&sequenceId=1&updateMask=services.cloudTranscoder.config' \
        --header 'Authorization: Basic <credentials>' \
        --header 'Content-Type: application/json' \
        --data '
      {
        "services": {
          "cloudTranscoder": {
            "serviceType": "cloudTranscoderV2",
            "config": {
              "transcoder": {
                "idleTimeout": 300,
                "audioInputs": [
                  {
                    "rtc": {
                      "rtcChannel": "test01",
                      "rtcUid": 123,
                      "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
                    }
                  },
                  {
                    "rtc": {
                      "rtcChannel": "test01",
                      "rtcUid": 456,
                      "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
                    }
                  }
                ],
                "canvas": {
                  "width": 960,
                  "height": 480,
                  "color": 0,
                  "backgroundImage": "https://example.jpg",
                  "fillMode": "FIT"
                },
                "waterMarks": [
                  {
                    "imageUrl": "https://example.png",
                    "region": {
                      "x": 0,
                      "y": 0,
                      "width": 120,
                      "height": 120,
                      "zOrder": 50
                    }
                  }
                ],
                "videoInputs": [
                  {
                    "rtc": {
                      "rtcChannel": "test01",
                      "rtcUid": 123,
                      "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
                    },
                    "placeholderImageUrl": "https://example.jpg",
                    "region": {
                      "x": 0,
                      "y": 0,
                      "width": 320,
                      "height": 360,
                      "zOrder": 2
                    }
                  },
                  {
                    "rtc": {
                      "rtcChannel": "test01",
                      "rtcUid": 456,
                      "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
                    },
                    "placeholderImageUrl": "https://example.jpg",
                    "region": {
                      "x": 320,
                      "y": 0,
                      "width": 320,
                      "height": 320,
                      "zOrder": 2
                    }
                  }
                ],
                "outputs": [
                  {
                    "rtc": {
                      "rtcChannel": "test",
                      "rtcUid": 1000,
                      "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
                    },
                    "audioOption": {
                      "profileType": "AUDIO_PROFILE_MUSIC_STANDARD"
                    },
                    "videoOption": {
                      "fps": 30,
                      "codec": "H264",
                      "bitrate": 800,
                      "width": 960,
                      "height": 480,
                      "lowBitrateHighQuality": false
                    }
                  }
                ]
              }
            }
          }
        }
      }'
```

### Python

```python
import requests

url = "https://api.sd-rtn.com/v1/projects/<app_id>/rtsc/cloud-transcoder/tasks/<task_id>"

# Use a sequenceId greater than the previous update request.
params = {
    "builderToken": "<builder_token>",
    "sequenceId": "1",
    "updateMask": "services.cloudTranscoder.config"
}

headers = {
    "Authorization": "Basic <credentials>",
    "Content-Type": "application/json"
}

# Send the full configuration; keep unchanged fields at their original values.
data = {
    "services": {
        "cloudTranscoder": {
            "serviceType": "cloudTranscoderV2",
            "config": {
                "transcoder": {
                    "idleTimeout": 300,
                    "audioInputs": [
                        {
                            "rtc": {
                                "rtcChannel": "test01",
                                "rtcUid": 123,
                                "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
                            }
                        },
                        {
                            "rtc": {
                                "rtcChannel": "test01",
                                "rtcUid": 456,
                                "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
                            }
                        }
                    ],
                    "canvas": {
                        "width": 960,
                        "height": 480,
                        "color": 0,
                        "backgroundImage": "https://example.jpg",
                        "fillMode": "FIT"
                    },
                    "waterMarks": [
                        {
                            "imageUrl": "https://example.png",
                            "region": {
                                "x": 0,
                                "y": 0,
                                "width": 120,
                                "height": 120,
                                "zOrder": 50
                            }
                        }
                    ],
                    "videoInputs": [
                        {
                            "rtc": {
                                "rtcChannel": "test01",
                                "rtcUid": 123,
                                "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
                            },
                            "placeholderImageUrl": "https://example.jpg",
                            "region": {
                                "x": 0,
                                "y": 0,
                                "width": 320,
                                "height": 360,
                                "zOrder": 2
                            }
                        },
                        {
                            "rtc": {
                                "rtcChannel": "test01",
                                "rtcUid": 456,
                                "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
                            },
                            "placeholderImageUrl": "https://example.jpg",
                            "region": {
                                "x": 320,
                                "y": 0,
                                "width": 320,
                                "height": 320,
                                "zOrder": 2
                            }
                        }
                    ],
                    "outputs": [
                        {
                            "rtc": {
                                "rtcChannel": "test",
                                "rtcUid": 1000,
                                "rtcToken": "aab8b8f5a8cd4469a63042fcfafe7***"
                            },
                            "audioOption": {
                                "profileType": "AUDIO_PROFILE_MUSIC_STANDARD"
                            },
                            "videoOption": {
                                "fps": 30,
                                "codec": "H264",
                                "bitrate": 800,
                                "width": 960,
                                "height": 480,
                                "lowBitrateHighQuality": False
                            }
                        }
                    ]
                }
            }
        }
    }
}

response = requests.patch(url, params=params, headers=headers, json=data)

print(response.status_code)
print(response.text)
```

### Node.js

```javascript
const axios = require("axios");

const url = "https://api.sd-rtn.com/v1/projects/<app_id>/rtsc/cloud-transcoder/tasks/<task_id>";

// Use a sequenceId greater than the previous update request.
const params = {
  builderToken: "<builder_token>",
  sequenceId: "1",
  updateMask: "services.cloudTranscoder.config",
};

const headers = {
  Authorization: "Basic <credentials>",
  "Content-Type": "application/json",
};

// Send the full configuration; keep unchanged fields at their original values.
const data = {
  services: {
    cloudTranscoder: {
      serviceType: "cloudTranscoderV2",
      config: {
        transcoder: {
          idleTimeout: 300,
          audioInputs: [
            {
              rtc: {
                rtcChannel: "test01",
                rtcUid: 123,
                rtcToken: "aab8b8f5a8cd4469a63042fcfafe7***",
              },
            },
            {
              rtc: {
                rtcChannel: "test01",
                rtcUid: 456,
                rtcToken: "aab8b8f5a8cd4469a63042fcfafe7***",
              },
            },
          ],
          canvas: {
            width: 960,
            height: 480,
            color: 0,
            backgroundImage: "https://example.jpg",
            fillMode: "FIT",
          },
          waterMarks: [
            {
              imageUrl: "https://example.png",
              region: {
                x: 0,
                y: 0,
                width: 120,
                height: 120,
                zOrder: 50,
              },
            },
          ],
          videoInputs: [
            {
              rtc: {
                rtcChannel: "test01",
                rtcUid: 123,
                rtcToken: "aab8b8f5a8cd4469a63042fcfafe7***",
              },
              placeholderImageUrl: "https://example.jpg",
              region: {
                x: 0,
                y: 0,
                width: 320,
                height: 360,
                zOrder: 2,
              },
            },
            {
              rtc: {
                rtcChannel: "test01",
                rtcUid: 456,
                rtcToken: "aab8b8f5a8cd4469a63042fcfafe7***",
              },
              placeholderImageUrl: "https://example.jpg",
              region: {
                x: 320,
                y: 0,
                width: 320,
                height: 320,
                zOrder: 2,
              },
            },
          ],
          outputs: [
            {
              rtc: {
                rtcChannel: "test",
                rtcUid: 1000,
                rtcToken: "aab8b8f5a8cd4469a63042fcfafe7***",
              },
              audioOption: {
                profileType: "AUDIO_PROFILE_MUSIC_STANDARD",
              },
              videoOption: {
                fps: 30,
                codec: "H264",
                bitrate: 800,
                width: 960,
                height: 480,
                lowBitrateHighQuality: false,
              },
            },
          ],
        },
      },
    },
  },
};

axios
  .patch(url, data, { headers, params })
  .then((response) => {
    console.log(response.status);
    console.log(response.data);
  })
  .catch((error) => {
    console.error("Error:", error.response ? error.response.data : error.message);
  });
```


### Response

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

- If the returned status code is not `200`, the request failed.

- If the request fails, use the `X-Request-ID` value in the log to troubleshoot the problem. If the response status code is not `2XX`, then the response header may not contain this field.


## Responses

### 200

The request succeeded and returned task information. `sequenceId` is the value you passed, and `services.cloudTranscoder.config` contains the updated configuration.

- `taskId` (string) - A UUID used to identify the cloud transcoder for this request operation.
- `createTs` (number) - Unix timestamp (seconds) when the transcoding task was created.
- `status` (string) - The running status of the transcoding task:
- `"IDLE"`: Task not started.
- `"PREPARED"`: The task has received a start request.
- `"STARTING"`: The task is starting.
- `"CREATED"`: Task initialization completed.
- `"STARTED"`: The task has started.
- `"IN_PROGRESS"`: Task in progress.
- `"STOPPING"`: The task is stopping.
- `"STOPPED"`: The task has stopped.
- `"EXIT"`: The task exited normally.
- `"FAILURE_STOP"`: The task exited abnormally.
- `sequenceId` (string) - The sequence ID.
- `services` (object)
  - `services.cloudTranscoder` (object)
    - `services.cloudTranscoder.config` (object) - Same as the fields you set in the `Create` request body.
    - `services.cloudTranscoder.createTs` (number) - Unix timestamp (in seconds) when the service was created.
    - `services.cloudTranscoder.details` (object) - Reserved field.
    - `services.cloudTranscoder.message` (string) - Reserved field.
    - `services.cloudTranscoder.serviceType` (string) - Should be `"cloudTranscoderV2"`.
    - `services.cloudTranscoder.status` (string) - The running status of the transcoding service in the transcoding task:
- `"serviceIdle"`: The service has not started.
- `"serviceReady"`: The service is ready to start.
- `"serviceStarted"`: The service has started.
- `"serviceInProgress"`: The service is currently running.
- `"serviceCompleted"`: The service has stopped, and all tasks have been completed.
- `"servicePartialCompleted"`: The service has stopped, but the task was only partially completed.
- `"serviceValidationFailed"`: The service failed due to invalid parameters.
- `"serviceAbnormal"`: The service exited unexpectedly.
- `"serviceUnknown"`: The service status is unknown.

 This field is meant for the Agora technical team to investigate any issues. You do not need to focus on it.
- `eventHandlers` (object)
- `execution` (object)
- `properties` (object)
- `variables` (object)
- `workflows` (object)
### default

The request failed.

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

### Reference

The `Update` request supports modifying the following fields only:

- Add or delete `rtc` members in `audioInputs[]` and `videoInputs[]` to subscribe or unsubscribe from the host's audio and video streams.
- Modify the `region` field in `videoInputs[]` to update the host's combined picture layout.
- Modify the `audioOption` and `videoOption` fields in `outputs[]` to update the transcoding output audio and video configurations.


### Response

See Updatable fields for the Cloud Transcoding parameters you can modify.


## Response examples

### 200

```json
{
  "createTs": 1661324613,
  "eventHandlers": {},
  "execution": {
    "workflows": {}
  },
  "properties": {},
  "sequenceId": "1",
  "services": {
    "cloudTranscoder": {
      "config": {},
      "createTs": 1661324614,
      "details": {},
      "message": "",
      "serviceType": "cloudTranscoderV2",
      "status": "serviceInProgress"
    }
  },
  "status": "IN_PROGRESS",
  "taskId": "609f28f2644f1ae1ceb041b7047e3***",
  "variables": {},
  "workflows": {}
}
```
### default

```json
{
  "message": "Describes why the request failed."
}
```
