Single Database

https://{your-workspace-slug}.xata.sh/dbs/{db_name}/metadata/

Given a parameter db_name, this path allows interacting with the metadata of specific database on Xata. Below are a number of operations that can be performed on a given database.

Expected Parameters
NameDescriptionInRequiredSchema
db_nameThe Database Namepathstring

Get Database Metadata

GET  https://{your-workspace-slug}.xata.sh/dbs/{db_name}/metadata/

Retrieve metadata of the given database

Possible Responses
Status CodeDescriptionExample Response/Type Definition
200OK
/**
 * Metadata of databases
 */
type GetDatabaseMetadata = {
    /*
     * The machine-readable name of a database
     */
    name: string;
    /*
     * The human-readable name of a database
     */
    displayName: string;
    /*
     * The time this database was created
     */
    createdAt: DateTime;
    /*
     * The number of branches the database has
     */
    numberOfBranches: number;
    /*
     * Metadata about the database for display in Xata user interfaces
     */
    ui?: {
        /*
         * The user-selected color for this database across interfaces
         */
        color?: string;
    };
};

/**
 * @format date-time
 */
type DateTime = string;
400Bad Request
type GetDatabaseMetadata = {
    id?: string;
    message: string;
};
401Authentication Error
{
  "message": "invalid API key"
}
404Example response
type GetDatabaseMetadata = {
    id?: string;
    message: string;
};
5XXUnexpected Error

Update Database Metadata

PATCH  https://{your-workspace-slug}.xata.sh/dbs/{db_name}/metadata/

Update the color of the selected database

Request Body Type Definition
type PatchDatabaseMetadata = {
    ui?: {
        /*
         * @minLength 1
         */
        color?: string;
    };
};
Possible Responses
Status CodeDescriptionExample Response/Type Definition
200OK
/**
 * Metadata of databases
 */
type PatchDatabaseMetadata = {
    /*
     * The machine-readable name of a database
     */
    name: string;
    /*
     * The human-readable name of a database
     */
    displayName: string;
    /*
     * The time this database was created
     */
    createdAt: DateTime;
    /*
     * The number of branches the database has
     */
    numberOfBranches: number;
    /*
     * Metadata about the database for display in Xata user interfaces
     */
    ui?: {
        /*
         * The user-selected color for this database across interfaces
         */
        color?: string;
    };
};

/**
 * @format date-time
 */
type DateTime = string;
400Bad Request
type PatchDatabaseMetadata = {
    id?: string;
    message: string;
};
401Authentication Error
{
  "message": "invalid API key"
}
404Example response
type PatchDatabaseMetadata = {
    id?: string;
    message: string;
};
5XXUnexpected Error