Skip to content

Schema & Enums

Endpoints for retrieving the structure of entities and technical metadata.

Entity Schema

Retrieve the field definitions, types, and relations for a specific entity.

Endpoint: GET /core/schema/{entity}

The {entity} parameter can be the technical name or a localized name of the entity, for example: Receipts, Customers, Products, etc.

Response Body (Example for Receipts)

json
{
  "id": 33,
  "name": "Receipts",
  "initiator": "client",
  "options": {
    "comments": false,
    "trackChangeHistory": true
  },
  "representativeField": {
    "id": 337,
    "name": "number"
  },
  "title": null,
  "application": "*",
  "icon": null,
  "fields": [
    {
      "name": "createdAt",
      "id": 2,
      "type": "timestamp",
      "initiator": "system",
      "isPrimary": false,
      "options": null,
      "isArray": false,
      "maxLength": null,
      "minLength": null,
      "maxValue": null,
      "minValue": null,
      "isOnlyPositive": false,
      "mask": null,
      "decimalPlaces": 0,
      "subType": "timestamp",
      "title": {
        "id": 391,
        "key": "entity.BaseEntity.field.createdAt",
        "en": "Created At"
      },
      "unique": false,
      "notNull": false,
      "defaultValue": "now"
    },
    {
      "name": "createdBy",
      "id": 681,
      "type": "many-to-one",
      "initiator": "system",
      "isPrimary": false,
      "options": null,
      "isArray": false,
      "maxLength": null,
      "minLength": null,
      "maxValue": null,
      "minValue": null,
      "isOnlyPositive": false,
      "mask": null,
      "decimalPlaces": 0,
      "subType": null,
      "title": {
        "id": 491,
        "key": "entity.BaseEntity.field.createdBy",
        "en": "Created By"
      },
      "representativeField": {
        "id": 40,
        "name": "lastName",
        "type": "text"
      },
      "relationTarget": "Users",
      "unique": false,
      "notNull": false,
      "defaultValue": "$current-user"
    },
    {
      "name": "number",
      "id": 337,
      "type": "text",
      "initiator": "client",
      "isPrimary": false,
      "options": {
        "searchable": true
      },
      "isArray": false,
      "maxLength": null,
      "minLength": null,
      "maxValue": null,
      "minValue": null,
      "isOnlyPositive": false,
      "mask": null,
      "decimalPlaces": 0,
      "subType": null,
      "title": {
        "id": 398,
        "key": "entity.Receipts.field.number",
        "en": "Number"
      },
      "unique": false,
      "notNull": false
    },
    {
      "name": "totalAmount",
      "id": 340,
      "type": "numeric",
      "initiator": "client",
      "isPrimary": false,
      "options": null,
      "isArray": false,
      "maxLength": null,
      "minLength": null,
      "maxValue": null,
      "minValue": null,
      "isOnlyPositive": false,
      "mask": null,
      "decimalPlaces": 0,
      "subType": null,
      "title": null,
      "unique": false,
      "notNull": false
    }
  ],
  "importKeyFields": "*"
}

Enumeration Values (Enums)

Retrieve available enums and their values.

List All Available Enums

To get a list of all enumeration types available in the system, use the groupBy parameter on the name field.

Endpoint: POST /core/data/Enums/select

Request Body

json
{
  "fields": {
    "name": true
  },
  "groupBy": [
    { "field": "name" }
  ]
}

Response Body (Example)

json
[
  { "name": "CustomerGroupLimits.period" },
  { "name": "FiscalTransactions.type" },
  { "name": "ReceiptPayments.type" },
  { "name": "Products.type" }
]

Retrieve Specific Enum Values

Retrieve the labels, values, and internal IDs for a specific enum by filtering by its name.

Endpoint: POST /core/data/Enums/select

Request Body (Example for ReceiptPayments.type)

json
{
  "fields": {
    "id": true,
    "name": true,
    "value": true
  },
  "conditions": {
    "operator": "and",
    "filters": [
      {
        "field": "name",
        "comparator": "=",
        "value": "ReceiptPayments.type"
      }
    ]
  }
}

Response Body

json
[
  {
    "id": 71,
    "name": "ReceiptPayments.type",
    "value": "prepayment"
  },
  {
    "id": 72,
    "name": "ReceiptPayments.type",
    "value": "payment"
  },
  {
    "id": 73,
    "name": "ReceiptPayments.type",
    "value": "reversal"
  }
]

Entity Metadata

Retrieve the system numeric ID for an entity name. This internal ID is required for various system operations, most notably for attaching files to entities.

Endpoint: POST /core/data/EntityMetadata/select

Request Body

json
{
  "fields": {
    "id": true,
    "name": true
  },
  "conditions": {
    "operator": "and",
    "filters": [
      {
        "field": "name",
        "comparator": "=",
        "value": "Products"
      }
    ]
  },
  "limit": 1
}

Response Body

json
[
  {
    "id": 59,
    "name": "Products"
  }
]