curl --request POST \
--url https://api.example.com/v1/grid/tables \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"kind": "calc",
"query": "<string>",
"columns": [
{
"name": "<string>",
"nullable": true
}
],
"key_columns": [
"<string>"
]
}
'import requests
url = "https://api.example.com/v1/grid/tables"
payload = {
"name": "<string>",
"kind": "calc",
"query": "<string>",
"columns": [
{
"name": "<string>",
"nullable": True
}
],
"key_columns": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
kind: 'calc',
query: '<string>',
columns: [{name: '<string>', nullable: true}],
key_columns: ['<string>']
})
};
fetch('https://api.example.com/v1/grid/tables', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/grid/tables",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'kind' => 'calc',
'query' => '<string>',
'columns' => [
[
'name' => '<string>',
'nullable' => true
]
],
'key_columns' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/grid/tables"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"kind\": \"calc\",\n \"query\": \"<string>\",\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"nullable\": true\n }\n ],\n \"key_columns\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/grid/tables")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"kind\": \"calc\",\n \"query\": \"<string>\",\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"nullable\": true\n }\n ],\n \"key_columns\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/grid/tables")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"kind\": \"calc\",\n \"query\": \"<string>\",\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"nullable\": true\n }\n ],\n \"key_columns\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}Create grid table
Create a grid table. Two kinds, chosen with kind:
kind=calc (the default) creates a calculation table defined by a SELECT query. The query becomes the table’s defining expression; the table is not materialized yet. Materialize it with the materialize route once created.
kind=data creates an empty appendable data table from a column schema, for callers that own their own rows (app state, operator logs). The table is promoted on creation, so the id it returns accepts row appends immediately via POST /v1/tables//rows. An integer s_id primary key and a _sm_created_at timestamp are added automatically; s_id is caller-supplied on every append, not auto-generated. Use this rather than POST /v1/table-imports, which loads a table from an uploaded file and produces an import table that does not accept appends.
Creation is atomic for both kinds: the table is removed if naming, the defining query, or any column fails.
curl --request POST \
--url https://api.example.com/v1/grid/tables \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"kind": "calc",
"query": "<string>",
"columns": [
{
"name": "<string>",
"nullable": true
}
],
"key_columns": [
"<string>"
]
}
'import requests
url = "https://api.example.com/v1/grid/tables"
payload = {
"name": "<string>",
"kind": "calc",
"query": "<string>",
"columns": [
{
"name": "<string>",
"nullable": True
}
],
"key_columns": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
kind: 'calc',
query: '<string>',
columns: [{name: '<string>', nullable: true}],
key_columns: ['<string>']
})
};
fetch('https://api.example.com/v1/grid/tables', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/grid/tables",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'kind' => 'calc',
'query' => '<string>',
'columns' => [
[
'name' => '<string>',
'nullable' => true
]
],
'key_columns' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/grid/tables"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"kind\": \"calc\",\n \"query\": \"<string>\",\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"nullable\": true\n }\n ],\n \"key_columns\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/grid/tables")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"kind\": \"calc\",\n \"query\": \"<string>\",\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"nullable\": true\n }\n ],\n \"key_columns\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/grid/tables")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"kind\": \"calc\",\n \"query\": \"<string>\",\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"nullable\": true\n }\n ],\n \"key_columns\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"code": "<string>",
"request_id": "<string>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Body
Name for the new table, shown across Summation.
1 - 255What kind of table to create. calc (the default) builds a calculation table from a SELECT query. data builds an empty appendable data table from a column schema, ready for row appends. Omit for the calculation behavior.
calc, data SELECT query that defines the calculation table's columns and rows (e.g. SELECT 1 as new_total). Required for kind=calc; not allowed for kind=data.
1Columns of the new data table, in order. Required for kind=data; not allowed for kind=calc. An integer s_id primary key and a _sm_created_at timestamp are added automatically and must not be listed here.
50Show child attributes
Show child attributes
Optional business-key columns, used to match rows on upsert (PUT /v1/tables/{table_id}/rows). Names must appear in columns. This is not the physical primary key, which is always the automatic s_id.
50Response
Successful Response