Skip to content

Field types and value formats

Content type fields come in 14 types. For each type, this page lists the settings, the value format returned by the Content API, the values you can write, and whether the type can be used for filtering and sorting. The names are the same as on the content type screen in the admin.

Name in the admin kind What it holds Returned value When there is no value
[テキスト](Text) text One line of text, such as a title or name String No key
[テキストエリア](Text area) textArea Text with line breaks, such as a description String. Line breaks are \n No key
[リッチエディタ](Rich editor) richEditor Body text with headings, lists, images, and so on Hako Rich Text v1 JSON No key
[画像](Image) media One image { "url", "width", "height", "alt" } No key
[複数画像](Multiple images) mediaList Several images in order Array of images []
[ファイル](File) file A file such as a PDF { "url", "fileSize" } No key
[日時](Date and time) date A date and time, or a date UTC ISO 8601 string No key
[真偽値](Boolean) boolean On or off true or false false
[セレクト](Select) select A choice from fixed options Array of selected values []
[数字](Number) number A number such as a price or rank Number No key
[参照](Reference) relation One entry of another content type The referenced entry No key
[複数参照](Multiple references) relationList Several entries of another content type Array of referenced entries []
[カスタム](Custom) custom One custom field An object with fieldId and the inner fields No key
[繰り返し](Repeater) repeater Any number of custom fields Array of custom values []

Array types and booleans are always returned, even without a value. Other types are not returned at all, key included, when they have no value.

Name in the admin Key Type Required Default Rules
[フィールド ID](Field ID) fieldId String ○ 1–64 characters, starting with a letter followed by letters, digits, _, or -. Unique within the schema. Cannot be changed after saving
[表示名](Display name) name String ○ 1–100 characters
[説明](Description) description String None Up to 500 characters. Shown below the input for the people entering content
[必須](Required) required Boolean false Requires a value when publishing. Not required when saving a draft
[種類](Type) kind String ○ One of the 14 in the table above

The field ID becomes the key in Content API responses. sys id createdAt updatedAt publishedAt revisedAt fieldId are used by Hako CMS, so you cannot use them as field IDs. The IDs of deleted fields are also kept so they can be restored, so you cannot use them for new fields.

The schema JSON has the following form. On the content type screen in the admin, press [JSON で編集](Edit as JSON) to edit it in the same form.

{
"fields": [
{ "fieldId": "title", "name": "タイトル", "kind": "text",
"required": true, "unique": true, "maxLength": 100 },
{ "fieldId": "tags", "name": "タグ", "kind": "select", "multiple": true,
"options": [
{ "id": "a1", "value": "news" },
{ "id": "b2", "value": "tech" }
] },
{ "fieldId": "blocks", "name": "ブロック", "kind": "repeater",
"customFieldIds": ["text"] }
],
"customFields": [
{ "id": "text", "name": "テキスト",
"fields": [{ "fieldId": "body", "name": "本文", "kind": "richEditor" }] }
]
}

If you omit a setting, no constraint applies.

When you save a draft, required, minimum length, and minimum count are not checked. All settings are checked when you publish. If a value does not match, 400 is returned, and issues shows which field does not match and why.

Name in the admin Key Type Default Rules
[重複を許さない](Do not allow duplicates) unique Boolean false Does not allow the same value as another entry of the same content type
[最小文字数](Minimum length) minLength Integer None 0 or more
[最大文字数](Maximum length) maxLength Integer None 0 or more
[正規表現](Regular expression) pattern String None The whole value must match this regular expression. Up to 1000 bytes
  • Length is counted in Unicode characters (scalar values). Make minLength less than or equal to maxLength
  • The regular expression is applied to the whole value (it compares the whole value even if you do not write ^ and $ at the start and end). The syntax is that of Rust’s regex. Lookbehind and backreferences are not supported
  • The do-not-allow-duplicates setting cannot be added to text inside a custom field
Name in the admin Key Type Default Rules
[最小文字数](Minimum length) minLength Integer None 0 or more
[最大文字数](Maximum length) maxLength Integer None 0 or more
[正規表現](Regular expression) pattern String None The whole value must match this regular expression. Up to 1000 bytes

The length and regular expression rules are the same as for text.

Rich editor (richEditor), image (media), file (file), boolean (boolean)

Section titled “Rich editor (richEditor), image (media), file (file), boolean (boolean)”

There are no settings other than the settings for every type.

Name in the admin Key Type Default Rules
(Minimum count) minCount Integer None 0 or more
[最大件数](Maximum count) maxCount Integer None 0 or more
Name in the admin Key Type Default Rules
[日付のみ](Date only) dateOnly Boolean false Lets people enter only a date in the admin

dateOnly changes only how the value is entered. The value returned by the API is always a date and time string.

Name in the admin Key Type Default Rules
[選択肢(1 行に 1 つ)](Options, one per line) options Array of { "id", "value" } Required. value is the value returned by the API. id is for tracking an option after reordering or renaming
[複数選択](Multiple selection) multiple Boolean false Allows selecting two or more

At least one option is required. id and value cannot be empty and must not repeat across options.

Even when multiple is false, the value is returned as an array of one value (["news"]).

Name in the admin Key Type Default Rules
[最小値](Minimum value) min Number None
[最大値](Maximum value) max Number None Greater than or equal to min
Name in the admin Key Type Default Rules
[参照先のコンテンツタイプ](Referenced content type) contentTypeId String Required. The ID of the referenced content type (the Admin API id, not the endpoint)

In a schema file (*.hako.json), write the referenced content type in contentType as its endpoint. Do not write contentTypeId.

Name in the admin Key Type Default Rules
[参照先のコンテンツタイプ](Referenced content type) contentTypeId String Required. Same as reference
(Minimum count) minCount Integer None 0 or more
[最大件数](Maximum count) maxCount Integer None 0 or more
Name in the admin Key Type Default Rules
[カスタムフィールド](Custom field) customFieldId String Required. The id in the schema’s customFields
Name in the admin Key Type Default Rules
[使えるカスタムフィールド](Allowed custom fields) customFieldIds Array of strings Required. The id in the schema’s customFields
(Minimum count) minCount Integer None 0 or more
[最大件数](Maximum count) maxCount Integer None 0 or more

Inside a repeater, you can place the allowed custom fields in any order, mixing types. At least one entry in customFieldIds is required.

For count settings, make minCount less than or equal to maxCount. Settings marked “(Minimum count)” do not appear in the form in the admin. Set them with [JSON で編集](Edit as JSON) or the Admin API.

A custom field is a container that groups several fields. Put it in the schema’s customFields and use it from custom and repeater fields.

Name in the admin Key Type Required Rules
[ID] id String ○ 1–64 characters, starting with a letter followed by letters, digits, _, or -. Becomes the fieldId of the value. Cannot be changed after saving
[名前](Name) name String ○ 1–100 characters
[フィールド](Fields) fields Array of fields ○ The inner fields. Same form as regular fields

You cannot place custom or repeater fields inside a custom field.

A custom value has fieldId, which shows which custom field it is, and the values of the inner fields.

"seo": { "fieldId": "seo", "description": "Hako CMS の紹介です" }

The values returned when reading with the Content API.

Type Returned value
Text, text area String. Line breaks are \n
Rich editor Hako Rich Text v1 JSON. With richText=html, an HTML string
Image { "url", "width", "height", "alt" }. width, height, and alt may be missing
Multiple images Array of images
File { "url", "fileSize" }
Date and time UTC ISO 8601, with milliseconds (2026-10-08T06:00:00.000Z)
Boolean true or false
Select Array of selected values. An array even for one
Number Number
Reference The referenced entry. Expanded up to the include levels; beyond that, only { "sys": { "id", "contentType" } }
Multiple references Array of referenced entries
Custom { "fieldId": <custom field ID>, …inner fields }
Repeater Array of custom values

References to entries that are not published, have been unpublished, or have been deleted are not returned. For a reference, the key disappears. For multiple references, they are removed from the array. For details, see Get referenced entries together.

When you write with the Content API and Admin API, the following forms are accepted in addition to the same form as the returned values.

Type Value to send
Text, text area String
Rich editor Hako Rich Text v1 JSON, or an HTML string
Image, file { "url": … }, or a URL string
Multiple images Array of images
Date and time ISO 8601 string. Saved normalized to UTC
Boolean true or false
Select Array of values to select
Number Number
Reference The referenced entry ID, or { "sys": { "id": … } }
Multiple references An array of those
Custom An object with fieldId
Repeater Array of custom values
  • You can also put external URLs in images and files. If it is the URL of media in this space, the width and height (fileSize for files) are filled in from the media’s values. You cannot use media from other spaces. You cannot put media that is not an image in an image field
  • When you send HTML to a rich editor, it is converted to elements the editor can handle and saved. For elements it cannot handle, only their content remains, and <script> and similar elements are discarded
  • To clear a value (PATCH), send null for any type. An array becomes empty with []
  • Sending a field not in the schema returns 400

Whether each type can be used with where, order, and q in the Content API. For how to write them, see Filter, sort, and paginate.

Type Operators available in where order q
Text, text area = != contains not contains startsWith in not in exists ○ ○
Rich editor exists ○
Image, file exists
Multiple images exists (whether not empty)
Date and time = != < <= > >= startsWith in not in exists ○
Boolean = != in not in. false if there is no value
Select = != contains not contains in not in exists. = means “contains the element”
Number = != < <= > >= in not in exists ○
Reference = != in not in exists. The value is the referenced entry ID
Multiple references = != contains not contains in not in exists. = means “contains the element”
Custom exists Searches the text inside
Repeater exists (whether not empty) Searches the text inside

Filtering by a field of the referenced entry (author.name = "Kohei") is not possible yet.

  • You can change the type only between text and text area, and from number to text. If you want another type, add a new field
  • When you delete a field, it is removed from API responses. The values remain for a while, and if you restore a field with the same field ID, the values come back with it. 30 days after deletion, the values are also deleted
  • When you make a change that current entries no longer match, such as making a field required or tightening the length, the number of non-matching entries is shown before saving. Once you apply it, non-matching entries must be fixed the next time they are saved
  • You cannot add the do-not-allow-duplicates setting while current entries have the same value. Fix the duplicates first