Elastic Cloud Server
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
Domain Name Service
VPC Endpoint
Cloud Connect
Enterprise Switch
Security & Compliance
Web Application Firewall
Host Security Service
Data Encryption Workshop
Database Security Service
Advanced Anti-DDoS
Data Security Center
Container Guard Service
Situation Awareness
Managed Threat Detection
Cloud Certificate Manager
Anti-DDoS Service
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GaussDB(for MySQL)
Distributed Database Middleware
GaussDB(for openGauss)
Developer Services
Distributed Cache Service
Simple Message Notification
Application Performance Management
Application Operations Management
API Gateway
Cloud Performance Test Service
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Cloud Communications
Message & SMS
Cloud Ecosystem
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP License Service
Support Plans
Customer Operation Capabilities
Partner Support Plans
Professional Services
Intelligent EdgeFabric
SDK Developer Guide
API Request Signing Guide
Koo Command Line Interface
Help Center> Live> API Reference> Examples> Example 1: Creating a Transcoding Template
Updated at: Apr 11, 2022 GMT+08:00

Example 1: Creating a Transcoding Template

This section describes how to call Live APIs to create a transcoding template.

Involved APIs

To use token-based authentication, obtain a user token and add X-Auth-Token to the request header of the service API when making an API request.


  1. Obtain a user token and use it to authenticate the calling of Live APIs.

    For details, see Making an API Request. CN North-Beijing4 is used as an example. If you need to call a Live API in another region, replace the endpoint with the IAM endpoint of the corresponding region.

    Content-Type: application/json
      "auth": {
        "identity": {
          "methods": [
          "password": {
            "user": {
              "name": "username", 
              "password": "password", 
              "domain": {
                "name": "domainname" 
        "scope": {
          "project": {
             "name": "projectname"      
    As shown in Figure 1, information in the red box indicates the user token.
    Figure 1 Obtaining the user token

  2. Select the POST request method and enter the request URI.

    POST{project_id}/template/transcodings is the endpoint of Live. You can obtain the endpoint from Endpoints.

    The region where an IAM API is called must be the same as the region where a Live API is called. For example, the user token obtained when you call an IAM API in the CN North-Beijing4 region can only be used to authenticate the requests for calling Live APIs in the CN North-Beijing4 region.

  3. In the request header, add X-Auth-Token and set its value to be the token obtained in 1.
  4. Add the following parameters to the request message body. For more information about the parameters, see the API for creating a transcoding template.

      "domain": "",
      "app_name": "live",
          "templateName": "",
          "quality": "lsd",
          "hdlb": "off",
          "PVC": "off",
          "codec": "H264",
          "width": 854,
          "height": 480,
          "bitrate": 600,
          "video_frame_rate": 0,
          "protocol": "HLS",
          "iFrameInterval": 0

    If the request succeeds, only a status code 201 Created is returned.

    If the request fails, the following error code and error description are returned along with a status code 400 Bad Request:

    "error_code": "LIVE.100011001",
    "error_msg": "Failed to verify template settings."

Did you find this page helpful?

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?

Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel