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

Status CodeDescriptionExample Response/Type Definition
200OK
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";
400Bad Request
type GetWorkspacesList = {
    id?: string;
    message: string;
};
401Authentication Error
{
  "message": "invalid API key"
}
404Example response
type GetWorkspacesList = {
    id?: string;
    message: string;
};
5XXUnexpected Error

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

1
2
3
4
5
6
type CreateWorkspace = WorkspaceMeta;

type WorkspaceMeta = {
    name: string;
    slug?: string;
};
Status CodeDescriptionExample Response/Type Definition
201Created
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;
400Bad Request
type CreateWorkspace = {
    id?: string;
    message: string;
};
401Authentication Error
{
  "message": "invalid API key"
}
404Example response
type CreateWorkspace = {
    id?: string;
    message: string;
};
5XXUnexpected Error