{
  "openapi": "3.1.0",
  "info": {
    "title": "AisleRule API",
    "version": "1.0.0",
    "summary": "Which of your items your state now bars from SNAP, checked by UPC.",
    "description": "AisleRule is for small SNAP-authorized grocers and convenience stores. Upload your item export from any POS; AisleRule matches each item by UPC to USDA FoodData Central, checks it against your state’s SNAP food restriction rule and its start date, and shows a suggestion with its reasons and source for you to confirm. You get a file to import back into your POS (Square’s SNAP Eligible column, or a plain CSV), new items flagged on every later upload, a check against USDA’s staple food stocking standard, emails before each rule starts, and a dated record of every decision. Agents can check one UPC in one state on one date through the API or the MCP server.\n\n## Authentication\nSend an API key as `Authorization: Bearer <key>` (or `X-API-Key`). Keys are created on the account page (https://aislerule.tenhatch.com/app/api-keys). Signed-in browser sessions work too.\n\n## Metering and pricing\nEvery successful `check-upc` call records one `upc_check` usage event. Accounts on a plan use their monthly allowance (Store: 1,000 results, $19/month; 5 stores: 5,000 results, $95/month; 10 stores: 10,000 results, $190/month); accounts on the free tier get 50 results per month. API and agent callers without a plan pay $0.01 per result.\nAgents should send `x-usage-source: agent` so their usage is attributed correctly; it does not change the price.\n\n## Rate limits\nPer key or IP, published in the `X-RateLimit-*` response headers. A 429 carries `Retry-After`.\n\nSupport: support@tenhatch.com. Machine-readable product summary: https://aislerule.tenhatch.com/.well-known/product.json",
    "contact": {
      "name": "AisleRule support",
      "email": "support@tenhatch.com",
      "url": "https://aislerule.tenhatch.com"
    },
    "termsOfService": "https://aislerule.tenhatch.com/legal/terms",
    "x-pricing": {
      "currency": "usd",
      "perResultCents": 1,
      "eventName": "upc_check",
      "freeResultsPerMonth": 50,
      "plans": [
        {
          "planId": "store",
          "name": "Store",
          "monthly": "$19/month",
          "annual": "$190/year",
          "annualPerMonth": "$15.83/month",
          "savingsPercent": 17,
          "savings": "$38",
          "resultsPerMonth": 1000
        },
        {
          "planId": "five",
          "name": "5 stores",
          "monthly": "$95/month",
          "annual": "$950/year",
          "annualPerMonth": "$79.17/month",
          "savingsPercent": 17,
          "savings": "$190",
          "resultsPerMonth": 5000
        },
        {
          "planId": "ten",
          "name": "10 stores",
          "monthly": "$190/month",
          "annual": "$1,900/year",
          "annualPerMonth": "$158.33/month",
          "savingsPercent": 17,
          "savings": "$380",
          "resultsPerMonth": 10000
        }
      ],
      "refundWindowDays": 14
    }
  },
  "servers": [
    {
      "url": "https://aislerule.tenhatch.com",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "tags": [
    {
      "name": "feature",
      "description": "Check one UPC in one state"
    },
    {
      "name": "account",
      "description": "Account, usage and API keys"
    },
    {
      "name": "meta",
      "description": "Documents about the API itself"
    }
  ],
  "paths": {
    "/api/v1/check-upc": {
      "post": {
        "tags": [
          "feature"
        ],
        "operationId": "check-upc",
        "summary": "Check one UPC in one state",
        "description": "Checks one UPC against one US state’s SNAP food restriction rule on a date: it matches the UPC to USDA FoodData Central and answers whether the item is suggested as not SNAP-eligible under that state’s rule, with the reasons, the record used and the rule record (USDA’s words, the state’s own definitions where read, the dates and the links). A rule that starts after the date is not in force; the four vacated states never are. It is a suggestion, not a decision.\n\nInput: A JSON object with the item’s `upc` (8 to 14 digits), the `state` (a two-letter code or name) and optionally the `date` (YYYY-MM-DD, default today) and the item’s `name`.\n\nOutput: A JSON object with `restricted` (true, false, or null when a person must decide), the `suggestion`, a `summary` and the `reasons`, whether the rule is `inForce` on the date and its `nextChange`, the FoodData Central `match`, the state’s `rule` record and a `notice` to show with it.",
        "parameters": [
          {
            "name": "x-usage-source",
            "in": "header",
            "required": false,
            "description": "Set to `agent` when the caller is an AI agent or MCP client.",
            "schema": {
              "type": "string",
              "enum": [
                "agent",
                "api"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FeatureInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The result and how it was metered.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckUpcResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input (see `error.details`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Plan allowance exhausted and pay-as-you-go not available for this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected error; retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-price-per-result-cents": 1,
        "x-usage-event": "upc_check"
      }
    },
    "/api/v1/rule": {
      "get": {
        "tags": [
          "meta"
        ],
        "operationId": "getRule",
        "summary": "Every state’s rule record (free, no key)",
        "description": "Each state’s SNAP food restriction rule as AisleRule read it: start dates, USDA’s words quoted, the state’s own definitions where read, the official links, who must comply and when it was last checked, so an agent can cite it; and the staple food stocking standard. Every check-upc answer carries its state’s record too.",
        "security": [],
        "responses": {
          "200": {
            "description": "The rule records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuleRecords"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/usage": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getUsage",
        "summary": "Current-period usage meter",
        "responses": {
          "200": {
            "description": "Usage this calendar month.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageMeter"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected error; retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/me": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "getAccount",
        "summary": "The calling account, its plan and limits",
        "responses": {
          "200": {
            "description": "Account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected error; retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/keys": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listApiKeys",
        "summary": "List API keys (session only)",
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "Keys without secrets.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiKeySummary"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected error; retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "createApiKey",
        "summary": "Create an API key (session only)",
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new key; the secret is shown once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Key limit for the plan reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected error; retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/keys/{id}": {
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "revokeApiKey",
        "summary": "Revoke an API key (session only)",
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked."
          },
          "401": {
            "description": "Missing or invalid API key / session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such key on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Honour Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected error; retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/openapi.json": {
      "get": {
        "tags": [
          "meta"
        ],
        "operationId": "getOpenApi",
        "summary": "This document",
        "security": [],
        "responses": {
          "200": {
            "description": "OpenAPI 3.1 document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key as a bearer token."
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "session": {
        "type": "apiKey",
        "in": "cookie",
        "name": "session",
        "description": "Browser session of a signed-in user."
      }
    },
    "schemas": {
      "FeatureInput": {
        "type": "object",
        "properties": {
          "upc": {
            "type": "string",
            "minLength": 8,
            "maxLength": 20,
            "description": "The item’s UPC, EAN or GTIN (8 to 14 digits; leading zeros are ignored)."
          },
          "state": {
            "type": "string",
            "minLength": 2,
            "maxLength": 40,
            "description": "The US state the store is in: a two-letter code (\"TX\") or its name (\"Texas\")."
          },
          "date": {
            "description": "The date to check, YYYY-MM-DD (default: today, UTC). A rule is in force from its start date.",
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "name": {
            "description": "The item’s name, used only when FoodData Central has no record for the UPC.",
            "type": "string",
            "maxLength": 300
          }
        },
        "required": [
          "upc",
          "state"
        ],
        "description": "Input of check-upc: one UPC in one state on one date."
      },
      "CheckUpcResponse": {
        "type": "object",
        "properties": {
          "result": {
            "type": "object",
            "properties": {
              "upc": {
                "type": "string"
              },
              "checkDigitOk": {
                "type": "boolean"
              },
              "state": {
                "type": "string"
              },
              "date": {
                "type": "string"
              },
              "restricted": {
                "description": "true: suggested not SNAP-eligible under the state’s rule on the date; false: the rule does not cover it or is not in force; null: a person must decide (see reasons).",
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "suggestion": {
                "type": "string",
                "enum": [
                  "suggest-barred",
                  "suggest-allowed",
                  "needs-you",
                  "not-in-force",
                  "no-rule"
                ]
              },
              "suggestionLabel": {
                "type": "string"
              },
              "summary": {
                "type": "string"
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "inForce": {
                "type": "boolean"
              },
              "nextChange": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "date": {
                        "type": "string"
                      },
                      "suggestion": {
                        "type": "string",
                        "enum": [
                          "suggest-barred",
                          "suggest-allowed",
                          "needs-you",
                          "not-in-force",
                          "no-rule"
                        ]
                      }
                    },
                    "required": [
                      "date",
                      "suggestion"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "match": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "found",
                      "not-found",
                      "unavailable"
                    ]
                  },
                  "fdcId": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "brandOwner": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "category": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "recordDate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "citation": {
                    "type": "string"
                  }
                },
                "required": [
                  "status",
                  "fdcId",
                  "description",
                  "brandOwner",
                  "category",
                  "recordDate",
                  "citation"
                ],
                "additionalProperties": false
              },
              "rule": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "state": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "approved",
                          "vacated"
                        ]
                      },
                      "notYetApproved": {
                        "description": "Set when USDA’s waiver page lists the state’s dates but AisleRule found no USDA approval of its current waiver request; null otherwise.",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "startDates": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "words": {
                              "type": "string"
                            },
                            "from": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "words",
                            "from"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "quote": {
                        "type": "string",
                        "description": "What USDA’s waiver page says the state bars, quoted."
                      },
                      "definitions": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "quotes": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {
                                  "type": "string"
                                }
                              },
                              "source": {
                                "type": "object",
                                "properties": {
                                  "title": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "dated": {
                                    "type": "string"
                                  },
                                  "read": {
                                    "type": "string",
                                    "description": "The date AisleRule read it, YYYY-MM-DD."
                                  }
                                },
                                "required": [
                                  "title",
                                  "url",
                                  "read"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "quotes",
                              "source"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "The state’s own definitions, quoted with their source; null when not read yet."
                      },
                      "sources": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": "string"
                            },
                            "url": {
                              "type": "string"
                            },
                            "dated": {
                              "type": "string"
                            },
                            "read": {
                              "type": "string",
                              "description": "The date AisleRule read it, YYYY-MM-DD."
                            }
                          },
                          "required": [
                            "title",
                            "url",
                            "read"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "whoMustComply": {
                        "type": "string"
                      },
                      "lastChecked": {
                        "type": "string"
                      },
                      "page": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "state",
                      "name",
                      "status",
                      "notYetApproved",
                      "startDates",
                      "items",
                      "quote",
                      "definitions",
                      "sources",
                      "whoMustComply",
                      "lastChecked",
                      "page"
                    ],
                    "additionalProperties": false,
                    "description": "A state’s rule record: dates, official links, exact words, who must comply, last checked."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "definitionsRead": {
                "type": "boolean"
              },
              "notice": {
                "type": "string",
                "description": "Show this with the result."
              }
            },
            "required": [
              "upc",
              "checkDigitOk",
              "state",
              "date",
              "restricted",
              "suggestion",
              "suggestionLabel",
              "summary",
              "reasons",
              "inForce",
              "nextChange",
              "match",
              "rule",
              "definitionsRead",
              "notice"
            ],
            "additionalProperties": false,
            "description": "Result of check-upc."
          },
          "usage": {
            "type": "object",
            "properties": {
              "source": {
                "type": "string",
                "enum": [
                  "human",
                  "agent",
                  "api"
                ],
                "description": "Which door a request came through: human (web app), agent (MCP / agent frameworks), api (plain API calls)."
              },
              "chargedCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "remaining": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Results left in the current period after this call."
              }
            },
            "required": [
              "source",
              "chargedCents",
              "remaining"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "result",
          "usage"
        ],
        "additionalProperties": false,
        "description": "The feature result plus how it was metered."
      },
      "RuleRecords": {
        "type": "object",
        "properties": {
          "rulesVersion": {
            "type": "string"
          },
          "source": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "updated": {
                "type": "string"
              },
              "read": {
                "type": "string"
              }
            },
            "required": [
              "title",
              "url",
              "updated",
              "read"
            ],
            "additionalProperties": false
          },
          "notice": {
            "type": "string"
          },
          "states": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "state": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "approved",
                    "vacated"
                  ]
                },
                "notYetApproved": {
                  "description": "Set when USDA’s waiver page lists the state’s dates but AisleRule found no USDA approval of its current waiver request; null otherwise.",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "startDates": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "items": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "words": {
                        "type": "string"
                      },
                      "from": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "words",
                      "from"
                    ],
                    "additionalProperties": false
                  }
                },
                "quote": {
                  "type": "string",
                  "description": "What USDA’s waiver page says the state bars, quoted."
                },
                "definitions": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "quotes": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "source": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": "string"
                            },
                            "url": {
                              "type": "string"
                            },
                            "dated": {
                              "type": "string"
                            },
                            "read": {
                              "type": "string",
                              "description": "The date AisleRule read it, YYYY-MM-DD."
                            }
                          },
                          "required": [
                            "title",
                            "url",
                            "read"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "quotes",
                        "source"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The state’s own definitions, quoted with their source; null when not read yet."
                },
                "sources": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string"
                      },
                      "dated": {
                        "type": "string"
                      },
                      "read": {
                        "type": "string",
                        "description": "The date AisleRule read it, YYYY-MM-DD."
                      }
                    },
                    "required": [
                      "title",
                      "url",
                      "read"
                    ],
                    "additionalProperties": false
                  }
                },
                "whoMustComply": {
                  "type": "string"
                },
                "lastChecked": {
                  "type": "string"
                },
                "page": {
                  "type": "string"
                }
              },
              "required": [
                "state",
                "name",
                "status",
                "notYetApproved",
                "startDates",
                "items",
                "quote",
                "definitions",
                "sources",
                "whoMustComply",
                "lastChecked",
                "page"
              ],
              "additionalProperties": false,
              "description": "A state’s rule record: dates, official links, exact words, who must comply, last checked."
            }
          },
          "stockingStandard": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "published": {
                "type": "string"
              },
              "effective": {
                "type": "string"
              },
              "implementBy": {
                "type": "string"
              },
              "read": {
                "type": "string"
              },
              "varietiesPerGroup": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "unitsPerVariety": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "perishableGroups": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "quote": {
                "type": "string"
              }
            },
            "required": [
              "title",
              "url",
              "published",
              "effective",
              "implementBy",
              "read",
              "varietiesPerGroup",
              "unitsPerVariety",
              "perishableGroups",
              "quote"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "rulesVersion",
          "source",
          "notice",
          "states",
          "stockingStandard"
        ],
        "additionalProperties": false,
        "description": "Every state’s SNAP food restriction rule record, and the staple food stocking standard."
      },
      "UsageMeter": {
        "type": "object",
        "properties": {
          "used": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "limit": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "remaining": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "exhausted": {
            "type": "boolean"
          },
          "period": {
            "type": "object",
            "properties": {
              "start": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "end": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              }
            },
            "required": [
              "start",
              "end"
            ],
            "additionalProperties": false
          },
          "bySource": {
            "type": "object",
            "properties": {
              "human": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "agent": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "api": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "human",
              "agent",
              "api"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "used",
          "limit",
          "remaining",
          "percent",
          "exhausted",
          "period",
          "bySource"
        ],
        "additionalProperties": false,
        "description": "Results used in the current calendar month (UTC) against the plan limit, split by door."
      },
      "Account": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          },
          "plan": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false,
            "description": "The free tier has id \"free\"."
          },
          "limits": {
            "type": "object",
            "properties": {
              "resultsPerMonth": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "apiKeys": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "seats": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "resultsPerMonth",
              "apiKeys",
              "seats"
            ],
            "additionalProperties": false
          },
          "subscription": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string"
                  },
                  "interval": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "annual"
                    ]
                  },
                  "currentPeriodEnd": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cancelAtPeriodEnd": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "status",
                  "interval",
                  "currentPeriodEnd",
                  "cancelAtPeriodEnd"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "email",
          "plan",
          "limits",
          "subscription"
        ],
        "additionalProperties": false,
        "description": "The calling account."
      },
      "ApiKeySummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string",
            "description": "First characters of the key, for recognising it. The full key is only returned once, on creation."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "lastUsedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "prefix",
          "createdAt",
          "lastUsedAt",
          "revokedAt"
        ],
        "additionalProperties": false,
        "description": "An API key without its secret."
      },
      "CreateApiKeyInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "A label such as \"CI\" or \"Claude Desktop\"."
          }
        },
        "required": [
          "name"
        ],
        "description": "Input for creating an API key."
      },
      "CreateApiKeyResponse": {
        "type": "object",
        "properties": {
          "key": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string"
              },
              "prefix": {
                "type": "string",
                "description": "First characters of the key, for recognising it. The full key is only returned once, on creation."
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "lastUsedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "revokedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "name",
              "prefix",
              "createdAt",
              "lastUsedAt",
              "revokedAt"
            ],
            "additionalProperties": false,
            "description": "An API key without its secret."
          },
          "secret": {
            "type": "string",
            "description": "The full API key. Shown once; store it now."
          }
        },
        "required": [
          "key",
          "secret"
        ],
        "additionalProperties": false,
        "description": "A freshly created API key."
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthorized",
                  "forbidden",
                  "not_found",
                  "invalid_input",
                  "quota_exhausted",
                  "rate_limited",
                  "payment_required",
                  "not_open",
                  "internal"
                ]
              },
              "message": {
                "type": "string"
              },
              "details": {}
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "description": "Error envelope returned with every non-2xx status."
      }
    }
  }
}