Accessing the Session ID with the viewer

To start with, I’m not a react developer, so perhaps I’m overstepping what I can do.

Summary: I can’t get the accurate Session ID anywhere.

I am injecting this bundle into the page:

I am initializing the Session with:

const session = await SDV.createSession({
    ticket: "{{getVar "shapeDiverTicket"}}",
    modelViewUrl: "",

I need access to the session ID to facilitate a file upload.

When I call at a later time, I see the value is different than what what returned from the ticket/ API call.

The value that is returned from fetching this property is a GUID automatically created. The value in the ticket/ API is never made available through

What am I doing wrong? Is this a limitation of the CDN bundle instead of using React?

Do you mean the call to SDV.createSession ?

Maybe you are calling SDV.createSession multiple times?

Are you using React?

Please share a reproducible example.

Hello, here is the code:

I’ve stripped it back to a proof of concept. You can see on the left the value. On the right, you can see the session ID from the API request.

If I send a request to:


If I use the sessionId from the API, I get a response. Otherwise, I get this error:

There are several problems I spotted:

  1. You are trying to upload an image, but your model doesn’t seem to have an image file input. Please use this component in your Grasshopper model: Import Bitmap
  2. It’s easier to use the API of the file parameter directly instead of making the API call yourself. This CodeSandBox shows how to do that:

I can fix your code once you fixed item 1 (image input).

I was wrong about the file input, had missed it.

Here you can find the fixed CodeSandBox:

Unfortunately, I can’t access that sandbox. Would you mind please reviewing the permissions? Thank you.

Please try again, should work now!

Thank you! I can indeed confirm that this worked. I appreciate it.