curl --request PUT \
--url https://app.base44.com/api/apps/{app_id}/entity-schemas/{entity_name} \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--data '
{
"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/{entity_name}"
payload = { "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.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {api_key: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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/{entity_name}', 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/{entity_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'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/{entity_name}"
payload := strings.NewReader("{\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("PUT", 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.put("https://app.base44.com/api/apps/{app_id}/entity-schemas/{entity_name}")
.header("api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\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/{entity_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\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"
}
}Update entity schema
Replaces an entity’s JSON Schema with the one you send. This is a full replacement, not a merge. Anything you leave out is dropped from the schema.
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.
Pass User as the entity_name to set custom fields on the built-in user entity. Those fields can’t redeclare email or full_name, which Base44 manages.
curl --request PUT \
--url https://app.base44.com/api/apps/{app_id}/entity-schemas/{entity_name} \
--header 'Content-Type: application/json' \
--header 'api_key: <api-key>' \
--data '
{
"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/{entity_name}"
payload = { "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.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {api_key: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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/{entity_name}', 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/{entity_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'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/{entity_name}"
payload := strings.NewReader("{\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("PUT", 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.put("https://app.base44.com/api/apps/{app_id}/entity-schemas/{entity_name}")
.header("api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\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/{entity_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\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
Name of the entity to replace, as returned by List entity schemas. Pass User to set the built-in user entity's custom fields.
ID of the app whose entity schemas you want to work with.
Body
The entity's full JSON Schema, replacing the stored one. 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?