Sync entity schemas
<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>
Replaces the app's entire set of entities with the one you send, in a single call. This is what a deploy uses to make the app's live schema match its source.
<Warning>Send every entity the app should have. Any entity the app currently has that is missing from entityNameToSchema is deleted. Include User to keep its custom fields; leaving it out drops them.</Warning>
The response reports what changed, split into created, updated, and deleted. It also carries warnings for problems Base44 accepted instead of rejecting, so a 200 with a non-empty warnings means the sync applied but something in it is not doing what it looks like.
<Warning>This changes the app's live schema right away, but it does not change the entity definition in the app's source code. Base44 rebuilds the live schema from the source files whenever the app's code changes, which reverts anything you set here. Change the code itself when you need the edit to last.</Warning>
This endpoint is only available for apps whose source code you manage yourself. On an app whose code Base44 generates, it returns a 428. An entity that still has records cannot be deleted, so a sync that drops such an entity returns a 428 and changes nothing.
<Note>This endpoint accepts a personal API key, or a workspace API key with the apps:deploy scope.</Note>
Path parameters
ID of the app whose entity schemas you want.
ID of the app whose entity schemas you want.
Request body
Example request
{
"entityNameToSchema": {
"Invoice": {
"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
What the sync created, updated, and deleted, plus any warnings.
Example response
{
"created": [
"Invoice"
],
"updated": [
"Customer"
],
"deleted": [
"LegacyOrder"
],
"warnings": [
"Invalid RLS rule in Invoice: \"properties.total.rls.delete\" - field-level delete rules are not enforced - delete removes the whole record (there is no field-level delete gate); put the restriction in a top-level rls.delete instead"
]
}