Skip to content

add_field

Add a field to a model before publishing its schema, optionally as unique.

Unknown or wrong-type settings keys are rejected at authoring. settings keys are per type:

  • varchar/text: max_length (legacy maxLength is also accepted).
  • decimal: precision and scale.
  • reference: target_model_id, which must name a model in this same application.
  • vector: dimension, a positive integer up to 8192, and metric, which must be “cosine” and defaults to it.
  • file: visibility, either “private” or “public”.

Any type also accepts input, “select” or “multiselect”, with a non-empty options list of strings. “select” requires a varchar or text field and “multiselect” requires a json field. credential_strategy accepts “password_hash”.

{
"additionalProperties": false,
"properties": {
"application_id": {
"title": "Application Id",
"type": "string"
},
"default_value": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"title": "Default Value"
},
"idempotency_key": {
"title": "Idempotency Key",
"type": "string"
},
"is_unique": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"title": "Is Unique"
},
"label": {
"title": "Label",
"type": "string"
},
"model_id": {
"title": "Model Id",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
},
"position": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Position"
},
"required": {
"default": false,
"title": "Required",
"type": "boolean"
},
"settings": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Settings"
},
"type": {
"enum": [
"boolean",
"date",
"decimal",
"file",
"integer",
"json",
"reference",
"text",
"timestamp",
"uuid",
"varchar",
"vector"
],
"title": "Type",
"type": "string"
}
},
"required": [
"application_id",
"model_id",
"name",
"label",
"type",
"idempotency_key"
],
"title": "add_fieldArguments",
"type": "object"
}
{
"description": "Schema for field data in responses.",
"properties": {
"createdAt": {
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
],
"title": "Createdat"
},
"defaultValue": {
"title": "Defaultvalue"
},
"id": {
"format": "uuid",
"title": "Id",
"type": "string"
},
"isRequired": {
"title": "Isrequired",
"type": "boolean"
},
"isUnique": {
"title": "Isunique",
"type": "boolean"
},
"label": {
"title": "Label",
"type": "string"
},
"modelId": {
"format": "uuid",
"title": "Modelid",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
},
"position": {
"title": "Position",
"type": "integer"
},
"settings": {
"additionalProperties": true,
"title": "Settings",
"type": "object"
},
"tenantId": {
"format": "uuid",
"title": "Tenantid",
"type": "string"
},
"type": {
"title": "Type",
"type": "string"
},
"updatedAt": {
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
],
"title": "Updatedat"
},
"workspaceId": {
"format": "uuid",
"title": "Workspaceid",
"type": "string"
}
},
"required": [
"id",
"tenantId",
"workspaceId",
"modelId",
"name",
"label",
"type",
"isRequired",
"isUnique",
"position"
],
"title": "FieldResponse",
"type": "object"
}