Skip to main content
Bludia validates every create and update against your field definitions, whether the write comes from the dashboard, the API, an import, or a hook. Invalid writes are rejected with 422 Unprocessable Entity and nothing is saved. Configure rules in the dashboard on each field under Validations.

Core rules

Rules by type

Formats: email, url, uuid, ip / ipv4, ipv6, phone (optional + and 7–15 digits), slug (lowercase letters, digits, and hyphens).

Cross-field rules

Unique together

A trip code may repeat from one year to the next, but only once per year. Put the rule on the trip code field and list the other fields by id:
In the collection editor, open Unique Together on the field and pick the other fields. The database enforces the rule, so it also holds when two people save at the same moment. A record with an empty value in any of these fields is not checked. Adding the rule while duplicates exist is refused with a 422 error. A field that a rule uses can’t be removed until the rule is removed.

Conditional rules

Apply rules only in some situations. A condition compares another field to a value:

Error response

Error messages name the field (its label, or its name when it has no label) and the failed rule, for example:
  • Field 'title' is required.
  • Field 'email' must be unique.
  • Field 'code' does not match the required pattern.
  • Field 'amount' has an invalid value for type 'number'.

Custom messages

You can replace the message of any rule on a field. In the field’s settings, open Custom error messages under a rule section, or fill in the message under Required or Unique. In the schema they live in validations.messages, keyed by rule:
{field} is replaced by the field’s label and {value} by the submitted value. Rules without a custom message keep the default. See Errors for the full error format.
Validate in your frontend for fast feedback, and rely on Bludia’s validation as the source of truth.