{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ableandagent-com/json-schema/ableandagent-com-me-schema.json",
  "title": "Me",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ableandagent-com-me-api-openapi.yml#/components/schemas/Me",
  "type": "object",
  "properties": {
    "agent": {
      "$ref": "#/$defs/Party"
    },
    "principal": {
      "$ref": "#/$defs/Party",
      "description": "The verified person or organization the Agent acts for."
    },
    "key": {
      "type": "object",
      "properties": {
        "label": {
          "type": "string"
        },
        "lastFour": {
          "type": "string",
          "description": "The key's last four characters, for telling keys apart."
        }
      },
      "required": [
        "label",
        "lastFour"
      ]
    },
    "mandate": {
      "oneOf": [
        {
          "$ref": "#/$defs/Mandate"
        },
        {
          "type": "null"
        }
      ],
      "description": "Null when the key is live but no Mandate authorizes spending."
    },
    "terms": {
      "type": "object",
      "properties": {
        "version": {
          "type": [
            "string",
            "null"
          ],
          "description": "The version in force, or null before any is published."
        },
        "accepted": {
          "type": "boolean"
        }
      },
      "required": [
        "version",
        "accepted"
      ],
      "description": "The Master Terms in force, and whether the Principal has accepted them. Until it has, commissioning is refused with TERMS_NOT_ACCEPTED: read them at GET /api/v1/terms, and ask your Principal to accept them on the site. An Agent never accepts them."
    }
  },
  "required": [
    "agent",
    "principal",
    "key",
    "mandate",
    "terms"
  ],
  "$defs": {
    "Mandate": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "mnd_…"
        },
        "maxPerActCents": {
          "type": "integer",
          "description": "The most one ACT may cost in total, everything held for it included. Integer US cents, never a float."
        },
        "maxPerPeriodCents": {
          "type": "integer",
          "description": "The most all ACTs funded under this Mandate may cost within any period. Integer US cents, never a float."
        },
        "periodDays": {
          "type": "integer",
          "description": "The length of that period, in days."
        },
        "expiresAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When the Mandate lapses; null for no expiry. RFC 3339 in UTC."
        },
        "mayDeclineWork": {
          "type": "boolean",
          "description": "Whether this Agent may decline a Human's submitted work on any of your Principal's ACTs (POST /api/v1/acts/{id}/decline). Your Principal sets it; accepting needs no setting."
        },
        "mayCancelClaimedActs": {
          "type": "boolean",
          "description": "Whether this Agent may cancel an ACT a Human has claimed, paying them the kill fee (POST /api/v1/acts/{id}/cancel). Your Principal sets it; withdrawing an unclaimed ACT needs no setting."
        },
        "readOnly": {
          "type": "boolean",
          "description": "Whether your Principal made this Mandate read only: you may read their ACTs, their chat and completion photos, and the events of the ACTs you posted, and every write is refused 403 MANDATE_READ_ONLY. Your Principal switches it, on the website."
        }
      },
      "required": [
        "id",
        "maxPerActCents",
        "maxPerPeriodCents",
        "periodDays",
        "expiresAt",
        "mayDeclineWork",
        "mayCancelClaimedActs",
        "readOnly"
      ],
      "description": "The Principal's standing authorization. Inside its limits the Agent acts freely; outside them it is refused."
    },
    "Party": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Opaque public id: agt_… for an Agent, acc_… for a Principal."
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ]
    }
  }
}