LogoLogo
Release notesDocs homeFabricateTonic.ai
  • Tonic Fabricate User Guide
  • Fabricate workflow
  • Tutorial videos
  • Fabricate account
    • Getting started with Fabricate
    • Fabricate license plans
    • Managing your Fabricate account and profile
    • Managing users in your account
  • Databases
    • Supported database types
    • Creating and managing databases
  • Backing up and restoring the database definition
  • Configuring database variables
  • Exporting data from a database
  • Tables and columns
    • Managing database tables
      • Configuring table settings
      • Adding a table to a database
      • Removing a table from a database
      • Attaching static data to a table
      • Regenerating table data
  • Managing table columns
    • Adding and removing columns
    • Configuring a column
    • Generator reference
      • Calculated or related values
      • Data type and specific values
      • Names and other identifying information
      • Telephone numbers and email addresses
      • Geographic locations
      • Air travel
      • Natural science
      • Networks and files
      • Banking and finance
      • Dates and times
      • Vehicles
      • Companies and products
      • Healthcare and health insurance
      • Languages
      • Movies
      • Education
  • Views
    • Creating and managing views
    • Views reference
  • Workspaces
    • About workspaces
  • Creating and managing workspaces
  • Database mock API
    • About mock APIs
    • Defining a mock API
    • Creating and querying database snapshots
  • Mock API reference
  • Fabricate API and CLI
    • About the Fabricate API and CLI
    • Managing Fabricate API keys
    • Daily limits on generated data
    • Using the Fabricate API
      • Authentication for the API
      • Data model
      • Managing databases from the API
      • Generating data from the API
    • Using the Fabricate CLI
      • Setting up CLI access
      • Using the CLI to load data
Powered by GitBook
On this page
  • Getting database information
  • Getting all of the databases in a workspace
  • Getting details for a specific database
  • Creating and managing database configuration
  • Creating or updating a database
  • Deleting a database
  • Adding static data to a table
Export as PDF
  1. Fabricate API and CLI
  2. Using the Fabricate API

Managing databases from the API

Getting database information

Getting all of the databases in a workspace

To list all of the databases in a specific workspace:

GET /api/v1/workspaces/:workspace_name/databases

The response contains an array of database objects. For each database, the database object contains the following fields:

[
  {
    "id": "c50db909-6617-40d8-8c81-47de1b2e9806",
    "name": "CREATED_FROM_API",
    "created_at": "2025-03-20T08:44:41Z",
    "updated_at": "2025-03-20T08:44:42Z",
    "last_generated": "2025-03-20T08:44:42Z",
    "data_url": "http://fabricate.tonic.ai/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6IjFjMTg5MjNmLWZkZDAtNDRhZC04Y2U5LTE3Mjk5ZTBkNDEyNCIsInB1ciI6ImJsb2JfaWQifX0=--c9d77fa2a060bfd8c90813f960a901d7ea75c7c1/CREATED_FROM_API.zip",
    "workspace": {
      "id": "7edef645-87a5-46ef-9ea1-cce33cd9a543",
      "name": "Fabricate"
    },
  }
]

Where:

id

The UUID of the database.

name

The name of the database.

created_at

The date and time when the database was created.

updated_at

The date and time the database configuration was most recently updated.

last_generated

The date and time that the database data was most recently generated.

data_url

The URL to download the most recently generated data. Until the data is generated, this is null.

workspace

The identifier and name of the workspace that the database belongs to.

Getting details for a specific database

To get the details for a specific database by name:

GET /api/v1/workspaces/:workspace_name/databases/:database_name

Creating and managing database configuration

Creating or updating a database

To create a database or update an existing database:

POST /api/v1/workspaces/:workspace_name/databases

The request body is a database object with the database configuration.

The response contains a database object with the new or updated database configuration.

Deleting a database

To delete a database:

DELETE /api/v1/workspaces/:workspace_name/databases/:database_name

Returns an empty response body with a 200 status code.

Adding static data to a table

In Fabricate, instead of generating the data for a table, you can provide static data in the form of a .csv file. For more information, go to Attaching static data to a table.

From the API, to update the .csv file content:

POST /api/v1/workspaces/:workspace_name/databases/:database_name/entities/:table_name/source

This method expects a multipart/form-data request body with a file parameter that contains the contents of the .csv file to use for the table data.

The response contains an empty response body with a 200 code.

Last updated 3 days ago

For an example, go to in the fabricate-api-examples GitHub repository.

The response is a database object with the full details about the database configuration. For information about the database object, go to .

For an example, go to in the fabricate-api-examples GitHub repository.

For information about the database object, go to .

For an example, go to in the fabricate-api-examples GitHub repository.

For an example, go to in the fabricate-api-examples GitHub repository.

For an example, go to in the fabricate-api-examples GitHub repository.

list-databases.js
get-database.js
upsert-database.js
delete-database.js
update-source-data.js
Database attributes
Database attributes