{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/keep-md/json-schema/keep-md-api-token-schema.json",
  "title": "ApiToken",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/keep-md-openapi.json#/components/schemas/ApiToken",
  "type": "object",
  "required": [
    "id",
    "type",
    "createdAt"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "personal"
      ]
    },
    "tokenType": {
      "type": "string",
      "enum": [
        "personal"
      ]
    },
    "token": {
      "type": "string",
      "description": "Returned only when a credential is created or rolled."
    },
    "name": {
      "type": [
        "string",
        "null"
      ]
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "account.read",
          "items.read",
          "items.write",
          "items.delete",
          "tags.read",
          "tags.write",
          "collections.read",
          "collections.write",
          "projects.read",
          "projects.write",
          "highlights.read",
          "highlights.write",
          "notes.read",
          "notes.write",
          "webhooks.read",
          "webhooks.write"
        ]
      }
    },
    "scopeVersion": {
      "type": "integer"
    },
    "resourceScope": {
      "type": [
        "object",
        "null"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/ResourceScope"
        }
      ]
    },
    "tokenPrefix": {
      "type": "string"
    },
    "tokenSuffix": {
      "type": "string"
    },
    "createdAt": {
      "type": "integer"
    },
    "updatedAt": {
      "type": "integer"
    },
    "lastUsedAt": {
      "type": [
        "integer",
        "null"
      ]
    }
  },
  "additionalProperties": true,
  "$defs": {
    "ResourceScope": {
      "type": "object",
      "properties": {
        "tagSlugs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "collectionIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    }
  }
}