{
  "openapi": "3.1.0",
  "info": {
    "title": "BlindTill API",
    "version": "1.0.0",
    "summary": "Blind cash counts for Square drawers.",
    "description": "BlindTill lets your staff count the cash drawer by notes and coins on a phone or tablet, without seeing what Square expects. After they submit, it reads the expected cash from Square and records any shortfall or overage against the person who counted. You see every count, who counted, the difference, a history and a CSV export. It only reads from Square, never changes anything there.\n\n## Authentication\nSend an API key as `Authorization: Bearer <key>` (or `X-API-Key`). Keys are created on the account page (https://blindtill.tenhatch.com/app/api-keys). Signed-in browser sessions work too.\n\n## Metering and pricing\nEvery successful `counts` call records one `count_query` usage event. Accounts on a plan use their monthly allowance (One location: 1,000 results, $12/month; Three locations: 3,000 results, $33/month; Ten locations: 10,000 results, $99/month); accounts on the free tier get 100 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://blindtill.tenhatch.com/.well-known/product.json",
    "contact": {
      "name": "BlindTill support",
      "email": "support@tenhatch.com",
      "url": "https://blindtill.tenhatch.com"
    },
    "termsOfService": "https://blindtill.tenhatch.com/legal/terms",
    "x-pricing": {
      "currency": "usd",
      "perResultCents": 1,
      "eventName": "count_query",
      "freeResultsPerMonth": 100,
      "plans": [
        {
          "planId": "one-location",
          "name": "One location",
          "monthly": "$12/month",
          "annual": "$120/year",
          "annualPerMonth": "$10/month",
          "savingsPercent": 17,
          "savings": "$24",
          "resultsPerMonth": 1000
        },
        {
          "planId": "three-locations",
          "name": "Three locations",
          "monthly": "$33/month",
          "annual": "$330/year",
          "annualPerMonth": "$27.50/month",
          "savingsPercent": 17,
          "savings": "$66",
          "resultsPerMonth": 3000
        },
        {
          "planId": "ten-locations",
          "name": "Ten locations",
          "monthly": "$99/month",
          "annual": "$990/year",
          "annualPerMonth": "$82.50/month",
          "savingsPercent": 17,
          "savings": "$198",
          "resultsPerMonth": 10000
        }
      ],
      "refundWindowDays": 14
    }
  },
  "servers": [
    {
      "url": "https://blindtill.tenhatch.com",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "tags": [
    {
      "name": "feature",
      "description": "Count history"
    },
    {
      "name": "account",
      "description": "Account, usage and API keys"
    },
    {
      "name": "meta",
      "description": "Documents about the API itself"
    }
  ],
  "paths": {
    "/api/v1/counts": {
      "post": {
        "tags": [
          "feature"
        ],
        "operationId": "counts",
        "summary": "Count history",
        "description": "Returns the blind cash counts recorded at the Square locations on your account: which drawer, when, who counted, what they counted by note and coin, the cash Square expected, and the difference (over or short), with totals per person and per location. Read only.\n\nInput: A JSON object, every field optional: `locationId`, `staffId`, `from` and `to` (YYYY-MM-DD, the location's own day), `differencesOnly` (true or false), and `limit` (1 to 1000, default 100).\n\nOutput: A JSON object with `locations` (id, name, currency, time zone), `staff` (id, name), `counts` (newest first; each with its location, drawer, times, who counted, counted, expected, difference, the parts of the expected amount and the notes and coins), `totals` per person and per location, `total` and `truncated`.",
        "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/AnalyzeResponse"
                }
              }
            }
          },
          "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": "count_query"
      }
    },
    "/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": {
          "locationId": {
            "description": "Only this location (an id from `locations`).",
            "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)$"
          },
          "staffId": {
            "description": "Only counts by this person (an id from `staff`).",
            "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)$"
          },
          "from": {
            "description": "Counts made on or after this day.",
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "to": {
            "description": "Counts made on or before this day.",
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "differencesOnly": {
            "description": "Only counts that were over or short.",
            "type": "boolean"
          },
          "limit": {
            "description": "At most this many counts, newest first (default 100).",
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          }
        },
        "description": "Filters for the count history; every field is optional."
      },
      "AnalyzeResponse": {
        "type": "object",
        "properties": {
          "result": {
            "type": "object",
            "properties": {
              "locations": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "timeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "currency",
                    "timeZone"
                  ],
                  "additionalProperties": false
                }
              },
              "staff": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                }
              },
              "counts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "drawer": {
                      "type": "object",
                      "properties": {
                        "squareShiftId": {
                          "type": "string"
                        },
                        "device": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "openedAt": {
                          "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"
                            }
                          ]
                        },
                        "endedAt": {
                          "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": [
                        "squareShiftId",
                        "device",
                        "openedAt",
                        "endedAt"
                      ],
                      "additionalProperties": false
                    },
                    "countedAt": {
                      "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))$"
                    },
                    "day": {
                      "type": "string",
                      "description": "The location's own day of the count."
                    },
                    "countedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "currency": {
                      "type": "string"
                    },
                    "counted": {
                      "type": "object",
                      "properties": {
                        "minor": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "In minor units (cents; whole yen)."
                        },
                        "decimal": {
                          "type": "string",
                          "description": "The same amount as a decimal string, such as \"12.50\"."
                        }
                      },
                      "required": [
                        "minor",
                        "decimal"
                      ],
                      "additionalProperties": false,
                      "description": "An amount in the count's currency."
                    },
                    "expected": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "minor": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "In minor units (cents; whole yen)."
                            },
                            "decimal": {
                              "type": "string",
                              "description": "The same amount as a decimal string, such as \"12.50\"."
                            }
                          },
                          "required": [
                            "minor",
                            "decimal"
                          ],
                          "additionalProperties": false,
                          "description": "An amount in the count's currency."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Square's expected cash for the drawer."
                    },
                    "difference": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "minor": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "In minor units (cents; whole yen)."
                            },
                            "decimal": {
                              "type": "string",
                              "description": "The same amount as a decimal string, such as \"12.50\"."
                            }
                          },
                          "required": [
                            "minor",
                            "decimal"
                          ],
                          "additionalProperties": false,
                          "description": "An amount in the count's currency."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Counted minus expected: above 0 is over, below 0 is short."
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "over",
                        "short",
                        "even",
                        "unknown"
                      ]
                    },
                    "expectedParts": {
                      "type": "object",
                      "properties": {
                        "openedCash": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "minor": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991,
                                  "description": "In minor units (cents; whole yen)."
                                },
                                "decimal": {
                                  "type": "string",
                                  "description": "The same amount as a decimal string, such as \"12.50\"."
                                }
                              },
                              "required": [
                                "minor",
                                "decimal"
                              ],
                              "additionalProperties": false,
                              "description": "An amount in the count's currency."
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "cashPayments": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "minor": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991,
                                  "description": "In minor units (cents; whole yen)."
                                },
                                "decimal": {
                                  "type": "string",
                                  "description": "The same amount as a decimal string, such as \"12.50\"."
                                }
                              },
                              "required": [
                                "minor",
                                "decimal"
                              ],
                              "additionalProperties": false,
                              "description": "An amount in the count's currency."
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "cashRefunds": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "minor": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991,
                                  "description": "In minor units (cents; whole yen)."
                                },
                                "decimal": {
                                  "type": "string",
                                  "description": "The same amount as a decimal string, such as \"12.50\"."
                                }
                              },
                              "required": [
                                "minor",
                                "decimal"
                              ],
                              "additionalProperties": false,
                              "description": "An amount in the count's currency."
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "paidIn": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "minor": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991,
                                  "description": "In minor units (cents; whole yen)."
                                },
                                "decimal": {
                                  "type": "string",
                                  "description": "The same amount as a decimal string, such as \"12.50\"."
                                }
                              },
                              "required": [
                                "minor",
                                "decimal"
                              ],
                              "additionalProperties": false,
                              "description": "An amount in the count's currency."
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "paidOut": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "minor": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991,
                                  "description": "In minor units (cents; whole yen)."
                                },
                                "decimal": {
                                  "type": "string",
                                  "description": "The same amount as a decimal string, such as \"12.50\"."
                                }
                              },
                              "required": [
                                "minor",
                                "decimal"
                              ],
                              "additionalProperties": false,
                              "description": "An amount in the count's currency."
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "openedCash",
                        "cashPayments",
                        "cashRefunds",
                        "paidIn",
                        "paidOut"
                      ],
                      "additionalProperties": false
                    },
                    "squareClosingCount": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "minor": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "In minor units (cents; whole yen)."
                            },
                            "decimal": {
                              "type": "string",
                              "description": "The same amount as a decimal string, such as \"12.50\"."
                            }
                          },
                          "required": [
                            "minor",
                            "decimal"
                          ],
                          "additionalProperties": false,
                          "description": "An amount in the count's currency."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The closing count entered in Square, if any."
                    },
                    "otherCash": {
                      "type": "object",
                      "properties": {
                        "minor": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "In minor units (cents; whole yen)."
                        },
                        "decimal": {
                          "type": "string",
                          "description": "The same amount as a decimal string, such as \"12.50\"."
                        }
                      },
                      "required": [
                        "minor",
                        "decimal"
                      ],
                      "additionalProperties": false,
                      "description": "An amount in the count's currency."
                    },
                    "notesAndCoins": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "location",
                    "drawer",
                    "countedAt",
                    "day",
                    "countedBy",
                    "currency",
                    "counted",
                    "expected",
                    "difference",
                    "outcome",
                    "expectedParts",
                    "squareClosingCount",
                    "otherCash",
                    "notesAndCoins",
                    "note"
                  ],
                  "additionalProperties": false,
                  "description": "One blind count of one Square cash drawer."
                }
              },
              "totals": {
                "type": "object",
                "properties": {
                  "byPerson": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "counts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "over": {
                          "type": "object",
                          "properties": {
                            "minor": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "In minor units (cents; whole yen)."
                            },
                            "decimal": {
                              "type": "string",
                              "description": "The same amount as a decimal string, such as \"12.50\"."
                            }
                          },
                          "required": [
                            "minor",
                            "decimal"
                          ],
                          "additionalProperties": false,
                          "description": "An amount in the count's currency."
                        },
                        "short": {
                          "type": "object",
                          "properties": {
                            "minor": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "In minor units (cents; whole yen)."
                            },
                            "decimal": {
                              "type": "string",
                              "description": "The same amount as a decimal string, such as \"12.50\"."
                            }
                          },
                          "required": [
                            "minor",
                            "decimal"
                          ],
                          "additionalProperties": false,
                          "description": "An amount in the count's currency."
                        },
                        "net": {
                          "type": "object",
                          "properties": {
                            "minor": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "In minor units (cents; whole yen)."
                            },
                            "decimal": {
                              "type": "string",
                              "description": "The same amount as a decimal string, such as \"12.50\"."
                            }
                          },
                          "required": [
                            "minor",
                            "decimal"
                          ],
                          "additionalProperties": false,
                          "description": "An amount in the count's currency."
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "currency",
                        "counts",
                        "over",
                        "short",
                        "net"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "byLocation": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "counts": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "over": {
                          "type": "object",
                          "properties": {
                            "minor": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "In minor units (cents; whole yen)."
                            },
                            "decimal": {
                              "type": "string",
                              "description": "The same amount as a decimal string, such as \"12.50\"."
                            }
                          },
                          "required": [
                            "minor",
                            "decimal"
                          ],
                          "additionalProperties": false,
                          "description": "An amount in the count's currency."
                        },
                        "short": {
                          "type": "object",
                          "properties": {
                            "minor": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "In minor units (cents; whole yen)."
                            },
                            "decimal": {
                              "type": "string",
                              "description": "The same amount as a decimal string, such as \"12.50\"."
                            }
                          },
                          "required": [
                            "minor",
                            "decimal"
                          ],
                          "additionalProperties": false,
                          "description": "An amount in the count's currency."
                        },
                        "net": {
                          "type": "object",
                          "properties": {
                            "minor": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991,
                              "description": "In minor units (cents; whole yen)."
                            },
                            "decimal": {
                              "type": "string",
                              "description": "The same amount as a decimal string, such as \"12.50\"."
                            }
                          },
                          "required": [
                            "minor",
                            "decimal"
                          ],
                          "additionalProperties": false,
                          "description": "An amount in the count's currency."
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "currency",
                        "counts",
                        "over",
                        "short",
                        "net"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "byPerson",
                  "byLocation"
                ],
                "additionalProperties": false
              },
              "total": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "truncated": {
                "type": "boolean"
              }
            },
            "required": [
              "locations",
              "staff",
              "counts",
              "totals",
              "total",
              "truncated"
            ],
            "additionalProperties": false,
            "description": "The count history of the locations on the account, newest first, with totals."
          },
          "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."
      },
      "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
              },
              "locations": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "staff": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "historyDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "resultsPerMonth",
              "apiKeys",
              "seats",
              "locations",
              "staff",
              "historyDays"
            ],
            "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."
      }
    }
  }
}