Add Column
curl --request POST \
--url https://api.sublay.io/v7/:projectId/db/tables/:tableName/columns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"columnName": "<string>",
"dataType": "<string>",
"nullable": true,
"defaultValue": {}
}
'import requests
url = "https://api.sublay.io/v7/:projectId/db/tables/:tableName/columns"
payload = {
"columnName": "<string>",
"dataType": "<string>",
"nullable": True,
"defaultValue": {}
}
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({columnName: '<string>', dataType: '<string>', nullable: true, defaultValue: {}})
};
fetch('https://api.sublay.io/v7/:projectId/db/tables/:tableName/columns', 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.sublay.io/v7/:projectId/db/tables/:tableName/columns",
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([
'columnName' => '<string>',
'dataType' => '<string>',
'nullable' => true,
'defaultValue' => [
]
]),
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.sublay.io/v7/:projectId/db/tables/:tableName/columns"
payload := strings.NewReader("{\n \"columnName\": \"<string>\",\n \"dataType\": \"<string>\",\n \"nullable\": true,\n \"defaultValue\": {}\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.sublay.io/v7/:projectId/db/tables/:tableName/columns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"columnName\": \"<string>\",\n \"dataType\": \"<string>\",\n \"nullable\": true,\n \"defaultValue\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/db/tables/:tableName/columns")
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 \"columnName\": \"<string>\",\n \"dataType\": \"<string>\",\n \"nullable\": true,\n \"defaultValue\": {}\n}"
response = http.request(request)
puts response.read_body{
"added": "<string>"
}Custom Tables — Management
Add Column
Add a column to an existing custom table
Add Column
curl --request POST \
--url https://api.sublay.io/v7/:projectId/db/tables/:tableName/columns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"columnName": "<string>",
"dataType": "<string>",
"nullable": true,
"defaultValue": {}
}
'import requests
url = "https://api.sublay.io/v7/:projectId/db/tables/:tableName/columns"
payload = {
"columnName": "<string>",
"dataType": "<string>",
"nullable": True,
"defaultValue": {}
}
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({columnName: '<string>', dataType: '<string>', nullable: true, defaultValue: {}})
};
fetch('https://api.sublay.io/v7/:projectId/db/tables/:tableName/columns', 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.sublay.io/v7/:projectId/db/tables/:tableName/columns",
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([
'columnName' => '<string>',
'dataType' => '<string>',
'nullable' => true,
'defaultValue' => [
]
]),
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.sublay.io/v7/:projectId/db/tables/:tableName/columns"
payload := strings.NewReader("{\n \"columnName\": \"<string>\",\n \"dataType\": \"<string>\",\n \"nullable\": true,\n \"defaultValue\": {}\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.sublay.io/v7/:projectId/db/tables/:tableName/columns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"columnName\": \"<string>\",\n \"dataType\": \"<string>\",\n \"nullable\": true,\n \"defaultValue\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/db/tables/:tableName/columns")
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 \"columnName\": \"<string>\",\n \"dataType\": \"<string>\",\n \"nullable\": true,\n \"defaultValue\": {}\n}"
response = http.request(request)
puts response.read_body{
"added": "<string>"
}Adds one column to a custom table.
Service or master key required.
Path Parameters
string
required
Logical name of the table — pass
orders, not custom_orders.Body Parameters
string
required
Matches
^[a-zA-Z_][a-zA-Z0-9_]{0,62}$. Cannot be one of the managed column names (id, createdAt, updatedAt, deletedAt).string
required
One of
text, integer, float, boolean, timestamp, json, decimal, date, uuid.boolean
required
Whether the column accepts
NULL. Adding a non-nullable column to a table that already holds rows needs a defaultValue, or the existing rows have nothing to put in it.string | null
Optional default, as a string.
{
"columnName": "priority",
"dataType": "integer",
"nullable": false,
"defaultValue": "0"
}
Response
Returns201 Created.
string
The name of the column that was added.
Error Responses
Invalid Body — 400
Invalid Body — 400
{ "error": "Bad Request", "code": "database/invalid-body" }
Reserved Column — 400
Reserved Column — 400
The name is one of the managed columns.
{ "error": "Bad Request", "code": "database/reserved-column" }
Invalid Default Value — 400
Invalid Default Value — 400
{ "error": "Bad Request", "code": "database/invalid-default-value" }
Elevated Auth Required — 403
Elevated Auth Required — 403
{
"error": "Service or master key required.",
"code": "auth/elevated-auth-required"
}
Table Not Found — 404
Table Not Found — 404
{ "error": "Not Found", "code": "database/table-not-found" }
Column Conflict — 409
Column Conflict — 409
A column with that name already exists on the table.
{ "error": "Conflict", "code": "database/column-conflict" }
Column Limit Reached — 409
Column Limit Reached — 409
A table may hold at most 100 columns.
{ "error": "Conflict", "code": "database/column-limit-reached" }
Server Error — 500
Server Error — 500
{ "error": "Internal Server Error", "code": "database/server-error" }

