cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to confirm a workspace ID via an api token?

eheinlein
New Contributor

Hello! We are integrating with Databricks and we get the API key, workspace ID, and host from our users in order to connect to Databricks. We need the to validate the workspace ID because we do need it outside of the context of the API key (with webhooks).

I haven't been able to easily find a way to validate a workspace ID via the API. I've looked at https://docs.databricks.com/api/workspace/workspaceconf/getstatus,https://kb.databricks.com/notebooks/get-workspace-configuration-details and the various options under https://docs.databricks.com/api/workspace/workspace/. None of them appear to work when using a databricks API token (and not requiring an account ID). Is there a way for us to use a token to make a call to Databricks to make sure that the provided workspace ID does exist and corresponds to the workspace context of the API token?

1 REPLY 1

Kaniz_Fatma
Community Manager
Community Manager

Hi @eheinlein, You can obtain the workspace ID from within a Databricks Notebook by running the following command in a Python or Scala cell:

spark.conf.get("spark.databricks.clusterUsageTags.clusterOwnerOrgId")

This command will return the workspace ID when executed.

While it’s not a direct validation method, you can use the Workspace API endpoint for registered models to verify the existence of a workspace ID.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group