tencent cloud


Introduction to REST API

Last updated: 2024-04-18 15:40:48
    The RESTful API is a part of the TRTC Call's backend HTTP Hub Management Interface Hub, providing developers with a simplified management entry. For the RESTful APIs currently supported by the TRTC Call, please refer to REST API List.
    For security reasons, the RESTful API is only available via HTTPS Interface.

    Use Conditions

    The REST API is currently in beta. During the beta period, applications (SDKAppId) that have enabled the Group Call Version of TRTC Call can use the REST API. You can also activate a free trial of the experience version. For version descriptions and activation guidelines, refer to Activate the Service.
    Currently, the RESTful API is available only in specific versions of TUICallKit across different platforms, as detailed in the table below:
    Version number
    Android/iOS/Flutter/uni-app (client)
    ≥ 1.7.1
    ≥ 1.4.6
    WeChat Mini Program
    ≥ 1.5.1
    Only after all participating platforms/frameworks are upgraded to the versions mentioned above, can the corresponding call information be peeked at in the console.
    During the Beta Testing Period, the RESTful API supports querying data from the past 7 days.

    RESTful API List

    Feature Overview
    Access records through callId
    Access records by condition

    Calling method

    Request URL

    The URL format of the RESTful API is as follows:
    The meanings and values of each parameter are as follows (both parameter names and their values are case-sensitive):
    Fetching Value
    Request protocol
    The request protocol is HTTPS, and the request method is POST
    reserved domain name
    China callkit.trtc.tencent-cloud.com
    Protocol Version Number
    Fixed as v1
    Management Classification
    v1/records/get_record_by_callId, where `records` is a kind
    The word `command`, combined with `kind`, is used to indicate a specific business feature
    Example: v1/records/get_record_by_callId, where `get_record_by_callId` is a command
    The application identifier accessed in the console
    Obtained when applying for integration
    username, must be an App Administrator Account when calling RESTful APIs
    Using the Admin account of IM
    password corresponding to username
    Refer to Generating UserSig
    Identifies the random number parameter for the current request
    32-bit unsigned integer random number, ranging from 0 to 4294967295
    Request Format
    Fixed value: json
    After obtaining or purchasing package bundles, an administrator account named `administrator` will be created in the IM account system. Please use `administrator` for the identifier parameter in requests. If you cancel or delete an administrator in IM Account Management, please correctly specify the administrator account and corresponding UserSig.
    Apps can either generate a UserSig for the administrator account at every RESTful API call, or generate a fixed UserSig for repeated use. However, it is crucial to pay attention to the UserSig's validity period.
    During operations such as creating or entering a room, the system will automatically import IM accounts into the IM System. Please be aware.

    HTTP Request Body Format

    The RESTful API only supports the POST method, and its request body is in JSON format. For specific body formats, refer to the detailed description of each API.
    The POST body cannot be empty. Even if a protocol does not require any information to be carried, it must still include an empty JSON object, namely {}.

    HTTP return code

    Unless a network error occurs (e.g., 502 error), the call result of the RESTful API is always 200. The actual error code and error message of the API call are returned in the HTTP response body.

    HTTP Response Body Format

    The response body of the RESTful API is also in JSON format, and its format conforms to the following characteristics:
    "errorCode": 0,
    "errorMessage": "Success",
    "requestId": "1c8960ac38d61be38b6fb219db0182d1",
    "data": {}
    The response body must contain three attributes: errorCode, errorMessage, requestId. Their meanings are as follows:
    Error code, 0 for success, others for failure
    Error message
    Request Unique Identifier

    Sample call

    Below is an example of accessing call records for a specified callId through RESTful APIs.
    HTTPS Request:
    POST /records/get_record_by_callId?usersig=xxx&identifier=admin&sdkappid=88888888&random=99999999&contenttype=json HTTP/2
    Host: callkit.trtc.tencent-cloud.com
    Content-Length: 36
    "callId": "2ae7d549-c441-4a9b-87c0-61810fe19582"
    HTTPS Response:
    HTTP/2 200 OK
    Date: Fri, 21 Apr 2023 06:06:16 GMT
    Content-Length: 112
    Connection: keep-alive
    "errorCode": 0,
    "errorMessage": "Success",
    "requestId": "9f01db503f2006ad10c45f4f4609e38d",
    "data": {
    "callId": "2ae7d549-c441-4a9b-87c0-61810fe19582",
    "sdkAppId": 88888888,
    "mediaType": "video",
    "roomId": "123456",
    "startCallTs": 1688705638,
    "acceptTs": 1688705641,
    "endTs": 1688705668,
    "caller": "alice",
    "totalUserNumber": 2,
    "callType": "single",
    "callResult": "normal_end",
    "callees": [

    Common Error Codes for RESTful APIs

    Error code
    Request succeeded
    The current application needs to purchase the TUICallKit Group Call Version Package to use
    Invalid request parameters, please check whether mandatory parameters are missing or incorrectly entered
    UserSig is invalid
    UserSig has expired
    Requesting user is not a Super Administrator
    Request frequency limited
    Error in parsing request body, please check if the request parameter type is correct
    Unknown error code
    System internal error, please Submit a ticket to contact technical personnel


    Is there a chance that REST API requests timeout, receiving no response?

    You can confirm from the following aspects:
    1. The backend REST interface's timeout setting is 3s, the caller's timeout setting should be longer than 3s.
    2. telnet callkit.trtc.tencent-cloud.com 443 to confirm if the service port can be connected.
    3. Use curl -I https://callkit.trtc.tencent-cloud.com for a simple test to see if the status code is 200.
    4. Confirm whether the machine's DNS server configuration is an internal DNS server or a public DNS server. If it is an internal DNS server, ensure that the DNS server's network egress and the region ISP of the machine's network egress IP match.
    5. It is recommended for business callers to use the long connection + connection pool pattern.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support