Working with session ID values for use with the server API

When working with the Fullstory API, there are several API methods which will ask for a session ID. Because of various technical design decisions made over Fullstory's lifetime, getting the correct session ID for use with the server API can sometimes be challenging.

This guide serves to help developers get around common stumbling blocks when retrieving the correct session ID for use with the server API.

Device ID, Session ID, and Client ID

When viewing a session within Fullstory, you'll find three values which represent the building blocks for creating a session ID to be used with the API: Device ID, Session ID, and Client ID

Note: The Session ID that you see in the Fullstory UI cannot, by itself, by used as a a session.id or session_id value with the server API. Continue reading for information on how to combine Device ID with Session ID to create a value that works with the server API.

You can find these values by clicking Show More in the top right corner of a session window:

Session ID - Building Blocks 343px

There are two ways to generate session IDs for use with the server API from these building blocks:

  • Device ID:Session ID: Combine the Device ID and the Session ID with a :, like so:

    406214335320288249:3829143070270885557
  • Client ID: The Client ID isn't combined with other values:

    3e2bf53f-2ca0-4e05-9fa3-29c9276febf9:cef16b56-44b2-4535-b923-d955b1a50eb5

You can use either the Device ID:Session ID combination or the Client ID when providing a session ID to server API, but continue reading to learn when you may need to also URL encode your value.

URL Encoding

When working with server APIs that ask for a session ID, you'll want to note whether or not you're required to URL encode the session ID before passing it in as a URL query parameter. This requires replacing the : value with %3A within the session ID.

  • Device ID:Session ID: Combine the Device ID and the Session ID with a %3A, like so:

    406214335320288249%3A3829143070270885557
  • Client ID: Within the Client ID, replace : with %3A:

    3e2bf53f-2ca0-4e05-9fa3-29c9276febf9%3Acef16b56-44b2-4535-b923-d955b1a50eb5
API HTTP Route Session ID Parameter Param Location URL Encode
Events > 
Create Event
/v2/events session.id Request body No
Sessions > 
Generate Context
/v2/sessions/{session_id}/context session_id Query param Yes
Sessions > 
Get Session Events
/v2/sessions/{session_id}/events session_id Query param Yes
Sessions > 
Generate Summary
/v2/sessions/{session_id}/summary session_id Query param Yes

Session URL from within Fullstory

You can also derive a session ID from the URL when viewing a Fullstory session. For example, if your session URL looks like this:

https://app.fullstory.com/ui/18PNWR/session/6041563777806336:406214335320288249!3829143070270885557

The last two integers in the URL will represent the Device ID and Session ID, respectively:

Session URL Session ID.jpg

 

Browser API FS('getSession')

Using the Get Session Details browser API, you can get the Client ID associated with the session.

For example, if you call FS('getSession', { format: 'id' }), this would return something like the following:

3e2bf53f-2ca0-4e05-9fa3-29c9276febf9:cef16b56-44b2-4535-b923-d955b1a50eb5

Server API /sessions/v2

Using the List Sessions Server API, you can return a list of sessions for a particular user. Please note that the userId value returned by the List Sessions API is the same as the Device ID referenced above and within the Fullstory UI. Here's how the session from the example above would appear when returned via the List Sessions API.

{
  "sessions": [
    {
      "userId": "406214335320288249",
      "sessionId": "3829143070270885557",
      "createdTime": "1754445922",
      "fsUrl": "https://app.fullstory.com/ui/18PNWR/session/406214335320288249:3829143070270885557"
    }
  ]
}

Combine the userId value (which is the same as Device ID) and sessionId value with a : to create the session ID, like so:

406214335320288249:3829143070270885557


Was this article helpful?

Got Questions?

Get in touch with a Fullstory rep, ask the community or check out our developer documentation.