Skip to main content

Create a Table

POST /tables
import requests

payload = {
"project": "prj_RSe4wbfuHSXelT8rNrMOJSAE",
"name": "My Table",
"fields": [
{ "name": "Text", "type": "text" },
{ "name": "Article", "type": "article" },
{ "name": "Single Select", "type": "singleSelect" }
]
}
r = requests.request(
method="POST",
url="/tables",
headers={
"Authorization": "Bearer <YOUR_API_TOKEN>",
"Host": "api.lytecms.com"
},
json=payload,
)

Parameters

{
"project": "prj_RSe4wbfuHSXelT8rNrMOJSAE",
"name": "string",
"fields": [
{
"name": "Text",
"type": "text"
},
{
"name": "Article",
"type": "article"
},
{
"name": "Single Select",
"type": "singleSelect"
}
]

ParameterTypeRequiredDescription
projectstringYesID of the project
namestringYesName of the table
fieldslistNo
The initial fields of the data table. (click to expand)
NameTypeRequiredDescription
namestringYesName of the field
typestringYesType of the field

Please note:

  • If the fields field is not provided, an empty data table containing only index columns will be created.
  • If the fields field is specified, a data table containing initial fields will be created, and the first field will be the index column by default.

Data validation rules:

  • Length range: 1 ~ 50
typestringYesType of the field

Response

{
"id": "prj_RSe4wbfuHSXelT8rNrMOJSAE",
"name": "Table1",
"created": 1704591821,
"updated": 1704591821
}