Skip to content
LydieDevelopers
Menu

Replace a database's schema and views

View as Markdown
PUT/v1/databases/{id}/definition

Applies a whole definition (what fromBase reads from a .base file): properties and views with a known id are updated, new ones created, live ones missing from it deleted. Row values are not touched.

docs:writeUndoableCannot be undone
Request
curl -X PUT "https://api.lydie.co/v1/databases/01JCQ3V5MZ8G4ZK2X7T9R6N1PB/definition" \
  -H "Authorization: Bearer $LYDIE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "definition": {
      "config": {},
      "properties": [
        {
          "id": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
          "name": "Notes",
          "type": "title",
          "key": "string"
        }
      ],
      "views": [
        {
          "id": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
          "name": "Notes",
          "type": "table",
          "config": {}
        }
      ]
    }
  }'

Path parameters

  • idULIDrequired

Body

  • definitionobjectrequired
    Show 3 fields
    • configDatabaseConfigInputrequired
      Show 3 fields
    • propertiesobject[]required
      Show 5 fields
      • idULIDrequired
      • namestringrequired· 1–200 chars
      • typestringrequired

        One oftitletextnumberselectmultiSelectstatusdatecheckboxurlemailphonepersonfilesrelationrollupformulauniqueIdcreatedTimeupdatedTimecreatedByupdatedBy

      • keystringrequired· 1–128 chars
      • configPropertyConfigInput

        Default {}

        Show 11 fields
        • optionsSelectOptionInput[]

          select, multiSelect, status

          Show 4 fields
          • idULIDrequired
          • namestringrequired· 1–200 chars
          • colorstring

            One ofdefaultgraybrownorangeyellowgreenbluepurplepinkred

            Default "default"

          • groupstring

            One oftodoinProgresscomplete

        • One ofnumberintegercommaspercentcurrency

        • decimalsinteger· 0–10
        • currencystring· 3–3 chars

          ISO 4217 code, with numberFormat currency

        • date: values carry a time

        • rangeboolean

          date: values may carry an end (start/end)

        • relationRelationConfigInput
          Show 4 fields
          • databaseIdULIDrequired

            The database whose rows this relation points at.

          • twoWayboolean

            Default false

          • The synced property on the other database (two-way relations).

            Default null

          • limitstring

            One ofonemany

            Default "many"

        • rollupRollupConfigInput
          Show 3 fields
          • relationPropertyIdULIDrequired
          • targetPropertyIdULIDrequired

            A property of the related database.

          • functionstringrequired

            One ofshowOriginalshowUniquecountcountValuescountUniquecountEmptycountNotEmptypercentEmptypercentNotEmptysumaveragemedianminmaxrangeearliestlatestcheckeduncheckedpercentCheckedpercentUnchecked

        • formula: an Obsidian Bases expression

        • prefixstring· ≤ 16 chars

          uniqueId: shown before the number ("LYD" → LYD-12)

        • extraobject
    • viewsobject[]required
      Show 4 fields

Response

  • databaseDatabase
    Show 8 fields
  • propertiesDatabaseProperty[]
    Show 13 fields
    • idULID
    • workspaceIdstring· 1–64 chars
    • namestring· 1–200 chars

      Display name (Bases displayName).

    • typestring

      One oftitletextnumberselectmultiSelectstatusdatecheckboxurlemailphonepersonfilesrelationrollupformulauniqueIdcreatedTimeupdatedTimecreatedByupdatedBy

    • keystring· 1–128 chars

      Stored types: the frontmatter key holding the value. Formulas, rollups, createdBy and updatedBy: the formula name in the .base file. Unused for title and created/updated time.

    • configPropertyConfig
      Show 11 fields
      • optionsSelectOption[]optional

        select, multiSelect, status

        Show 4 fields
        • idULID
        • namestring· 1–200 chars
        • colorstring

          One ofdefaultgraybrownorangeyellowgreenbluepurplepinkred

          Default "default"

        • groupstringoptional

          One oftodoinProgresscomplete

      • numberFormatstringoptional

        One ofnumberintegercommaspercentcurrency

      • decimalsintegeroptional· 0–10
      • currencystringoptional· 3–3 chars

        ISO 4217 code, with numberFormat currency

      • includeTimebooleanoptional

        date: values carry a time

      • rangebooleanoptional

        date: values may carry an end (start/end)

      • relationRelationConfigoptional
        Show 4 fields
        • The database whose rows this relation points at.

        • twoWayboolean

          Default false

        • The synced property on the other database (two-way relations).

          Default null

        • limitstring

          One ofonemany

          Default "many"

      • rollupRollupConfigoptional
        Show 3 fields
        • A property of the related database.

        • functionstring

          One ofshowOriginalshowUniquecountcountValuescountUniquecountEmptycountNotEmptypercentEmptypercentNotEmptysumaveragemedianminmaxrangeearliestlatestcheckeduncheckedpercentCheckedpercentUnchecked

      • expressionstringoptional

        formula: an Obsidian Bases expression

      • prefixstringoptional· ≤ 16 chars

        uniqueId: shown before the number ("LYD" → LYD-12)

      • extraobjectoptional
    • sortKeystring· 1–256 chars
    • createdAttimestamp
    • updatedAttimestamp
    • deletedAttimestampor null
    • createdBystringor nulloptional· ≥ 1 chars
    • updatedBystringor nulloptional· ≥ 1 chars
  • viewsDatabaseView[]
    Show 12 fields
200
{
  "database": {
    "id": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
    "workspaceId": "01JCQ3TZ0WJ8K4M2X7T9R6N1PA",
    "config": {
      "filter": null,
      "templateIds": [],
      "extra": {}
    },
    "createdAt": "2026-11-12T09:30:00.000Z",
    "updatedAt": "2026-11-12T09:30:00.000Z",
    "deletedAt": null,
    "createdBy": null,
    "updatedBy": null
  },
  "properties": [
    {
      "id": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
      "workspaceId": "01JCQ3TZ0WJ8K4M2X7T9R6N1PA",
      "databaseId": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
      "name": "Notes",
      "type": "title",
      "key": "string",
      "config": {
        "options": [
          null
        ],
        "numberFormat": "number",
        "decimals": 0,
        "currency": "string",
        "includeTime": false,
        "range": false,
        "relation": {
          "databaseId": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
          "twoWay": false,
          "reversePropertyId": null,
          "limit": "one"
        },
        "rollup": {
          "relationPropertyId": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
          "targetPropertyId": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
          "function": "showOriginal"
        },
        "expression": "string",
        "prefix": "string",
        "extra": {}
      },
      "sortKey": "a0",
      "createdAt": "2026-11-12T09:30:00.000Z",
      "updatedAt": "2026-11-12T09:30:00.000Z",
      "deletedAt": null,
      "createdBy": null,
      "updatedBy": null
    }
  ],
  "views": [
    {
      "id": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
      "workspaceId": "01JCQ3TZ0WJ8K4M2X7T9R6N1PA",
      "databaseId": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
      "name": "Notes",
      "type": "table",
      "config": {
        "filter": null,
        "sorts": [],
        "groupBy": null,
        "subGroupBy": null,
        "columns": [],
        "limit": null,
        "summaries": {},
        "layout": {},
        "extra": {}
      },
      "sortKey": "a0",
      "createdAt": "2026-11-12T09:30:00.000Z",
      "updatedAt": "2026-11-12T09:30:00.000Z",
      "deletedAt": null,
      "createdBy": null,
      "updatedBy": null
    }
  ]
}

Errors use one envelope for every endpoint. See Errors and versions.