> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bludia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Fields

> Field types in Bludia: text, long text, text editor, number, password, relation, file, date, time, datetime, select, multi select, boolean, and QR code. Includes system fields and how fields map to API JSON.

A **field** defines one attribute of a record: its name, type, and rules. In API requests and responses, each field appears as a JSON key named after the field.

```json theme={null}
{ "name": "Sarah Ahmed", "email": "sarah@example.com", "vip": true, "credit_limit": 5000 }
```

## Field types

| Type | API value | JSON example | Use for |
| :- | :- | :- | :- |
|  Text | `text` | `"Acme Inc."` | Names, titles, short strings, emails, phones |
|  Long Text | `long_text` | `"Multi-line notes…"` | Descriptions and notes |
|  Text Editor | `text_editor` | `"<p>Rich <b>text</b></p>"` | Formatted content |
|  Number | `number` | `42`, `"19.99"` | Quantities, prices, scores |
|  Password | `password` | `"s3cret!pass"` (write only) | Credentials; stored hashed, never returned |
|  Relation | `relation` | write `25` or `[3, 7]`; read `{ "id": 25, "label": "…" }` | Links to records in another collection |
|  File | `file` | file reference | Attachments, images (Premium plan) |
|  Date | `date` | `"2026-12-01"` | Birthdays, due dates |
|  Time | `time` | `"14:30"` | Opening hours |
|  DateTime | `datetime` | `"2026-12-01T14:30:00Z"` | Appointments, timestamps |
|  Select | `select` | `"confirmed"` | One value from a fixed list |
|  Multi Select | `multi_select` | `["vip", "newsletter"]` | Several values from a fixed list |
|  Boolean | `boolean` | `true` | Yes/no flags |
|  QR Code | `qr_code` | `"TICKET-0042"` | Values rendered as QR codes |
|  Auto Number | `auto_number` | `"INV-00042"` (read only) | Invoice, receipt and voucher numbers: sequential, gapless, never editable |
|  Icon | `icon` | `"trophy"` | An icon per record, for example one per sport. The value is an icon name in kebab-case |

> [!NOTE]
>
> **Numbers are exact.** Bludia never rounds numbers through floating point. Integers come back as numbers and decimals may come back as exact strings (for example `"19.99"`). You can configure scale and precision on the field.

## Auto numbers

An `auto_number` field numbers records in the order they are created, the way invoice numbers work:

```json theme={null}
{ "name": "invoice_no", "type": "auto_number",
  "validations": { "auto_number": { "start": 1, "prefix": "INV-", "padding": 5 } } }
```

This gives `INV-00001`, `INV-00002`, and so on. All three settings are optional. `start` defaults to 1, `prefix` to none, and `padding` (zero-pad to this many digits) to 0.

* **Assigned by the database** when a record is created, whatever the write path (dashboard, API, import, functions). Don't send a value: a create that includes one is rejected, and an edit may only send the stored number back unchanged.
* **Gapless.** A number is used only when the record is saved. A failed or cancelled save gives its number back. Concurrent saves wait their turn, so two records never get the same number.
* **Never changes.** Editing or clearing a number is refused (409). Moving a record to the trash and restoring it keeps its number. Deleting a record permanently leaves its number unused.
* **Existing records.** Adding an auto-number field to a collection that already has records numbers them in creation order. Values that are already there are kept.
* **Settings.** The start can't change after the first number is issued. A new prefix or padding applies to new records only, so issued numbers stay exactly as they were.
* Sorting follows the number, so `INV-10` comes after `INV-9`.

## System fields

Every record has these fields automatically. You can't remove them.

| Field | Type | Description |
| :- | :- | :- |
| `id` | integer | Unique record ID within the project |
| `slug` | string or null | Optional URL-friendly identifier you can set on create or update |
| `created_at` | datetime | When the record was created |
| `updated_at` | datetime | When the record was last changed |
| `published_at` | datetime or null | Publication timestamp you can set on create or update |

List responses also include `children`, which holds related records you asked for with `with`.

## Field options

| Option | Effect |
| :- | :- |
| **Name** | The JSON key in the API. Use `snake_case`, for example `customer_name`. |
| **Label** | The display name in the dashboard. |
| **Required** | The value must be present and non-empty on create. |
| **Unique** | No two records in the collection may have the same value. |
| **Nullable** | Allows an explicit `null`. |
| **Default value** | Used when a record is created without a value for the field. Booleans can default to `true` or `false`, Select fields to one of their options. The dashboard form shows defaults pre-filled, and a required Select with a single option has it selected. |
| **Options** | The allowed values for Select and Multi Select. |
| **Validations** | Extra rules: lengths, ranges, patterns, formats, conditions. See [Validation](https://docs.bludia.com/database/validation.md). |

> [!TIP]
>
> Treat the field **name** as an API contract. Renaming it changes the JSON key your apps send and receive.

## Choosing a type

| Data | Recommended type | Why |
| :- | :- | :- |
| Order status | Select | Restricts to known values and makes filtering reliable |
| Price or amount | Number | Exact decimals, range filters, totals |
| Customer on an order | Relation | Keeps one source of truth |
| Email or phone | Text + `format` validation (`email`, `phone`) | Validated on write |
| Tags | Multi Select | Filter by any of several values |
| Login password | Password | Hashed automatically, never returned |
| Sport or category icon | Icon | Picked from the icon set, shown in tables and forms |

## Fields in the API

* **Write** using field names: `{ "status": "confirmed" }`. Unknown keys are ignored.
* **Read** returns every field as a top-level key; missing values are `null`.
* **Relation** fields accept a record ID or an array of IDs. See [Relations](https://docs.bludia.com/database/relations.md).
* **Password** fields are accepted on write and never returned.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.