---
title: "Sync entity schemas"
method: PUT
path: "/api/apps/{app_id}/entity-schemas"
---

# Sync entity schemas

`PUT /api/apps/{app_id}/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 specified app's entire set of entities with the one you send, in a single call.

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. An empty object deletes every entity the app has.

Base44 won't delete an entity that still holds records. If the set you send leaves out an entity that has records, the whole call fails and nothing changes.

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.

This endpoint requires the app's source code to be under your control. That includes projects you create with the Base44 CLI and projects you [eject](/developers/references/cli/commands/eject) from the Base44 online app editor. Some managed-source apps may also be granted access.

## Path parameters

- `app_id` string, required — ID of the app whose entity schemas you want to work with.

## Request body

- SyncEntitySchemasRequest
  - `entityNameToSchema` object, required — The app's complete set of entities, keyed by entity name. Each value is that entity's [JSON Schema](/developers/backend/resources/entities/entity-schemas), which needs `"type": "object"` and a `properties` object, plus any `required` fields and [row-level security rules](/developers/backend/resources/entities/security) under `rls`. Any entity the app currently has that this map leaves out is deleted.

## Response `200`

Successful Response

- SyncEntitySchemasResponse — What a schema sync changed, split into created, updated, and deleted entities.
  - `created` string[], required — Entities that did not exist before and were added.
  - `updated` string[], required — Entities that already existed and were replaced.
  - `deleted` string[], required — Entities the app had and the request left out, which were removed.
  - `warnings` string[], required — Row-level security rules Base44 stored but can't enforce. The sync still applied, so an entity named here exists with a rule that isn't protecting anything. Base44 reports a rule this way only for an entity the sync adds fresh (one that didn't exist in the app before). On an entity the app already has, a new or changed rule of this kind fails the call with a 400. An unchanged unenforceable rule on an existing entity is left in place silently and doesn't appear here.

## Other responses

- `400` — An entity name is empty or has characters other than letters, numbers, and underscores. It also fires when a schema is not a valid JSON Schema, the `User` schema redeclares `email` or `full_name`, or a schema sets row-level security rules Base44 cannot enforce.
- `401` — Missing or invalid credentials.
- `403` — You don't have editor access to this app, or your workspace API key lacks the `apps:deploy` scope.
- `404` — App not found.
- `409` — The request is scoped to a feature branch. Entity schemas can only be changed on the main branch.
- `422` — The request body is missing, or `entityNameToSchema` is missing, is not an object, or maps a name to something other than an object. Whether each value is a usable JSON Schema is checked after this and returns a 400.
- `428` — This endpoint isn't available for this app, because Base44 manages its source code. It also fires when an entity the sync would delete still has records.

---

[API](https://skmtc.dev/adexad/apis/base44-app-management-api.md) · [All operations](https://skmtc.dev/adexad/apis/base44-app-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/adexad/base44-app-management-api/revisions/7f5ce8287501/schema)
