{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/replynodes-com/json-schema/replynodes-com-agent-status-schema.json",
  "title": "AgentStatus",
  "description": "A key's own standing (ADR 0024). Restricted keys report a per-key keyless quota; verified and workspace keys report their credit balance.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/replynodes-com-openapi.json#/components/schemas/AgentStatus",
  "type": "object",
  "required": [
    "data",
    "meta"
  ],
  "properties": {
    "data": {
      "type": "object",
      "required": [
        "key",
        "quota",
        "credits",
        "next_actions"
      ],
      "properties": {
        "key": {
          "type": "object",
          "required": [
            "prefix",
            "class",
            "status",
            "expires_at"
          ],
          "properties": {
            "prefix": {
              "type": "string"
            },
            "class": {
              "type": "string",
              "enum": [
                "workspace",
                "agent_read"
              ]
            },
            "status": {
              "type": "string",
              "enum": [
                "restricted",
                "verified",
                "active"
              ]
            },
            "expires_at": {
              "type": [
                "string",
                "null"
              ],
              "format": "date-time"
            }
          }
        },
        "quota": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "basis": {
              "type": "string",
              "const": "per_key_per_utc_day"
            },
            "reset_at": {
              "type": "string",
              "format": "date-time"
            },
            "capabilities": {
              "type": "object",
              "additionalProperties": {
                "type": "object",
                "required": [
                  "limit",
                  "remaining"
                ],
                "properties": {
                  "limit": {
                    "type": "integer"
                  },
                  "remaining": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "credits": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "balance": {
              "type": "number"
            },
            "unit": {
              "type": "string",
              "const": "credit"
            }
          }
        },
        "next_actions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/NextAction"
          }
        }
      }
    },
    "meta": {
      "$ref": "#/$defs/GatewayResponseMeta"
    }
  },
  "$defs": {
    "GatewayResponseMeta": {
      "type": "object",
      "required": [
        "request_id"
      ],
      "properties": {
        "request_id": {
          "type": "string"
        },
        "contract_version": {
          "type": "string"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "availability": {
          "type": "string"
        },
        "detail": {
          "type": "string"
        },
        "missing_fields": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "next_cursor": {
          "type": "string"
        },
        "stale": {
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "NextAction": {
      "type": "object",
      "description": "Typed next step for an agent (ADR 0024). Present only where a next step exists; branch on action, never on message text.",
      "required": [
        "action",
        "method",
        "url",
        "required_fields",
        "docs"
      ],
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "get_api_key",
            "verify_email",
            "resend_code",
            "renew_key",
            "top_up",
            "retry_later"
          ],
          "description": "Closed set; values may be added, never renamed or removed."
        },
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST"
          ]
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "required_fields": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "optional_fields": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "human_message": {
          "type": "string",
          "description": "Short sentence the agent can show its human."
        },
        "docs": {
          "type": "string",
          "format": "uri"
        },
        "retry_after_seconds": {
          "type": "integer",
          "minimum": 1,
          "description": "When the same request may be retried without completing the action."
        },
        "auth": {
          "type": "string",
          "enum": [
            "bearer_api_key"
          ],
          "description": "Credential the call needs; bearer_api_key means send the same API key as a Bearer token."
        }
      },
      "additionalProperties": false
    }
  }
}