---
title: "Create Database"
method: POST
path: "/api/text2sql/databases"
tags: ["text2sql"]
---

# Create Database

`POST /api/text2sql/databases`

Create a new database configuration

## Request body

- DatabaseCreateRequest — Request schema for creating a new database configuration
  - `name` string, required — Database display name
  - `type` string, required — Database type (sqlite, postgresql, mysql, sqlserver)
  - `url` string, required — Database connection URL
  - `read_only` boolean — Whether database is read-only

## Response `200`

Successful Response

- DatabaseResponse — Response schema for database configuration
  - `id` integer, required
  - `name` string, required
  - `type` string, required
  - `url` string, required
  - `read_only` boolean, required
  - `status` string, required
  - `table_count` integer, nullable
  - `last_connected_at` string, nullable
  - `error_message` string, nullable
  - `created_at` string, required
  - `updated_at` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/xorbitsai/apis/xagent.md) · [All operations](https://skmtc.dev/xorbitsai/apis/xagent/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/xorbitsai/xagent/revisions/66a05609bfdd/schema)
