On this page

Accessing Methods

2026-03-16

Request Structure

Service Address

Developers need to send requests to the ZEGO server through the access address https://cloud-realtime-asr-api.zegotech.cn.

Communication Protocol

All ZEGO server API interfaces communicate via HTTPS, providing secure communication services.

Request Method

ZEGO server API supports the following HTTP request methods:

  • GET
  • POST
Note

All request parameters (including common parameters and business parameters) are uniformly placed in the Query using the GET request method. For special complex API parameters, place them in the Body using the POST request method.

Common Parameters

Common Request Parameters

Common request parameters are request parameters required by every interface:

ParameterTypeRequiredDescription
AppIdUint32YesAppId, the unique credential assigned by ZEGO to the user.
SignatureStringYesSignature, for signature generation please refer to Signature Mechanism.
SignatureNonceStringYesRandom string.
SignatureVersionStringYesSignature version number, default value is 2.0.
TimestampNumberYesUnix timestamp, in seconds. Maximum allowed deviation of 10 minutes.

Request Example:

https://cloud-realtime-asr-api.zegotech.cn/?Action=StartRealtimeASRTask
&AppId=1234567890
&SignatureNonce=15215528852396
&Timestamp=1234567890
&Signature=7a2c0f11145fb760d607a07b54825013
&SignatureVersion=2.0
Note

For ID-type parameters among non-common request parameters, including UserId, RoomId, etc., the following rules should be followed:

  • Character restrictions: numbers, English characters, '-', '_'.
  • Maximum length:
    • RoomId: 128 bytes.
    • UserId: 32 bytes.

Common Response Parameters

API response results use a unified format, and the returned data format is JSON. Every time an interface is called, whether successful or not, common parameters will be returned.

ParameterTypeDescription
CodeNumberError code.
MessageStringDescription information of the request result.
RequestIdStringRequest ID.
DataObjectResponse object. See each interface response parameter for details.

Response Example:

{
    "Code": 0,
    "Message": "success",
    "RequestId": "1920370518150615040",
    "Data": {
        "TaskId": "1920370518175780864"
    }
}

Signing the requests

To ensure secure API calls, the ZEGOCLOUD server authenticates every API request, which means a request signature must be included in every API request.

Warning

A new signature needs to be generated for every API request.

Get the AppId and Server Secret Key

To generate a request signature, you will need to use the AppId and ServerSecret assigned to your project by ZEGOCLOUD. The AppId is used as the identifier of the request sender, and ServerSecret is the secret key to generate the signature string on the request sender side and verify the signature on the ZEGOCLOUD server. To ensure system security, please keep this information strictly confidential.

You can find the AppId and ServerSecret of your project in the ZEGOCLOUD Admin Console.

Generate a signature

Parameters required to generate a signature

ParameterDescription
AppIdApplication ID.
SignatureNonceA random string.
ServerSecretServer secret key.
TimestampUnix timestamp of the current time, in seconds. A maximum error of 10 minutes is allowed.
ParameterDescription
AppIdApplication ID. The AppId in the public parameters. Get it from the ZEGOCLOUD Admin Console.
SignatureNonceA 16-character hexadecimal random string (hex encoding of 8-byte random number). The SignatureNonce in the public parameters. Refer to Signature sample code for how to generate.
ServerSecretServer secret key. Get it from the ZEGOCLOUD Admin Console.
TimestampUnix timestamp of the current time, in seconds. Refer to Signature sample code for how to generate, with a maximum error of 10 minutes.
Note

The values of the SignatureNonce and Timestamp parameters used to generate the signature must be consistent with those of the common parameters.

Signature algorithm

Signature = md5(AppId + SignatureNonce + ServerSecret + Timestamp)

Format of the Signature string

The Signature is a hex string of 32 characters in lower case.

Signature sample code

ZEGOCLOUD provides sample code in various programming languages for generating the signature.

import (
   "crypto/md5"
   "crypto/rand"
   "encoding/hex"
   "fmt"
   "log"
   "time"
)
// Signature=md5(AppId + SignatureNonce + ServerSecret + Timestamp)
func GenerateSignature(appId uint32, signatureNonce string, serverSecret string, timestamp int64) (Signature string){
   data := fmt.Sprintf("%d%s%s%d", appId, signatureNonce, serverSecret, timestamp)
   h := md5.New()
   h.Write([]byte(data))
   return hex.EncodeToString(h.Sum(nil))
}
func main() {
   /* Generate a 16-character random hexadecimal string (16 bits) */
   nonceByte := make([]byte, 8)
   rand.Read(nonceByte)
   signatureNonce := hex.EncodeToString(nonceByte)
   log.Printf(signatureNonce)
   appId := 12345       // Use your appId and serverSecret
   serverSecret := "9193cc662a4c0ec135ec71fb57194b38"
   timestamp := time.Now().Unix()
   /* appId:12345
      signatureNonce:4fd24687296dd9f3
      serverSecret:9193cc662a4c0ec135ec71fb57194b38
      timestamp:1615186943      2021/03/08 15:02:23
      signature:43e5cfcca828314675f91b001390566a
    */
   log.Printf("signature:%v", GenerateSignature(uint32(appId), signatureNonce, serverSecret, timestamp))
}

Signing failures

When a signature verification fails, an error code will be returned.

return codedescription
100000004Signature expired.
100000005Invalid signature.

Debug API Online

Previous

Enable Translation

Next

Debug Server API Online