Workspaces

https://api.xata.io/workspaces

This endpoint enables interacting with specific workspaces within Xata. For more information about workspaces, see the docs.

Get List of Workspaces

GET
https://api.xata.io/workspaces

Retrieve the list of workspaces the user belongs to

Responses

type GetWorkspacesList = {
    workspaces: {
        id: WorkspaceID;
        name: string;
        slug: string;
        role: Role;
    }[];
};
 
/**
 * @pattern ^([a-zA-Z0-9][a-zA-Z0-9_\-~]+-)?[a-zA-Z0-9]{6}
 */
type WorkspaceID = string;
 
type Role = "owner" | "maintainer";

Create a New Workspace

POST
https://api.xata.io/workspaces

Creates a new workspace with the user requesting it as its single owner.

Request Body Type Definition

type CreateWorkspace = WorkspaceMeta;
 
type WorkspaceMeta = {
    name: string;
    slug?: string;
};

Responses

type CreateWorkspace = WorkspaceMeta & {
    id: WorkspaceID;
    memberCount: number;
    plan: "free" | "pro";
};
 
type WorkspaceMeta = {
    name: string;
    slug?: string;
};
 
/**
 * @pattern ^([a-zA-Z0-9][a-zA-Z0-9_\-~]+-)?[a-zA-Z0-9]{6}
 */
type WorkspaceID = string;