API access to SpawnTokens

In the Gather web app, one can manually get spawn token links from the calendar. These are needed to make the calendar actually link to locations. Are these accessible in any API? I looked for them in the web socket API and did not find them. Does anyone have any leads? Thanks!

Good afternoon,

This is not possible with the websocket API currently - however, there is a HTTP endpoint that creates spawn tokens. Here it is:

POST https://gather.town/api/v2/spaces/${urlencodedspaceID}/spawn-tokens

It takes this config:

    body: {
      room: "my room ID- e.g 'entryway'",
      spawn: "the name of my spawn tile",
      type: "SpawnTile",
    },

Caveats:

  1. We do not expect this API to change, but it still might. This is a stable endpoint and we’ve long since moved on to other things, but the HTTP API team has asked me to set this expectation.
  2. Your space ID should have a backslash, not a forward slash: oxrhEtb3sV7VutbQ\GatherOffice

Authentication is required (in the form of a Bearer token or API key on the request) and you must be at least a builder in the space.

Let me know if that works or if you have any issues!

Warmly,

Evelyn

1 Like

Hey Evelyn,

Jason and I gave this a shot and couldn’t get authenticated. /api/ endpoints tend to take the apiKey:"…" parameter in the JSON body (we tried this and it doesn’t seem to work)

We also tried sending the header “Authorization: Bearer API_KEY” header but are seeing forbidden responses.

I can provide the full request/response if you like, but I don’t have it up on my screen at the moment.

Thanks!

Hi there,

I replied and pinned an answer for all V2 endpoints here:

1 Like

Great, this worked as advertised! Thanks so much!

I discovered the hard way that the url encoding of ’ ’ must by ‘%20’ not ‘+’ in this:

Yes, good thing to mention :slight_smile: because the space ID is part of the path fragment and not part of a query parameter (i.e after (?)), %20 is required. The V1 API made heavy use of querystrings, which is probably why you were able to make use of + in the past, but in general it is considered an obsolete part of the HTTP protocol that is only supported for backwards compatibility. You should always use %20 wherever possible.

Sorry to resurrect this, but with the changes to SpawnTiles, I wanted to confirm if this endpoint is dead or not.

Where there changes to spawn tiles? Can you expand?

As I understand it, Spawn Tokens can only be accessed or used in spaces with a calendar active. If you do not have a calendar, your spawn tokens will not work, and you cannot create the links from the “Create an Event” button.

We only use the API to get spawn tokens. I just disabled the calendar in a space with spawn tokens, and the spawn tokens still work as expected, and the API to fetch them still works. Is this a future change?

I was told that spawn tokens would not work in spaces which did not have an active calendar. To my mind, this would render this endpoint dead unless it has some sort of check for calendar connection built in.

Not sure if this is a change current to prod or what.

Edit: To clarify, I was also told that the Spawn x/y url properties will still work.