Skip to content

Data Import / Export

Import

You can import comments either to migrate from another comment system or to restore a backup. Imports use a JSON file that conforms to the schema defined below. Commentix exports are compatible by default; exports from other systems must be transformed accordingly.

To import comments, open the Commentix Console, navigate to Data Import / Export, and upload the JSON file.

Info

The maximum import file size is currently limited to 2 MB. For larger imports, please contact us.

Schema

To be eligible for import, a JSON file must conform to the following schema.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "required": ["site", "threads"],
  "properties": {
    "site": {
      "$ref": "#/$defs/Site"
    },
    "threads": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Thread"
      }
    }
  },
  "$defs": {
    "Site": {
      "type": "object",
      "required": ["origin"],
      "properties": {
        "origin": {
          "type": "string"
        },
        "origin_alternative": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "Thread": {
      "type": "object",
      "required": ["id", "url", "comments"],
      "properties": {
        "id": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "closed": {
          "type": "boolean"
        },
        "comments": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Comment"
          }
        }
      },
      "additionalProperties": false
    },
    "Comment": {
      "type": "object",
      "required": [
        "name",
        "message",
        "likes",
        "pinned",
        "published",
        "created_at",
        "replies"
      ],
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100
        },
        "message": {
          "type": "string",
          "maxLength": 5000
        },
        "email": {
          "type": "string",
          "format": "email"
        },
        "likes": {
          "type": "integer",
          "minimum": 0
        },
        "notify_by_email": {
          "type": "boolean"
        },
        "pinned": {
          "type": "boolean"
        },
        "published": {
          "type": "boolean"
        },
        "created_at": {
          "type": "integer",
          "minimum": 0,
          "description": "Unix timestamp (seconds)"
        },
        "replies": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Comment"
          }
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}

Example

{
  "site": {
    "origin": "https://www.example.com",
    "origin_alternative": "https://example.com"
  },
  "threads": [
    {
      "id": "/blog/example/",
      "url": "https://www.example.com/blog/example/",
      "closed": false,
      "comments": [
        {
          "name": "User #1",
          "message": "Lorem ipsum dolor sit amet.",
          "email": "[email protected]",
          "likes": 3,
          "notify_by_email": true,
          "pinned": false,
          "published": true,
          "created_at": 1768214946,
          "replies": []
        },
        {
          "name": "User #2",
          "message": "Lorem ipsum dolor sit amet.",
          "likes": 1,
          "pinned": false,
          "published": true,
          "created_at": 1768298123,
          "replies": [
            {
              "name": "User #3",
              "message": "Lorem ipsum dolor sit amet.",
              "likes": 0,
              "pinned": false,
              "published": true,
              "created_at": 1768298204,
              "replies": []
            }
          ]
        }
      ]
    }
  ]
}

Export

To create a backup or migrate to another commenting system, you can download a JSON export from the Commentix Console under Data Import / Export.