{
  "openapi": "3.1.0",
  "info": {
    "title": "SAgent \u2014 South Africa SASSA Payment Information API",
    "version": "2.0.0",
    "summary": "Agent-first JSON API returning current, source-attributed SASSA social grant payment dates and payment-affecting announcements. Monetised with x402 v2 (Base mainnet, eip155:8453, USDC), with legacy x402 v1 clients still supported.",
    "description": "SAgent is an agent-first information service. This resource returns current South African Social Security Agency (SASSA) social grant payment information. SASSA is the originating authority. Where sassa.gov.za is directly reachable it is used as the primary source; otherwise official South African government confirmations of the SASSA schedule (Department of Social Development, SAnews/GCIS, gov.za) are used and cited by exact URL. Data is acquired in the background on a payment-aware schedule and served from a database \u2014 agent requests never trigger a live scrape. Payment dates are never inferred, predicted or estimated: every record carries its source URL, retrieval timestamp, verification timestamp and verification status.\n\nPayment: all data endpoints require x402 payment. The endpoint is dual-stack. x402 v2 clients receive HTTP 402 with a base64 `PAYMENT-REQUIRED` header (scheme `exact`, network `eip155:8453`, USDC), resubmit with a `PAYMENT-SIGNATURE` header and receive a `PAYMENT-RESPONSE` receipt. Legacy x402 v1 clients receive the same 402 with a JSON `accepts` array (network `base`), resubmit with `X-PAYMENT` and receive `X-PAYMENT-RESPONSE`. Both paths verify and settle through the same facilitator and the same wallet. `/sassa/health` is free.",
    "contact": {
      "name": "SAgent",
      "email": "connect@havenaid.org",
      "url": "https://www.havenaid.org"
    },
    "license": {
      "name": "Commercial \u2014 pay per request via x402",
      "url": "https://www.havenaid.org/sagent/llms.txt"
    },
    "x-x402": {
      "enabled": true,
      "protocol": "x402",
      "protocol_versions": [
        2,
        1
      ],
      "x402Version": 2,
      "scheme": "exact",
      "network": "eip155:8453",
      "network_legacy": "base",
      "chain_id": 8453,
      "currency": "USDC",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "pay_to": "0x91DA47bF2Bb792f28aB7AB21AD7c3d9215DF09F1",
      "facilitator": "https://facilitator.payai.network",
      "headers": {
        "v2": {
          "challenge": "PAYMENT-REQUIRED",
          "payment": "PAYMENT-SIGNATURE",
          "receipt": "PAYMENT-RESPONSE"
        },
        "v1": {
          "challenge": "response body",
          "payment": "X-PAYMENT",
          "receipt": "X-PAYMENT-RESPONSE"
        }
      },
      "resources": [
        "https://buavethsjahoodbeqhay.supabase.co/functions/v1/sagent",
        "https://buavethsjahoodbeqhay.supabase.co/functions/v1/sagent/payment-dates",
        "https://buavethsjahoodbeqhay.supabase.co/functions/v1/sagent/announcements",
        "https://buavethsjahoodbeqhay.supabase.co/functions/v1/sassa"
      ],
      "discovery": "https://www.havenaid.org/.well-known/x402"
    },
    "x-pricing": {
      "model": "outcome-based, per successful request",
      "simple": "0.01 USDC \u2014 simple SASSA answer",
      "specific": "0.02 USDC \u2014 specific or filtered answer",
      "compound": "0.05 USDC \u2014 multi-source verified / compound answer",
      "health": "free"
    },
    "x-geography": "ZA",
    "x-freshness": {
      "normal": "every 6 hours",
      "seven_days_before_payment_date": "every 2 hours",
      "three_days_before_until_day_after_payment_date": "every 30 minutes",
      "active_change_detected": "every 15 minutes until processed and verified"
    }
  },
  "servers": [
    {
      "url": "https://buavethsjahoodbeqhay.supabase.co/functions/v1",
      "description": "Production"
    }
  ],
  "paths": {
    "/sassa": {
      "get": {
        "operationId": "getSassa",
        "summary": "Primary agent endpoint \u2014 next payment, upcoming schedule, payment-affecting announcements and verification in one response.",
        "x-price": "0.01 USDC simple / 0.02 USDC filtered / 0.05 USDC compound",
        "parameters": [
          {
            "name": "grant",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/GrantType"
            },
            "description": "Restrict the answer to one grant type. Billed as a specific answer (0.02 USDC)."
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "next_payment",
                "payment_schedule",
                "recent_changes"
              ],
              "default": "next_payment"
            },
            "description": "Agent intent. Anything other than next_payment is billed as a compound answer (0.05 USDC)."
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all"
              ]
            },
            "description": "Force a compound response (0.05 USDC)."
          },
          {
            "$ref": "#/components/parameters/XPayment"
          },
          {
            "$ref": "#/components/parameters/XPaymentLegacy"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/PaidAnswer"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/PaymentRequired"
          }
        },
        "security": [
          {
            "x402": []
          }
        ]
      }
    },
    "/sassa/payment-dates": {
      "get": {
        "operationId": "getPaymentDates",
        "summary": "Structured SASSA payment dates.",
        "x-price": "0.01 USDC unfiltered / 0.02 USDC filtered",
        "parameters": [
          {
            "name": "grant",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/GrantType"
            }
          },
          {
            "name": "month",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          },
          {
            "name": "year",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "upcoming",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            },
            "description": "When true (default, and only applied when no month/year filter is given) only dates from today onwards are returned."
          },
          {
            "$ref": "#/components/parameters/XPayment"
          },
          {
            "$ref": "#/components/parameters/XPaymentLegacy"
          }
        ],
        "responses": {
          "200": {
            "description": "Payment dates",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentDates"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ]
      }
    },
    "/sassa/announcements": {
      "get": {
        "operationId": "getAnnouncements",
        "summary": "Recent official SASSA-related announcements relevant to payments.",
        "x-price": "0.01 USDC unfiltered / 0.02 USDC filtered",
        "parameters": [
          {
            "name": "grant",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/GrantType"
            }
          },
          {
            "name": "affects_payment_schedule",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 50
            }
          },
          {
            "$ref": "#/components/parameters/XPayment"
          },
          {
            "$ref": "#/components/parameters/XPaymentLegacy"
          }
        ],
        "responses": {
          "200": {
            "description": "Announcements",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Announcements"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ]
      }
    },
    "/sassa/grants": {
      "get": {
        "operationId": "getGrants",
        "summary": "SASSA grant programme information \u2014 eligibility, means test, amounts, application requirements and official source.",
        "x-price": "0.01 USDC unfiltered / 0.02 USDC filtered",
        "responses": {
          "200": {
            "description": "Announcements",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Announcements"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ]
      }
    },
    "/sassa/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Service status, source availability, last successful source check and data freshness. Free, no payment required.",
        "x-price": "free",
        "responses": {
          "200": {
            "description": "Operational information",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/sagent": {
      "get": {
        "operationId": "getSagent",
        "summary": "Canonical /sagent route \u2014 Primary agent endpoint \u2014 next payment, upcoming schedule, payment-affecting announcements and verification in one response.",
        "x-price": "$0.01 USDC",
        "parameters": [
          {
            "name": "grant",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/GrantType"
            },
            "description": "Restrict the answer to one grant type. Billed as a specific answer (0.02 USDC)."
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "next_payment",
                "payment_schedule",
                "recent_changes"
              ],
              "default": "next_payment"
            },
            "description": "Agent intent. Anything other than next_payment is billed as a compound answer (0.05 USDC)."
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all"
              ]
            },
            "description": "Force a compound response (0.05 USDC)."
          },
          {
            "$ref": "#/components/parameters/XPayment"
          },
          {
            "$ref": "#/components/parameters/XPaymentLegacy"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/PaidAnswer"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/PaymentRequired"
          }
        },
        "security": [
          {
            "x402": []
          }
        ],
        "x-payment-info": {
          "x402Version": 2,
          "scheme": "exact",
          "network": "eip155:8453",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x91DA47bF2Bb792f28aB7AB21AD7c3d9215DF09F1",
          "amount": "10000",
          "maxAmountRequired": "10000",
          "price": "$0.01 USDC",
          "currency": "USDC",
          "decimals": 6,
          "maxTimeoutSeconds": 60,
          "facilitator": "https://facilitator.payai.network",
          "mimeType": "application/json",
          "method": "GET",
          "extra": {
            "name": "USD Coin",
            "version": "2"
          }
        },
        "x-x402": true
      }
    },
    "/sagent/payment-dates": {
      "get": {
        "operationId": "getPaymentDates",
        "summary": "Canonical /sagent route \u2014 Structured SASSA payment dates.",
        "x-price": "$0.02 USDC",
        "parameters": [
          {
            "name": "grant",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/GrantType"
            }
          },
          {
            "name": "month",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          },
          {
            "name": "year",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "upcoming",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            },
            "description": "When true (default, and only applied when no month/year filter is given) only dates from today onwards are returned."
          },
          {
            "$ref": "#/components/parameters/XPayment"
          },
          {
            "$ref": "#/components/parameters/XPaymentLegacy"
          }
        ],
        "responses": {
          "200": {
            "description": "Payment dates",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentDates"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ],
        "x-payment-info": {
          "x402Version": 2,
          "scheme": "exact",
          "network": "eip155:8453",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x91DA47bF2Bb792f28aB7AB21AD7c3d9215DF09F1",
          "amount": "20000",
          "maxAmountRequired": "20000",
          "price": "$0.02 USDC",
          "currency": "USDC",
          "decimals": 6,
          "maxTimeoutSeconds": 60,
          "facilitator": "https://facilitator.payai.network",
          "mimeType": "application/json",
          "method": "GET",
          "extra": {
            "name": "USD Coin",
            "version": "2"
          }
        },
        "x-x402": true
      }
    },
    "/sagent/announcements": {
      "get": {
        "operationId": "getAnnouncements",
        "summary": "Canonical /sagent route \u2014 Recent official SASSA-related announcements relevant to payments.",
        "x-price": "$0.02 USDC",
        "parameters": [
          {
            "name": "grant",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/GrantType"
            }
          },
          {
            "name": "affects_payment_schedule",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 50
            }
          },
          {
            "$ref": "#/components/parameters/XPayment"
          },
          {
            "$ref": "#/components/parameters/XPaymentLegacy"
          }
        ],
        "responses": {
          "200": {
            "description": "Announcements",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Announcements"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ],
        "x-payment-info": {
          "x402Version": 2,
          "scheme": "exact",
          "network": "eip155:8453",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x91DA47bF2Bb792f28aB7AB21AD7c3d9215DF09F1",
          "amount": "20000",
          "maxAmountRequired": "20000",
          "price": "$0.02 USDC",
          "currency": "USDC",
          "decimals": 6,
          "maxTimeoutSeconds": 60,
          "facilitator": "https://facilitator.payai.network",
          "mimeType": "application/json",
          "method": "GET",
          "extra": {
            "name": "USD Coin",
            "version": "2"
          }
        },
        "x-x402": true
      }
    },
    "/sagent/grants": {
      "get": {
        "operationId": "getGrantsSagent",
        "summary": "SASSA grant programme information \u2014 eligibility, means test, amounts, application requirements and official source.",
        "x-price": "$0.02 USDC",
        "responses": {
          "200": {
            "description": "Announcements",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Announcements"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ],
        "x-payment-info": {
          "x402Version": 2,
          "scheme": "exact",
          "network": "eip155:8453",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x91DA47bF2Bb792f28aB7AB21AD7c3d9215DF09F1",
          "amount": "20000",
          "maxAmountRequired": "20000",
          "price": "$0.02 USDC",
          "currency": "USDC",
          "decimals": 6,
          "maxTimeoutSeconds": 60,
          "facilitator": "https://facilitator.payai.network",
          "mimeType": "application/json",
          "method": "GET",
          "extra": {
            "name": "USD Coin",
            "version": "2"
          }
        },
        "x-x402": true
      }
    },
    "/sagent/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Canonical /sagent route \u2014 Service status, source availability, last successful source check and data freshness. Free, no payment required.",
        "x-price": "free",
        "responses": {
          "200": {
            "description": "Operational information",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/sagent/fuel": {
      "get": {
        "operationId": "getFuel",
        "summary": "Official South African monthly fuel price adjustments (DMPR).",
        "description": "Month-on-month adjustments in cents (c/l or c/kg) for petrol 93/95, diesel 50ppm/500ppm, illuminating paraffin, LPGas, crude oil, exchange rate and slate levy, with source URL and verification timestamp.",
        "x-price": "0.02 USDC",
        "parameters": [
          {
            "name": "product",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "petrol-95",
                "petrol-93",
                "diesel-50ppm",
                "diesel-500ppm",
                "paraffin-wholesale",
                "paraffin-smnrp",
                "lpg",
                "crude-oil",
                "levies-exchange",
                "announcements"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/XPayment"
          },
          {
            "$ref": "#/components/parameters/XPaymentLegacy"
          }
        ],
        "responses": {
          "200": {
            "description": "Fuel price adjustments",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ]
      }
    },
    "/sagent/sarb": {
      "get": {
        "operationId": "getSarb",
        "summary": "Official South African Reserve Bank indicators and daily rand exchange rates.",
        "description": "Repo/prime and money-market rates, SARB daily 10:30 weighted-average rand exchange rates for 25+ currencies (USD, EUR, GBP, CNY, INR, BWP, MZN, KES, ZMW and more), USD cross rates, gold price and CPI/PPI inflation, with source URL and verification timestamp.",
        "x-price": "0.02 USDC",
        "parameters": [
          {
            "name": "group",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "interest_rates",
                "exchange_rates",
                "inflation",
                "fx_majors",
                "fx_africa",
                "fx_asia_pacific",
                "fx_europe_americas",
                "fx_cross_rates"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/XPayment"
          },
          {
            "$ref": "#/components/parameters/XPaymentLegacy"
          }
        ],
        "responses": {
          "200": {
            "description": "Official South African Reserve Bank indicators and daily rand exchange rates.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ]
      }
    },
    "/sagent/energy": {
      "get": {
        "operationId": "getEnergy",
        "summary": "Official Eskom grid data.",
        "description": "Live load-shedding stage, hourly demand and forecasts, generation mix, renewables, unplanned outages, with source URL and verification timestamp.",
        "x-price": "0.02 USDC",
        "parameters": [
          {
            "name": "dataset",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "loadshedding",
                "demand",
                "forecast_3_month",
                "generation_mix",
                "renewables",
                "unplanned_outages_hourly"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/XPayment"
          },
          {
            "$ref": "#/components/parameters/XPaymentLegacy"
          }
        ],
        "responses": {
          "200": {
            "description": "Official Eskom grid data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ]
      }
    },
    "/sagent/wage": {
      "get": {
        "operationId": "getWage",
        "summary": "South African National Minimum Wage",
        "description": "Official South African National Minimum Wage (Department of Employment and Labour) \u2014 current and previous hourly rate, effective date, EPWP rate, farm/domestic worker coverage and derived daily/weekly/monthly floors, with source URL and verification timestamp. Optional ?category=nmw|epwp. Cite: SAgent by Haven Aid.",
        "x-price": "0.02 USDC",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "nmw",
                "epwp"
              ]
            },
            "description": "Filter by wage category"
          }
        ],
        "responses": {
          "200": {
            "description": "Official Eskom grid data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ]
      }
    },
    "/sagent/tax": {
      "get": {
        "operationId": "getTax",
        "summary": "SARS personal income tax: brackets, rebates, thresholds and medical credits.",
        "description": "SARS personal income tax: brackets, rebates, thresholds and medical credits.",
        "x-price": "0.02 USDC",
        "responses": {
          "200": {
            "description": "Official Eskom grid data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ]
      }
    },
    "/sagent/holidays": {
      "get": {
        "operationId": "getHolidays",
        "summary": "Official South African public holidays for the current year.",
        "description": "Official South African public holidays for the current year.",
        "x-price": "0.02 USDC",
        "responses": {
          "200": {
            "description": "Official Eskom grid data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "x402": []
          }
        ]
      }
    }
  },
  "components": {
    "parameters": {
      "XPayment": {
        "name": "PAYMENT-SIGNATURE",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string"
        },
        "description": "x402 v2 base64-encoded payment payload (scheme `exact`, network `eip155:8453`, USDC). Legacy v1 clients may send `X-PAYMENT` instead. Omit both to receive the 402 challenge first."
      },
      "XPaymentLegacy": {
        "name": "X-PAYMENT",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string"
        },
        "description": "Legacy x402 v1 base64-encoded payment payload (scheme `exact`, network `base`, USDC)."
      }
    },
    "responses": {
      "PaidAnswer": {
        "description": "Current SASSA payment information (payment settled).",
        "headers": {
          "PAYMENT-RESPONSE": {
            "description": "x402 v2 base64-encoded settlement receipt (transaction hash, payer, amount).",
            "schema": {
              "type": "string"
            }
          },
          "X-PAYMENT-RESPONSE": {
            "description": "Legacy x402 v1 base64-encoded settlement receipt.",
            "schema": {
              "type": "string"
            }
          },
          "X-X402-Version": {
            "description": "Protocol version used to settle this request (1 or 2).",
            "schema": {
              "type": "string"
            }
          },
          "X-Pricing-Tier": {
            "schema": {
              "type": "string"
            }
          },
          "X-Price-USD": {
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AgentAnswer"
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "Payment required, or the supplied payment was invalid / could not be settled.",
        "headers": {
          "PAYMENT-REQUIRED": {
            "description": "x402 v2 base64-encoded PaymentRequired object (x402Version 2, resource, accepts with network `eip155:8453`).",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PaymentChallenge"
            }
          }
        }
      },
      "Error": {
        "description": "Error response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "GrantType": {
        "type": "string",
        "enum": [
          "older_persons",
          "disability",
          "children",
          "foster_child",
          "care_dependency",
          "war_veterans",
          "grant_in_aid"
        ]
      },
      "VerificationStatus": {
        "type": "string",
        "enum": [
          "verified",
          "fresh",
          "stale",
          "unverified",
          "source_unavailable"
        ],
        "description": "verified = confirmed against an official source; fresh = re-checked within 48 hours; stale = not re-verified for more than 7 days; unverified = published but conflicting with another authoritative source; source_unavailable = the official source could not be reached (previous verified data retained)."
      },
      "PaymentChallenge": {
        "type": "object",
        "description": "Legacy x402 v1 challenge body. x402 v2 clients should read the base64 `PAYMENT-REQUIRED` response header instead; the same v2 requirements are also mirrored here under `x402.v2`.",
        "required": [
          "x402Version",
          "accepts"
        ],
        "properties": {
          "x402Version": {
            "type": "integer",
            "const": 1
          },
          "error": {
            "type": "string",
            "description": "payment_required, or the reason the supplied payment was rejected."
          },
          "accepts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "scheme": {
                  "type": "string",
                  "const": "exact"
                },
                "network": {
                  "type": "string",
                  "const": "base"
                },
                "maxAmountRequired": {
                  "type": "string",
                  "description": "Atomic USDC units (6 decimals)."
                },
                "resource": {
                  "type": "string",
                  "format": "uri"
                },
                "description": {
                  "type": "string"
                },
                "mimeType": {
                  "type": "string"
                },
                "payTo": {
                  "type": "string"
                },
                "maxTimeoutSeconds": {
                  "type": "integer"
                },
                "asset": {
                  "type": "string"
                },
                "extra": {
                  "type": "object"
                }
              }
            }
          },
          "x402": {
            "type": "object",
            "description": "Version discovery: supported_versions plus the full x402 v2 requirements (network `eip155:8453`, field `amount`) and the header names for each version."
          },
          "payment": {
            "type": "object",
            "description": "Human/agent-friendly duplicate of the payment terms."
          }
        }
      },
      "Provenance": {
        "type": "object",
        "properties": {
          "originating_authority": {
            "type": "string",
            "const": "South African Social Security Agency (SASSA)"
          },
          "policy": {
            "type": "string"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "PaymentRecord": {
        "type": "object",
        "properties": {
          "grant": {
            "type": "string"
          },
          "grant_type": {
            "$ref": "#/components/schemas/GrantType"
          },
          "payment_date": {
            "type": "string",
            "format": "date"
          },
          "status": {
            "type": "string"
          },
          "verification": {
            "type": "object",
            "properties": {
              "status": {
                "$ref": "#/components/schemas/VerificationStatus"
              },
              "freshness": {
                "type": "string"
              },
              "last_verified_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "source": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      "AgentAnswer": {
        "type": "object",
        "required": [
          "service",
          "resource",
          "country",
          "answer",
          "verification",
          "source",
          "retrieved_at"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "SAgent"
          },
          "resource": {
            "type": "string",
            "const": "sassa"
          },
          "country": {
            "type": "string",
            "const": "ZA"
          },
          "query": {
            "type": "object"
          },
          "answer": {
            "type": "object",
            "properties": {
              "grant": {
                "type": "string"
              },
              "next_payment_date": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "next_payment": {
                "$ref": "#/components/schemas/PaymentRecord"
              },
              "upcoming_payments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PaymentRecord"
                }
              },
              "payment_affecting_announcements": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          },
          "verification": {
            "type": "object"
          },
          "source": {
            "type": "object",
            "properties": {
              "originating_authority": {
                "type": "string"
              },
              "published_by": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              },
              "primary_source_reachable": {
                "type": "boolean"
              },
              "authoritative_sources": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          },
          "provenance": {
            "$ref": "#/components/schemas/Provenance"
          },
          "pricing_tier": {
            "type": "string",
            "enum": [
              "simple",
              "specific",
              "compound",
              "free"
            ]
          },
          "pricing": {
            "type": "object"
          },
          "retrieved_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PaymentDates": {
        "type": "object",
        "properties": {
          "service": {
            "type": "string"
          },
          "endpoint": {
            "type": "string",
            "const": "payment-dates"
          },
          "count": {
            "type": "integer"
          },
          "payment_dates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentRecord"
            }
          },
          "provenance": {
            "$ref": "#/components/schemas/Provenance"
          },
          "retrieved_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Announcements": {
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string",
            "const": "announcements"
          },
          "count": {
            "type": "integer"
          },
          "announcements": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string"
                },
                "summary": {
                  "type": "string"
                },
                "source_name": {
                  "type": "string"
                },
                "source_url": {
                  "type": "string",
                  "format": "uri"
                },
                "published_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "importance": {
                  "type": "string",
                  "enum": [
                    "high",
                    "normal",
                    "low"
                  ]
                },
                "affects_payment_schedule": {
                  "type": "boolean"
                },
                "affected_grant_types": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GrantType"
                  }
                }
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "service": {
            "type": "string"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_grant",
                  "not_found",
                  "rate_limited",
                  "method_not_allowed",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          },
          "retrieved_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "securitySchemes": {
      "x402": {
        "type": "http",
        "scheme": "x402",
        "description": "x402 pay-per-request. Unpaid requests return HTTP 402 with the payment challenge (v2: base64 PAYMENT-REQUIRED header; v1: JSON accepts body). Resubmit the signed payment on PAYMENT-SIGNATURE (v2) or X-PAYMENT (v1)."
      }
    }
  },
  "security": [
    {
      "x402": []
    }
  ]
}