PermuteDocs
Go to Permute

Databases · databaseTablesCreate

Create a database table

Requires admin permission. Accepts a typed table definition; arbitrary DDL is not accepted.

POST/v1/databases/{databaseId}/tables
betaapiKeyworkspace

When to use

Create a typed table in the managed app schema.

For agents

Requires admin permission. Primary keys must be non-nullable scalar columns. Arbitrary DDL is not accepted.

Example

typescript
import { PermuteClient } from '@permute/sdk';

const orgClient = new PermuteClient({
  apiKey: process.env.PERMUTE_API_KEY!,
});

const client = orgClient.withWorkspace(process.env.PERMUTE_WORKSPACE_ID!);

const result = await client.databases.createTable('dbas_crm123', {
  "name": "customers",
  "columns": [
    {
      "name": "id",
      "type": "text",
      "nullable": false
    },
    {
      "name": "name",
      "type": "text",
      "nullable": false
    }
  ],
  "primaryKey": [
    "id"
  ]
});

Request body

json
{
  "name": "customers",
  "columns": [
    {
      "name": "id",
      "type": "text",
      "nullable": false
    },
    {
      "name": "name",
      "type": "text",
      "nullable": false
    }
  ],
  "primaryKey": [
    "id"
  ]
}

Response

json
{
  "data": {
    "name": "customers"
  }
}