How to call Zoom VideoSDK Session API to use in-session events controls

I want to know how to call below API mostly headers in .Net Core

** Use in-session events controls** for ‘user.invite.room_system_callout’ method.
PATCH /videosdk/sessions/{sessionId}/events

Browser Console Error

Which Web Video SDK version?
Zoom Video SDK UIToolKit 1.9.8

Video SDK Code Snippets

Additional context
API calling steps required

For details regarding making API calls with the VideoSDK, refer to this section in the documentation - Make API requests

If you are using the UI Toolkit, I believe you will also need the Web VideoSDK as well.

Let me know if this helps :slight_smile:

Hey @kellyjandrews. I have referred the shared link and it is giving me an error.

StatusCode: Unauthorized
{“code”:124,“message”:“Invalid access token.”}

Can you please look into this on some priority.


Invalid Access Token can represent a couple of different scenarios - but most typically is due to using the incorrect Key/Secret.

In your VideoSDK developer account, be sure you are using the API key/secret to call the API, and not the SDK key/secret.

Hey @kellyjandrews ,
I’m sure on using API and API secret, so what will be the other possible reason.
Also I have used JWT token which is available in Video SDK APP, please refer below image

Code to generate the token is as below, using .Net Core C#.

using System.IdentityModel.Tokens.Jwt;

public string GetVideoSDKAPIToken(string apiKey, string apiSecret, int accessTokenValidityInMinutes = 120, int tokenValidityInMinutes = -1)
            DateTime now = DateTime.UtcNow;

            if (tokenValidityInMinutes <= 0)
                tokenValidityInMinutes = accessTokenValidityInMinutes;

            int tsNow = (int)(now - new DateTime(1970, 1, 1)).TotalSeconds;
            int tsAccessExp = (int)(now.AddMinutes(accessTokenValidityInMinutes) - new DateTime(1970, 1, 1)).TotalSeconds;
            int tsTokenExp = (int)(now.AddMinutes(tokenValidityInMinutes) - new DateTime(1970, 1, 1)).TotalSeconds;

            return GenrateVideoSDKAPIToken(apiSecret, new JwtPayload
                    { "iss", apiKey },
                    { "exp", tsAccessExp },
                    { "iat", tsNow }                                        
public static string GenrateVideoSDKAPIToken(string apiSecret, JwtPayload payload)
            // Create Security key using private key above:
            // note that latest version of JWT using Microsoft namespace instead of System
            var securityKey = new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(Encoding.UTF8.GetBytes(apiSecret));

            // Also note that securityKey length should be >256b
            // so you have to make sure that your private key has a proper length
            var credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256);

            // Finally create a Token
            var header = new JwtHeader(credentials);
            var secToken = new JwtSecurityToken(header, payload);
            var handler = new JwtSecurityTokenHandler();

            // Token to String so you can use it in your client
            return handler.WriteToken(secToken);

Code to call a API,

var client = new RestClient(_zoomConfiguration.Zoom_Base_URL + "/videosdk/sessions/" + sessionid + "/events");

                var request = new RestRequest(Method.PATCH);
                request.AddHeader("content-type", "application/json");
                request.AddHeader("authorization",  token);
                request.AddParameter("application/json", json, ParameterType.RequestBody);

                IRestResponse response = await client.ExecuteAsync(request);
                responseObj = JsonConvert.DeserializeObject<CallOutDTO>(response.Content);

@kellyjandrews, Thank you for you time and support, I am able to sort out the issue.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.