curl --request POST \
--url https://app.base44.com/api/apps/{app_id}/entity-schemas \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--data '
{
"entity_name": "Invoice",
"entity_schema": {
"name": "Invoice",
"properties": {
"amount": {
"description": "Total amount in cents",
"type": "number"
},
"status": {
"enum": [
"draft",
"sent",
"paid"
],
"type": "string"
}
},
"required": [
"amount"
],
"rls": {
"read": {
"created_by": "{{user.email}}"
}
},
"type": "object"
}
}
'import requests
url = "https://app.base44.com/api/apps/{app_id}/entity-schemas"
payload = {
"entity_name": "Invoice",
"entity_schema": {
"name": "Invoice",
"properties": {
"amount": {
"description": "Total amount in cents",
"type": "number"
},
"status": {
"enum": ["draft", "sent", "paid"],
"type": "string"
}
},
"required": ["amount"],
"rls": { "read": { "created_by": "{{user.email}}" } },
"type": "object"
}
}
headers = {
"api_key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {api_key: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entity_name: 'Invoice',
entity_schema: {
name: 'Invoice',
properties: {
amount: {description: 'Total amount in cents', type: 'number'},
status: {enum: ['draft', 'sent', 'paid'], type: 'string'}
},
required: ['amount'],
rls: {read: {created_by: '{{user.email}}'}},
type: 'object'
}
})
};
fetch('https://app.base44.com/api/apps/{app_id}/entity-schemas', 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://app.base44.com/api/apps/{app_id}/entity-schemas",
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([
'entity_name' => 'Invoice',
'entity_schema' => [
'name' => 'Invoice',
'properties' => [
'amount' => [
'description' => 'Total amount in cents',
'type' => 'number'
],
'status' => [
'enum' => [
'draft',
'sent',
'paid'
],
'type' => 'string'
]
],
'required' => [
'amount'
],
'rls' => [
'read' => [
'created_by' => '{{user.email}}'
]
],
'type' => 'object'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_key: <api-key>"
],
]);
$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://app.base44.com/api/apps/{app_id}/entity-schemas"
payload := strings.NewReader("{\n \"entity_name\": \"Invoice\",\n \"entity_schema\": {\n \"name\": \"Invoice\",\n \"properties\": {\n \"amount\": {\n \"description\": \"Total amount in cents\",\n \"type\": \"number\"\n },\n \"status\": {\n \"enum\": [\n \"draft\",\n \"sent\",\n \"paid\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"amount\"\n ],\n \"rls\": {\n \"read\": {\n \"created_by\": \"{{user.email}}\"\n }\n },\n \"type\": \"object\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_key", "<api-key>")
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://app.base44.com/api/apps/{app_id}/entity-schemas")
.header("api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"entity_name\": \"Invoice\",\n \"entity_schema\": {\n \"name\": \"Invoice\",\n \"properties\": {\n \"amount\": {\n \"description\": \"Total amount in cents\",\n \"type\": \"number\"\n },\n \"status\": {\n \"enum\": [\n \"draft\",\n \"sent\",\n \"paid\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"amount\"\n ],\n \"rls\": {\n \"read\": {\n \"created_by\": \"{{user.email}}\"\n }\n },\n \"type\": \"object\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/apps/{app_id}/entity-schemas")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entity_name\": \"Invoice\",\n \"entity_schema\": {\n \"name\": \"Invoice\",\n \"properties\": {\n \"amount\": {\n \"description\": \"Total amount in cents\",\n \"type\": \"number\"\n },\n \"status\": {\n \"enum\": [\n \"draft\",\n \"sent\",\n \"paid\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"amount\"\n ],\n \"rls\": {\n \"read\": {\n \"created_by\": \"{{user.email}}\"\n }\n },\n \"type\": \"object\"\n }\n}"
response = http.request(request)
puts response.read_body{
"entity_name": "Invoice",
"entity_schema": {
"name": "Invoice",
"properties": {
"amount": {
"description": "Total amount in cents",
"type": "number"
},
"status": {
"enum": [
"draft",
"sent",
"paid"
],
"type": "string"
}
},
"required": [
"amount"
],
"rls": {
"read": {
"created_by": "{{user.email}}"
}
},
"type": "object"
}
}Create entity schema
Adds a new entity to the specified app.
This changes the app’s live data model, so it takes effect immediately. It doesn’t change the file that defines that model in the app’s source code. Since Base44 rebuilds the live model whenever the file is written or the app’s code is pulled from GitHub, a change made using this endpoint may be reverted.
To change the model for good, change the entities configuration files.
You can’t create User, which is built in. Use Update entity schema with User to add custom fields to it.
curl --request POST \
--url https://app.base44.com/api/apps/{app_id}/entity-schemas \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--data '
{
"entity_name": "Invoice",
"entity_schema": {
"name": "Invoice",
"properties": {
"amount": {
"description": "Total amount in cents",
"type": "number"
},
"status": {
"enum": [
"draft",
"sent",
"paid"
],
"type": "string"
}
},
"required": [
"amount"
],
"rls": {
"read": {
"created_by": "{{user.email}}"
}
},
"type": "object"
}
}
'import requests
url = "https://app.base44.com/api/apps/{app_id}/entity-schemas"
payload = {
"entity_name": "Invoice",
"entity_schema": {
"name": "Invoice",
"properties": {
"amount": {
"description": "Total amount in cents",
"type": "number"
},
"status": {
"enum": ["draft", "sent", "paid"],
"type": "string"
}
},
"required": ["amount"],
"rls": { "read": { "created_by": "{{user.email}}" } },
"type": "object"
}
}
headers = {
"api_key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {api_key: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entity_name: 'Invoice',
entity_schema: {
name: 'Invoice',
properties: {
amount: {description: 'Total amount in cents', type: 'number'},
status: {enum: ['draft', 'sent', 'paid'], type: 'string'}
},
required: ['amount'],
rls: {read: {created_by: '{{user.email}}'}},
type: 'object'
}
})
};
fetch('https://app.base44.com/api/apps/{app_id}/entity-schemas', 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://app.base44.com/api/apps/{app_id}/entity-schemas",
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([
'entity_name' => 'Invoice',
'entity_schema' => [
'name' => 'Invoice',
'properties' => [
'amount' => [
'description' => 'Total amount in cents',
'type' => 'number'
],
'status' => [
'enum' => [
'draft',
'sent',
'paid'
],
'type' => 'string'
]
],
'required' => [
'amount'
],
'rls' => [
'read' => [
'created_by' => '{{user.email}}'
]
],
'type' => 'object'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_key: <api-key>"
],
]);
$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://app.base44.com/api/apps/{app_id}/entity-schemas"
payload := strings.NewReader("{\n \"entity_name\": \"Invoice\",\n \"entity_schema\": {\n \"name\": \"Invoice\",\n \"properties\": {\n \"amount\": {\n \"description\": \"Total amount in cents\",\n \"type\": \"number\"\n },\n \"status\": {\n \"enum\": [\n \"draft\",\n \"sent\",\n \"paid\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"amount\"\n ],\n \"rls\": {\n \"read\": {\n \"created_by\": \"{{user.email}}\"\n }\n },\n \"type\": \"object\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_key", "<api-key>")
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://app.base44.com/api/apps/{app_id}/entity-schemas")
.header("api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"entity_name\": \"Invoice\",\n \"entity_schema\": {\n \"name\": \"Invoice\",\n \"properties\": {\n \"amount\": {\n \"description\": \"Total amount in cents\",\n \"type\": \"number\"\n },\n \"status\": {\n \"enum\": [\n \"draft\",\n \"sent\",\n \"paid\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"amount\"\n ],\n \"rls\": {\n \"read\": {\n \"created_by\": \"{{user.email}}\"\n }\n },\n \"type\": \"object\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/apps/{app_id}/entity-schemas")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entity_name\": \"Invoice\",\n \"entity_schema\": {\n \"name\": \"Invoice\",\n \"properties\": {\n \"amount\": {\n \"description\": \"Total amount in cents\",\n \"type\": \"number\"\n },\n \"status\": {\n \"enum\": [\n \"draft\",\n \"sent\",\n \"paid\"\n ],\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"amount\"\n ],\n \"rls\": {\n \"read\": {\n \"created_by\": \"{{user.email}}\"\n }\n },\n \"type\": \"object\"\n }\n}"
response = http.request(request)
puts response.read_body{
"entity_name": "Invoice",
"entity_schema": {
"name": "Invoice",
"properties": {
"amount": {
"description": "Total amount in cents",
"type": "number"
},
"status": {
"enum": [
"draft",
"sent",
"paid"
],
"type": "string"
}
},
"required": [
"amount"
],
"rls": {
"read": {
"created_by": "{{user.email}}"
}
},
"type": "object"
}
}Authorizations
Personal API key.
Path Parameters
ID of the app whose entity schemas you want to work with.
Body
Name for the new entity. Letters, numbers, and underscores only. Cannot be User.
"Invoice"
The entity's JSON Schema. Needs "type": "object" and a properties object, plus any required fields and row-level security rules under rls.
{
"name": "Invoice",
"properties": {
"amount": {
"description": "Total amount in cents",
"type": "number"
},
"status": {
"enum": ["draft", "sent", "paid"],
"type": "string"
}
},
"required": ["amount"],
"rls": {
"read": { "created_by": "{{user.email}}" }
},
"type": "object"
}
Response
Successful Response
One of an app's entities and its stored JSON Schema.
Name of the entity.
"Invoice"
The entity's stored JSON Schema, including its properties, required fields, and any row-level security rules under rls. For the app's own entities it also carries a name key holding the entity name. For User it holds only the custom fields added on top of the built-in ones, and has no name key.
{
"name": "Invoice",
"properties": {
"amount": {
"description": "Total amount in cents",
"type": "number"
},
"status": {
"enum": ["draft", "sent", "paid"],
"type": "string"
}
},
"required": ["amount"],
"rls": {
"read": { "created_by": "{{user.email}}" }
},
"type": "object"
}
Was this page helpful?