Prerequisites
- TerminusDB running on
localhost:6363— see installation guide - A client SDK installed: TypeScript or Python
- A connected client instance: TypeScript or Python
What you'll achieve
By the end of this guide, you will have created a new database in TerminusDB using the HTTP API, TypeScript, or Python.
Create a database
A database is the top-level container for your data. It holds a schema, instance data, and a full commit history. Create one with a single call.
HTTP API
curl -u admin:root -X POST http://localhost:6363/api/db/admin/mydb \
-H "Content-Type: application/json" \
-d '{"label": "My Database", "comment": "A new database for my project", "schema": true}'Expected response:
Example: JSON
{"@type":"api:DbCreateResponse","api:status":"api:success"}Example: TypeScript
import TerminusClient from "@terminusdb/terminusdb-client";
const client = new TerminusClient.WOQLClient("http://localhost:6363", {
user: "admin",
key: "root",
organization: "admin",
});
await client.createDatabase("mydb", {
label: "My Database",
comment: "A new database for my project",
schema: true,
});
// The client is now connected to "mydb"Example: Python
from terminusdb_client import Client
client = Client("http://localhost:6363")
client.connect(user="admin", key="root")
client.create_database(
"mydb",
"admin",
label="My Database",
description="A new database for my project",
prefixes={
"@base": "terminusdb:///data/",
"@schema": "terminusdb:///schema#",
},
)Parameters
| Parameter | Description | Default |
|---|---|---|
label | Human-readable name for the database | Required |
comment / description | Description of the database | Optional |
schema | Whether to create with a schema graph | true |
prefixes | Custom @base and @schema IRI prefixes | TerminusDB defaults |
Next steps
- Add a Schema — define document types in your new database
- Add Documents — insert data once you have a schema
- Connect Guide — connection options and authentication