How to get workspace ID from Asana UI.

The “workspace_gid” in Asana UI and Asana API response are not identical. The “workspace_gid” found in the URL of the Asana UI is different from the API response of GET /workspaces request. For example; GET /workspaces/{workspace_gid} endpoint accepts “gid” from API response whereas if we use the “gid” found in the URL of Asana UI, API throws an error saying “Not a recognized workspace gid”. How can we get the exact “workspace_gid” from Asana UI?

1 Like

Hi @Raaghul and welcome to the forum!

The only place in the UI I’m aware of where the workspace ID is shown is in the Admin Console URL.

2 Likes

@Phil_Seeman
Is my understanding is correct that the IDs found in the Admin Console URL is different from the IDs received from the API response.
And the requests made for any API endpoint accepts only the IDs from the API response and not the ID found in Admin Console URL?

@Raaghul
In my organization, the ID shown in the Admin Console URL matches the ID from the API.

Note, though, that the Admin Console is only available for organizations. For non-organization workspaces, I’m not aware of any place in the UI that displays the workspace ID.

1 Like

Hi there Raaghul,

Not sure how you can see the workspace ID only of the one you’re logged into, but you can get all your accessible workspace IDs by visiting:

https://app.asana.com/api/1.0/workspaces

Cheers,
Daniel

16 Likes

I was looking for the way while planning a new Chrome extension.

1 - Admin Console URL
I didn’t know the Admin Console URL tip. Thank you @Phil_Seeman!
https://app.asana.com/admin/{workspace_gid}

I know two other ways to get the workspace ID (gid) from Asana UI:

2 - HTML meta tag

When we see the source code of the app page, there’s a meta tag showing the workspace gid. I checked this both in an organization and a workspace.
<meta name="shard_id" content={workspace_gid}>

3 - Getting resources from URL patterns

The most common URL pattern is:

https://app.asana.com/0/{container_gid}/list
https://app.asana.com/0/{container_gid}/board
...
https://app.asana.com/0/{container_gid}/{task_gid}

where the container_gid can be one of project_gid, tag_gid, or user_list_gid.

There are some other patterns:

https://app.asana.com/0/home/{☆user_task_list_gid}
https://app.asana.com/0/inbox/{☆user_task_list_gid}
https://app.asana.com/0/inbox/{☆user_task_list_gid/{task_gid}/{story_gid}
https://app.asana.com/0/reporting/{☆user_task_list_gid}
https://app.asana.com/0/portfolios/{☆user_task_list_gid}
https://app.asana.com/0/goals/{☆user_task_list_gid}
https://app.asana.com/0/search/{search_gid}/{search_gid} ●
https://app.asana.com/0/search/{search_gid}/{task_gid}

We can query the workspace gid through API when we know one of project_gid, tag_gid, user_list_gid, or task_gid.

☆ An id, a little smaller than user_task_list_gid
● It seems we cannot query the workspace gid only when we only know search_gid.

6 Likes