Skip to content

Load Enterprise Data Using the REST API

Enterprise data from external systems can be loaded into your tenant’s PostgreSQL schema using simple REST calls.
You’ll learn how to: - Create schemas tied to tenant identity
- Upload structured (relational) and JSON-based data
- Organize application data using named schemas


Step 0 — Drop existing schema

Drop existing schema with cascade.


Step 1 — Restore a Database Backup

This step sends your local SQL dump to the /restore-backup endpoint. The schemaName query parameter controls which PostgreSQL schema the data is loaded into.


Step 2 — Generate ERD (Mermaid)

Invoke /create-erd to produce an entity-relationship diagram in Mermaid format for your restored schema.


Inspect the API: After you restore the database, you can view and test all of your schema’s database endpoints in Swagger:


Step 3 — Drop film_embeddings table

Clears out any old film_embeddings table so we start fresh.

DB_BASE=""
curl -X POST "${DB_BASE}/drop-table" \
    -H "Authorization: Bearer ${DB_KEY}" \
    -H "Content-Type: application/json" \
    -d '{
    "table_name": "film_embeddings",
    "if_exists": true
    }'

DB_BASE=""
import requests

resp = requests.post(
    f"{DB_BASE}/drop-table",
    headers={"Authorization": f"Bearer {DB_KEY}", "Content-Type": "application/json"},
    json={"table_name": "film_embeddings", "if_exists": True}
)
print(resp.json())

DB_BASE=""
await fetch(`${DB_BASE}/drop-table`, {
method: "POST",
headers: {
    "Authorization": `Bearer ${DB_KEY}`,
    "Content-Type": "application/json"
},
body: JSON.stringify({ table_name: "film_embeddings", if_exists: true })
});


Step 4 — Create film_embeddings table

Defines a table to store film embeddings.


Step 5 — Create vector index on film_embeddings

Builds a high-performance vector index for fast similarity search.


Step 6 — Retrieve film data

Fetches joined film records from the film_list view.


Step 7 — Generate embeddings & insert into film_embeddings

Embeds each film’s metadata and bulk-inserts the results.