{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sendly-now/json-schema/sendly-now-api-key-schema.json",
  "title": "ApiKey",
  "description": "An API key's metadata. Never carries the token or its hash — `lastFour` is the only surviving fragment of the secret once the key has been created.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sendly-now-api-keys-api-openapi.yml#/components/schemas/ApiKey",
  "properties": {
    "createdAt": {
      "description": "ISO 8601 datetime string",
      "format": "date-time",
      "type": "string"
    },
    "domainId": {
      "format": "uuid",
      "type": [
        "string",
        "null"
      ]
    },
    "id": {
      "format": "uuid",
      "type": "string"
    },
    "lastFour": {
      "description": "Last 4 characters of the token — the only fragment of the secret that survives creation.",
      "type": "string"
    },
    "lastUsedAt": {
      "description": "ISO 8601 datetime string",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "legacyGrantPreset": {
      "description": "The coarse preset the key was minted under. It picks the token prefix (`sk_` vs `pk_`) and the rate-limit window, and it is the key's authority ONLY while `scopes` is empty — which is true just of keys minted before scopes existed. Read `scopes` to learn what a key can do.",
      "enum": [
        "FULL",
        "SENDING_ONLY"
      ],
      "type": "string"
    },
    "mode": {
      "description": "Where mail sent with this key may go. `LIVE` sends from your verified domains. `TEST` can only send from this project's sandbox address, whose recipient list is your own verified account addresses, so a test key cannot reach a customer whatever it is asked to do. Fixed at creation.",
      "enum": [
        "LIVE",
        "TEST"
      ],
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "projectId": {
      "format": "uuid",
      "type": "string"
    },
    "revokedAt": {
      "description": "Set once the key is revoked. Revoked keys are NOT filtered out of list/get responses.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "scopes": {
      "description": "The explicit scope grant this key carries. Empty on a key minted before this column existed — that row's grant is derived from `legacyGrantPreset` instead at request time.",
      "items": {
        "enum": [
          "emails:send",
          "emails:read",
          "contacts:read",
          "contacts:write",
          "campaigns:read",
          "campaigns:write",
          "segments:read",
          "segments:write",
          "workflows:read",
          "workflows:write",
          "templates:read",
          "templates:write",
          "domains:read",
          "domains:write",
          "webhooks:read",
          "webhooks:write",
          "suppression:read",
          "suppression:write",
          "analytics:read",
          "usage:read",
          "events:read",
          "events:write",
          "projects:read",
          "projects:write",
          "api-keys:read",
          "api-keys:write",
          "campaigns:send",
          "mailboxes:read",
          "mailboxes:write",
          "emails:test",
          "deliverability:read",
          "mailboxes:send",
          "validation:read",
          "validation:write",
          "topics:read",
          "topics:write",
          "lists:read",
          "lists:write",
          "mailbox-conversations:read",
          "mailbox-conversations:reply",
          "billing:read",
          "billing:write",
          "account:read",
          "account:write",
          "members:read",
          "members:write",
          "connections:read",
          "connections:write",
          "support:read",
          "support:write"
        ],
        "type": "string"
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "projectId",
    "name",
    "lastFour",
    "legacyGrantPreset",
    "mode",
    "scopes",
    "domainId",
    "lastUsedAt",
    "createdAt",
    "revokedAt"
  ],
  "type": "object"
}