API Contexts

Most Xata API operations occur within the context of a workspace, which can be thought of as a "organization" in which all of your databases live. Some things though, are not part of a workspace, but adjacent to workspaces—like other workspaces. Because of this, Xata offers different API hosts depending on your usage contexts. We explain this more in the following sections.

Core API

The Core API is accessible at the origin https://api.xata.io and is responsible for operations on all Xata properties that are not bound to a specific workspace. These include:

  • /user: Since one user can belong to multiple workspaces, a user is not bound to a workspace.
  • /workspaces: A workspace is equivalent to an organization or team, and thus cannot be a child of another workspace. Workspaces are top-level entities, so workspaces are managed with the Core API.

Everything else that falls under the context of a workspace is operable with Xata's workspace-bound APIs.

Workspace API

Each workspace in Xata can contain any number of databases. Each database has any number of tables and branches. When interacting with Xata properties within the bounds of a workspace, we use the workspace-level API. This is accessible at a domain that is visible to you in your workspace's management section.

Managing a Workspace in Xata

Managing a Workspace in Xata

It usually looks something like https://your-workspace-id-hj0d23htj0.xata.sh, where hj0d23htj0 is a uniquely generated string chosen by Xata to keep your workspace domain unique. You can find out your workspace domain by navigating to the Configuration tab in the Xata Web UI.

Now that we're aware of the different types of API levels Xata offers, we can search these docs and API Reference by pressing ⌘K on macOS or Ctrl+K on Windows for our next steps in consuming Xata's powerful web API.


Last modified 1 mo17 days ago