Create a Database

Open inAnthropic

Prerequisites

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"

Parameters

ParameterDescriptionDefault
labelHuman-readable name for the databaseRequired
comment / descriptionDescription of the databaseOptional
schemaWhether to create with a schema graphtrue
prefixesCustom @base and @schema IRI prefixesTerminusDB defaults

Next steps

Was this helpful?