What are API Keys?

If your app or service needs to access the Webex API as an anonymous user, you need to pre-register an API key and then use HM256 algorithm to generate JWT token to access Webex anonymous API (e.g.: GetSessionInfoAgg, GetAllSitesByEmailAgg).

Applying for an API Key

Go to the following URL to apply for an API key:

https://meetings-api.webex.com/gapi/registerapikey

This URL brings up the following web page/dialog:

API Key Registration

Fill out the web dialog above and click Submit to complete the registration process. The following example screens document the steps:

1. Page Confirming Submission 2. Email for Activating API Key 3. Page Confirming API Key Activation

Renewing an API Key

API keys expire after 6 months.

Go to the following URL to renew your API key. This is the same URL mentioned above to apply for an API key:

https://meetings-api.webex.com/gapi/registerapikey

If the email you submit is the same one previously used to register an API key, you will receive an email with a link for renewing your key. The following screens document the email and page confirming your renewal:

1. Email Providing Link to Renew API Key 2. Page Confirming API Key Renewal

Using the API Key and Secret to Generate a JWT token

Please refer to https://jwt.io/, to download the specific library for your project. The Java code for generating a JWT token is given below.

Java Code to Generate JWT token

import java.util.*;
import java.text.*;
import org.json.*;
import io.jsonwebtoken.*
 
...
String apikey = "451441ba-132b-4188-8ac7-23b815bc495d";
String secretkey = "7Q6YCX0FXES0W33...EJO16ZZ3YAJ";
String jwtttl = 300000; // 5 minutes for JWT TTL
 
long ttlMillis = Long.parseLong(jwtttl);
long nowMillis = System.currentTimeMillis();
Date now = new Date(nowMillis);
Date exp = new Date(nowMillis + ttlMillis);
try {
    String jwttoken = Jwts.builder()
         .setHeaderParam("typ","JWT")
         .claim("apikey",apikey)
         .claim("aud","userName")
         .claim("iss","https://meetings-api.webex.com/gapi/registerapikey")
         .setIssuedAt(now)
         .setExpiration(exp)
         .signWith(SignatureAlgorithm.HS256, secretkey.getBytes())
         .compact();
    log.info("jwttoken: " + jwttoken);
} catch (Exception ex) {
    log.error(ex.getMessage());
}
...

API for Using the JWT token to Access Webex Anonymously

The Java code for accessing Webex anonymously using your JWT token is given below. There are two APIs available to you for this purpose, getsessioninfoagg API and getallsitesbyemailagg API.

getsessioninfoagg API

POST https://meetings-api.webex.com/gapi/v1/meetings/actions/getsessioninfoagg
Header:
    Content-Type application/json;charset=utf-8
    JWTToken ${jwttoken}
Body
    {
        "sessionKey": 400971234
    }
 
Response
  { 
   "confID":121120347236861135,
   "accessControl":{ 
      "isEnforceAudioLogin":false,
      "hostJoined":false,
      "passwordReq":false,
      "listStatus":"UNLISTED",
      "sessionPassword":"",
      "participantsJoined":false,
      "audioPassword":""
   },
   "siteURL":"hmwds6.qa.webex.com",
   "URLAPIEnabled":true,
   "sessionkey":400971234,
   "siteName":"hmwds6",
   "sipURL":"400971234@hmwds6.qa.webex.com",
   "skypeURL":"400971234_hmwds6@lync.webex.com",
   "schedule":{ 
      "duration":720,
      "timeZoneID":4,
      "timeZone":"GMT-08:00, Pacific (San Francisco)",
      "startDate":"12/31/2068 13:00:00"
   },
   "metaData":{ 
      "serviceType":"MeetingCenter",
      "confName":"John's Personal Room",
      "sessionType":3,
      "isRecurring":false
   },
   "telephony":{ 
      "telephonySupport":"CALLBACK",
      "globalCallInNumbersURL":"https://hmwds6.qa.webex.com/hmwds6/globalcallin.php?serviceType=MC&ED=0",
      "tollFreeRestrictionsURL":"https://www.webex.com/pdf/tollfree_restrictions.pdf",
      "callInNum":{ 
         "tollNum":10224462261,
         "globalNum":[ 
            { 
               "phoneNumber":2341,
               "tollFree":false,
               "countryAlias":"Uganda"
            },
            { 
               "phoneNumber":245252,
               "tollFree":false,
               "countryAlias":"United States of America"
            },
            { 
               "phoneNumber":2343,
               "tollFree":true,
               "countryAlias":"Vatican City"
            },
            { 
               "phoneNumber":45231,
               "tollFree":true,
               "countryAlias":"Vietnam"
            },
            { 
               "phoneNumber":245252,
               "tollFree":false,
               "countryAlias":"aaa"
            },
            { 
               "phoneNumber":345,
               "tollFree":false,
               "countryAlias":"AAA"
            },
            { 
               "phoneNumber":25345,
               "tollFree":false,
               "countryAlias":"bbb"
            },
            { 
               "phoneNumber":2342432,
               "tollFree":false,
               "countryAlias":"BBB"
            },
            { 
               "phoneNumber":1111,
               "tollFree":false,
               "countryAlias":"Taiwan"
            }
         ],
         "tollFreeNum":10224462262
      },
      "labels":{ 
         "tollFreeCallInLabel":"Call-in toll-free number (US/Canada)",
         "tollCallInLabel":"Call-in toll number (US/Canada)"
      },
      "isMPAudio":false
   },
   "displayMeetingUrl":"400971234@hmwds6.qa.webex.com",
   "isAllowJBH":false,
   "host":{ 
      "lastName":"Doe",
      "firstName":"John",
      "webExId":"johndoe",
      "email":"johndoe@test.com"
   },
   "XMLAPIEnabled":true,
   "siteType":"TRAIN",
   "status":"NOT_INPROGRESS"
}

getallsitesbyemailagg API

POST https://meetings-api.webex.com/gapi/v1/sites/actions/getallsitesbyemailagg
Header:
    Content-Type application/json;charset=utf-8
    JWTToken ${jwttoken}
Body
    {
        "email": "test@cisco.com"
    }
 
Response
  { 
   "sites":[ 
      { 
         "siteUrl":"m3cweb6s1.qa.webex.com",
         "siteName":"m3cweb6s1",
         "isLinkageUser":"0",
         "siteType":"3"
      },
      { 
         "siteUrl":"jiezhangcpactest007.qa.webex.com",
         "siteName":"jiezhangcpactest007",
         "isLinkageUser":"0",
         "siteType":"3"
      },
      { 
         "siteUrl":"jiezhangcpactest006.qa.webex.com",
         "siteName":"jiezhangcpactest006",
         "isLinkageUser":"0",
         "siteType":"3"
      },
      { 
         "siteUrl":"jiezhangcpactest003.qa.webex.com",
         "siteName":"jiezhangcpactest003",
         "isLinkageUser":"0",
         "siteType":"3"
      },
      { 
         "siteUrl":"ycx-32.qa.webex.com",
         "fedWebSSOProtocol":"SAML 2.0",
         "siteName":"ycx-32",
         "isLinkageUser":"0",
         "siteType":"3"
      },
      { 
         "siteUrl":"robin.qa.webex.com",
         "siteName":"robin",
         "isLinkageUser":"0",
         "siteType":"3"
      },
      { 
         "siteUrl":"hmwds11.qa.webex.com",
         "siteName":"hmwds11",
         "isLinkageUser":"0",
         "siteType":"3"
      },
      { 
         "siteUrl":"dev-hybrid.qa.webex.com",
         "siteName":"dev-hybrid",
         "isLinkageUser":"0",
         "siteType":"3"
      },
      { 
         "siteUrl":"qanda.qa.webex.com",
         "siteName":"qanda",
         "isLinkageUser":"0",
         "siteType":"3"
      },
      { 
         "siteUrl":"hmt30.qa.webex.com",
         "siteName":"hmt30",
         "isLinkageUser":"0",
         "siteType":"3"
      }
   ]
}

API to Renew API Key and Secret before Expiry

You can use your code to automatically renew your API key and secret before they expire. The JavaScript code for renewing your JWT token is given below.

JavaScript for Renewing Your API Key and Secret

POST https://meetings-api.webex.com/gapi/v1/apikeys/actions/renew
Header:
    Content-Type application/json;charset=utf-8
    JWTToken ${jwttoken}
Body
  {
 
    "apikey": "1f0d2090-ebcf-11e8-8eb2-f2801f1b9fd1",
    "passcode": "XXXXX",
    "email": "john@test.com",
    "disableoldapikeyrightaway": false
  }
 
Response
{
  "apikey": "fe0d2090-ebcf-11e8-8eb2-f2801f1b9fdf",
  "passcode": "XXXXX",
  "secretkey": "XYZXYZXYZ...",
  "email": "john@test.com",
  "name": "John",
  "expiration": "8/1/19 12:08 AM GMT"
}