Skip to content

Backup JSON format

Habiter exports a portable, versioned JSON document from Settings → Data & privacy. The current interface copies the document to the clipboard and accepts pasted JSON for import.

The canonical exporter schema is available as JSON Schema 2020-12.

Top-level document

json
{
  "schemaVersion": 1,
  "exportedAt": "2026-08-19T10:15:30.000Z",
  "habits": [],
  "entries": [],
  "settings": {
    "theme": "system",
    "notifications": true,
    "reminderTime": "20:00",
    "aiInsights": false,
    "language": "en"
  }
}
FieldTypeExportedImportedMeaning
schemaVersionIntegerYesYesFormat version. Current value is 1.
exportedAtISO 8601 UTC stringYesNoInformational export timestamp.
habitsArrayYesYesHabit definitions and lifecycle metadata.
entriesArrayYesYesCompletion records associated with habits.
settingsObjectYesNoNon-secret settings snapshot for inspection and future compatibility.

Import requires schemaVersion, habits, and entries. Unknown top-level fields and version-1 object fields are tolerated. A version greater than the app supports is rejected before storage changes.

Sensitive content

Backups contain habit names, descriptions, categories, history, and source metadata. Store them as private data. Integration credentials, passwords, tokens, secrets, and API keys are excluded.

Habit object

Every exported habit contains these fields:

FieldTypeMeaning
idStringStable local identity. IDs must be unique within the backup.
nameStringDisplay name.
descriptionString or nullOptional detail text.
colorStringStored display color, currently a hex color string.
iconStringStored icon identifier or glyph.
frequencydaily, weekly, or customScheduling mode.
targetCountIntegerTarget completions for the schedule.
categoryStringUser-visible grouping.
customDaysArray of integers or nullWeekdays using Dart's 1 (Monday) through 7 (Sunday) numbering.
createdAtISO 8601 stringCreation instant.
isActiveBooleanWhether the habit is currently active.
notificationEnabledBooleanLegacy per-habit notification flag.
notificationTimeHH:mm string or nullLegacy per-habit reminder time.

Lifecycle-aware habits may also contain:

FieldTypeMeaning
pausesArray of pause objectsEach item has startedAt and nullable endedAt ISO 8601 strings.
archivedAtISO 8601 stringMost recent archive instant.
restoredAtISO 8601 stringMost recent restore instant.
sourceObjectOrigin metadata for imported or suggested habits.

source.kind is currently local, classlyCompatible, imported, aiSuggested, or an unknown forward-compatible string. source.externalId is the optional stable ID in the origin system. Additional source fields are preserved.

Entry object

FieldTypeMeaning
idStringStable entry identity.
habitIdStringID of the owning habit.
dateyyyy-MM-dd stringLocal calendar date represented by the entry.
completedBooleanWhether the target was met.
countIntegerRecorded completion count.
timestampISO 8601 stringTime of the latest stored entry state.

Entries whose habitId is not known after habit merging are ignored during import.

Settings snapshot

The current app exports theme, notifications, reminderTime, aiInsights, language, and, when disabled, showRecoverySupport. Settings are intentionally not applied during import. Keys whose names resemble token, secret, password, apiKey, or credential are removed by the exporter.

Import transaction

  1. Habiter parses and validates the complete document.
  2. Duplicate habit IDs inside the backup cause rejection.
  3. The preview reports habit, entry, and local-ID collision counts without mutation.
  4. The current Settings flow keeps existing local habits on ID collision.
  5. Imported entries are upserted by entry ID only when their habit exists.
  6. The repository mutation is transactional and rolls back on failure.
  7. After a successful import, the pre-import recovery backup replaces the clipboard contents.

Imports do not delete local records that are absent from the backup. The internal service also supports replacing colliding habits for controlled callers, but that policy is not exposed by the current Settings UI.

Compatibility rules

  • Producers should emit schema version 1 exactly as described by the JSON Schema.
  • Consumers may ignore unknown fields so version-1 documents can gain additive metadata.
  • Changing a required field, its meaning, or its type requires a new schema version and migration tests.
  • Import behavior must remain reject-before-mutate for malformed or unsupported documents.

Released under the MIT License.