An entity is a metadata-defined data type — order, course, customer. You define it once in API Studio and a generic runtime serves its records. There is no per-entity table and no per-entity code.

The definition payload

You POST one definition to POST /api/create-{entityName}. The load-bearing fields are the field catalog, the key templates, and any secondary indexes.

json
{
  "entityName": "order",
  "baseKeys": {
    "pkTemplate": "org#{org};data#order",
    "skTemplate": "order#{id}"
  },
  "UpdateParams": [
    { "name": "id",    "colType": "guid" },
    { "name": "title", "colType": "string", "validate": true, "minlength": 1, "maxlength": 100 },
    { "name": "score", "colType": "number" }
  ],
  "ownerIndexes": [{ "ownerFieldName": "user_id",
                     "gpkTemplate": "org#{org};user#{user_id}",
                     "gskTemplate": "order#{id}" }],
  "UniqueIndexes": [{ "indexName": "unique-title", "fields": ["title"] }]
}
  • `UpdateParams` — the field catalog: a name and colType per field, plus optional validation and index hints.
  • `baseKeys` — the record key templates. {token} placeholders are resolved at write time from request data and JWT claims.
  • `ownerIndexes` / `parentIndex` / `UniqueIndexes` — declare secondary access patterns (covered in Indexes).

One payload, five APIs

You write one definition; the handler generates the other four configs. Record data then lands in the shared app table under PK = org#…;data#order — there is no order table.

text
apiname#create-order;version#active   <- the primary definition you wrote
apiname#get-order;version#active       <- generated
apiname#list-order;version#active      <- generated
apiname#update-order;version#active    <- generated
apiname#delete-order;version#active    <- generated

The third-instance test passes for free

Adding a 50th entity is five more rows — zero migrations, zero deploys, zero new code. Index fields are computed at write time, so a template and a live entity can never drift.

Managing entities

All management routes are on the apistudio gateway and require org_admin or developer.

http
POST   /api/{apiname}              create entity (+ generate the other 4)
PUT    /api/{apiname}              update one API config (e.g. add views)
GET    /api/entities              list entity names
GET    /api/entity?entityName=    full entity config
GET    /api/entity/endpoints?entity=   endpoint catalog (crud + list)
DELETE /api/entity?entityname=    delete the entity and all its APIs