logo
In-app Chat
Powered Byspreading
On this page

Send a call invitation


Overview

This interface is used to create a call invitation in general mode.

After the call invitation is successfully created, the user who sent the invitation (caller) will receive a notification that the invitation has been created through the following ZIM SDK callback interface:

iOSAndroidmacOSWindows
callInvitationCreatedonCallInvitationCreatedcallInvitationCreatedonCallInvitationCreated
WebFlutterReact Native
callInvitationCreatedonCallInvitationCreatedcallInvitationCreated

The user who is invited (callee) will receive a notification of the invitation:

iOSAndroidmacOSWindows
callInvitationReceivedonCallInvitationReceivedcallInvitationReceivedonCallInvitationReceived
WebFlutterUnity3DReact Native
callInvitationReceivedonCallInvitationReceivedOnCallInvitationReceivedcallInvitationReceived

Request method and endpoint

  • Request method: POST
  • Request endpoint: https://zim-api.zego.im/?Action=CallInvite
  • Protocol: HTTPS
  • Rate limit: 20 times/second

Request parameters

The following list only shows the request parameters for this interface and some public parameters. For a complete list of public parameters, please refer to Accessing Server APIs - Public parameters.

ParameterTypeRequiredDescription
FromUserIdStringYesThe user ID of the caller (registered).
UserIdsArray of StringYesA list of user IDs of the callees, with a maximum of 9 users. If you need to increase the limit, please contact ZEGOCLOUD technical support.
TimeoutNumberNoThe call timeout period, in seconds, with a value range of (0, 600]. If the value is 0 or empty, the value will be 90 by 90.
ExtendedDataStringNoThe extended field, with a maximum length of 2 KB.
OfflinePushObjectYesOffline push configuration, please refer to MessageBody Introduction for the details of offline push parameter.
Note

FromUserId and UserIds only support numbers, English characters, and the following special characters: '!', '#', '$', '%', '&', '(', ')', '+', '', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', ' ', '{', '}', '|', '~'.

Sample request

  • Request URL:

    Untitled
    https://zim-api.zego.im/?Action=CallInvite
    &<Public Parameters>
    
    1
    Copied!
  • Request Body:

    Untitled
    {
        "FromUserId": "user0",
        "UserIds": [
            "uid1",
            "uid2"
        ],
        "Timeout": 90,
        "ExtendedData": "ExtendedData",
        "OfflinePush": {
            "Enable": 1,
            "Title": "title",
            "Content": "content",
            "Payload": "payload"
        }
    }
    
    1
    Copied!

Response Parameters

ParameterTypeDescription
CodeNumberThe return code.
MessageStringThe description of the operation result.
RequestIdStringThe request ID.
CallIdStringThe call ID.
CreateTimeNumberThe timestamp when the call invitation was created.
ErrorUsersArray of Object

Information of users who failed to be invited.

  • Code is 0:

    • ErrorUsers is empty, indicating that the invitation was successfully sent to all specified users.
    • ErrorUsers is not empty, indicating that the invitation failed to be sent to some specified users. Please refer to SubCode for handling.
  • Code is not 0:

    • ErrorUsers is empty, indicating parameter error, interface rate limit, or system error.
    • ErrorUsers is not empty, indicating that the invitation failed to be sent to all specified users.
└UserIdStringThe ID of the user who failed to be invited.
└SubCodeNumberThe specific return code for the failure.

Response Example

Untitled
{
    "Code": 0,
    "Message": "success",
    "RequestId": "343649807833778782",
    "CallId": "12261423186766631832",
    "CreateTime": "1713249504000",
    "ErrorUsers":[
        {
            "UserId": "uid2",
            "SubCode": 660500002
        }
    ] 
}
1
Copied!

Return Codes

The following list only shows the return codes related to the business logic of the interface. For a complete list of return codes, please refer to Return codes.

Return CodeDescriptionSolution
660000002Invalid parameter.Check the input parameter.
660300005The QPS exceeds the AppID level limit.Try again later.
660500002The operator is not registered.Register the operator.
660900003All callees must be registered.Check the registration status of the callees or try again later.
660900007The length of the callees list (UserIds) exceeds the limit.Decrease the callees or contact ZEGOCLOUD technical support to increase the limit.

Previous

MessageBody Introduction

Next

Accept a call invitation