See Stacksync in action with a solution architect. Book a demo ↗
SyncsApp schema

App schema

Generate an app schema

POST
/v1/workspaces/{workspace_id}/helpers/generate-app-schema

Read the tables of a connection and the columns of the tables named, so a sync can be built from exact table and column names. The credentials are read from the connection, never sent. Readable with a read-only key.

Authorization

Authorizationstringheaderrequired

Bearer <key>, where <key> is a workspace API key or a user API key. See Authentication.

Path Parameters

workspace_id*integer

The workspace the resources belong to

Query Parameters

region*string

Data region of the connection

Value in"besg""usnv"

Request Body

The connection and the tables to read the columns of

application/json
  1. body

The connection to read, and the tables to read the columns of

connection_id*string

The connection to read the schema through

Formatuuid
table_names?array<string>

The tables to read the columns of, by table_name or table_id exactly as the schema lists them; the answer lists every table but fills columns for these only

Default[]

Response Body

The tables of the app, with the columns of the tables named

application/json
  1. response

The tables and columns Stacksync can read through a connection

app_type*string

The app of the connection, as shown in Stacksync

can_create_tables*boolean

Whether a sync may create a new table in this app (table_options.create_new_table: true)

tables*array<>

Every table of the app

Generate an app schema
curl -X POST 'https://api.stacksync.com/v1/workspaces/0/helpers/generate-app-schema?region=besg' \  -H 'Content-Type: application/json' \  -d '{  "connection_id": "9b2e4f60-1c3d-4a5e-8f70-2d4c6e8a0b12",  "table_names": [    "accounts"  ]}'
{  "app_type": "postgres",  "can_create_tables": true,  "tables": [    {      "table_name": "accounts",      "table_id": "accounts",      "table_options": {        "primary_key": {          "column_name": "id",          "column_type": "uuid"        }      },      "columns": [        {          "column_name": "id",          "column_type": "uuid",          "writable": false        },        {          "column_name": "name",          "column_type": "string",          "writable": true        },        {          "column_name": "website",          "column_type": "string",          "writable": true        }      ]    },    {      "table_name": "contacts",      "table_id": "contacts",      "table_options": {},      "columns": []    }  ]}