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"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}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.
entity_schema must be a JSON Schema object, so it needs "type": "object" and a properties object. Put row-level security rules under rls. Base44 adds a name key holding the entity name to the schema it stores and returns.
Pass User as the entity_name to set the custom fields on the built-in user entity. Those custom fields cannot redeclare email or full_name, which Base44 manages. User is also the one name this endpoint creates when it does not exist yet; every other unknown name returns a 404.
apps:deploy scope.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"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}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.
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
The updated entity schema.
Name of the entity.
"Invoice"
The entity's stored JSON Schema. For the app's own entities this includes a name key Base44 sets on every write; the User schema does not get one.
{
"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?