{
  "openapi": "3.1.0",
  "info": {
    "title": "Canada Medical Device Licences MCP",
    "description": "Is this medical device licensed in Canada? Search Health Canada MDALL and verify licences.\n\nThis specification documents the HTTP x402 pay-per-call routes only (not the MCP /mcp transport). Unpaid calls return HTTP 402. Retry with a PAYMENT-SIGNATURE header (x402 v2, scheme exact, USDC on Base eip155:8453; legacy X-PAYMENT v1 also accepted). A payout address is included only in the live 402 challenge served by the Worker, not in this file. MCP endpoint: https://ca-medical-devices-mcp.donniertf.workers.dev/mcp. Manifest: https://ca-medical-devices-mcp.donniertf.workers.dev/.well-known/x402. Paper/free discovery routes are not billed.",
    "version": "1.2.0",
    "contact": {
      "name": "Donnie Morrison",
      "email": "dmorrisonwebdesign@gmail.com",
      "url": "https://ca-medical-devices-mcp.donniertf.workers.dev/"
    },
    "license": {
      "name": "See product landing page and source licences"
    },
    "x-guidance": "Use the paid HTTP routes documented in paths (POST JSON, or GET with query args). Unpaid calls return HTTP 402; retry with a PAYMENT-SIGNATURE header (x402 v2, USDC on Base; legacy X-PAYMENT v1 also accepted). The MCP transport is at /mcp. Is this medical device licensed in Canada? Search Health Canada MDALL and verify licences."
  },
  "servers": [
    {
      "url": "https://ca-medical-devices-mcp.donniertf.workers.dev",
      "description": "Canada Medical Device Licences MCP origin"
    }
  ],
  "tags": [
    {
      "name": "x402",
      "description": "USDC on Base pay-per-call routes"
    }
  ],
  "paths": {
    "/x402/device_search": {
      "post": {
        "summary": "PAID (x402). $0.05 USDC per call. Also free via /mcp (5 free calls/day per IP). Find Health Canada-licensed medical devices by trade name — licence number (`licence_no`), first licensed, licence end date (`licence_end_date`), and `active` (derived from the end date: no end date, or an end date today or later, means active). Top 5, sorted active first, then by match quality (`exact`, `prefix`, `partial`), then latest end date. Optional `active_only` (boolean, default false) returns only active licences. Counts: `found`, `active`, and `shown`. Each row includes `match_type`. Name searches can match the wrong device; when matches are not exact or come from several licences or companies, a top-level `warning` advises confirming with licence_detail using `licence_no`. Results include `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits).",
        "description": "PAID (x402). $0.05 USDC per call. Also free via /mcp (5 free calls/day per IP). Find Health Canada-licensed medical devices by trade name — licence number (`licence_no`), first licensed, licence end date (`licence_end_date`), and `active` (derived from the end date: no end date, or an end date today or later, means active). Top 5, sorted active first, then by match quality (`exact`, `prefix`, `partial`), then latest end date. Optional `active_only` (boolean, default false) returns only active licences. Counts: `found`, `active`, and `shown`. Each row includes `match_type`. Name searches can match the wrong device; when matches are not exact or come from several licences or companies, a top-level `warning` advises confirming with licence_detail using `licence_no`. Results include `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits).",
        "operationId": "post_x402_device_search",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.050000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Paid request succeeded; JSON result of the tool or pack, including retrieved_at, licence_no, licence_end_date and (for name searches) match_type.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "retrieved_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC timestamp for this result. Compare with source_updated_at when the payload was served from cache."
                    },
                    "source_updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC time the upstream Health Canada data was fetched. Included whenever known, including cache hits, so retrieved_at is honest."
                    },
                    "cache_hit": {
                      "type": "boolean",
                      "description": "True when one or more upstream payloads were served from cache."
                    },
                    "name": {
                      "type": "string"
                    },
                    "found": {
                      "type": "integer",
                      "description": "Total matching devices from Health Canada, before the active_only filter and result cap."
                    },
                    "active": {
                      "type": "integer",
                      "description": "Count of matching devices whose licence is active, before the result cap."
                    },
                    "top_5": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "original_licence_no": {
                            "type": [
                              "integer",
                              "number",
                              "null"
                            ]
                          },
                          "device_id": {
                            "type": [
                              "integer",
                              "number",
                              "null"
                            ]
                          },
                          "first_licence_dt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "end_date": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "trade_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "licence_no": {
                            "type": [
                              "string",
                              "number",
                              "null"
                            ],
                            "description": "Health Canada original licence number."
                          },
                          "licence_end_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Licence end date (YYYY-MM-DD), or null if none."
                          },
                          "active": {
                            "type": "boolean",
                            "description": "Derived from the end date: no end date, or an end date today or later, means active."
                          },
                          "match_type": {
                            "type": "string",
                            "enum": [
                              "exact",
                              "prefix",
                              "partial"
                            ],
                            "description": "How the trade name matched the query. Name searches can match the wrong device."
                          }
                        }
                      }
                    },
                    "warning": {
                      "type": "string",
                      "description": "Present when matches are not exact or come from several licences or companies. Confirm with licence_detail using licence_no."
                    },
                    "pro": {
                      "type": "string"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "shown": {
                      "type": "integer",
                      "description": "Number of rows actually returned in this result (after sorting, optional active_only filter, and the top-5 or 200 cap)."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing required fields. Validated before any payment challenge; the request is not billed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "missing_required_fields"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. Retry with a PAYMENT-SIGNATURE header (x402 v2, exact scheme, USDC on Base eip155:8453; legacy X-PAYMENT v1 also accepted). The 402 body/header lists price and terms; payout address is only in the live 402 challenge, not in this spec."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "active_only": {
                    "type": "boolean",
                    "description": "If true, only active licences are returned. Default false."
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      },
      "get": {
        "summary": "PAID (x402). $0.05 USDC per call. Also free via /mcp (5 free calls/day per IP). Find Health Canada-licensed medical devices by trade name — licence number (`licence_no`), first licensed, licence end date (`licence_end_date`), and `active` (derived from the end date: no end date, or an end date today or later, means active). Top 5, sorted active first, then by match quality (`exact`, `prefix`, `partial`), then latest end date. Optional `active_only` (boolean, default false) returns only active licences. Counts: `found`, `active`, and `shown`. Each row includes `match_type`. Name searches can match the wrong device; when matches are not exact or come from several licences or companies, a top-level `warning` advises confirming with licence_detail using `licence_no`. Results include `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits). (query or 402 probe)",
        "description": "PAID (x402). $0.05 USDC per call. Also free via /mcp (5 free calls/day per IP). Find Health Canada-licensed medical devices by trade name — licence number (`licence_no`), first licensed, licence end date (`licence_end_date`), and `active` (derived from the end date: no end date, or an end date today or later, means active). Top 5, sorted active first, then by match quality (`exact`, `prefix`, `partial`), then latest end date. Optional `active_only` (boolean, default false) returns only active licences. Counts: `found`, `active`, and `shown`. Each row includes `match_type`. Name searches can match the wrong device; when matches are not exact or come from several licences or companies, a top-level `warning` advises confirming with licence_detail using `licence_no`. Results include `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits). Accepts query args; unpaid calls return 402 after required fields are present.",
        "operationId": "get_x402_device_search",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.050000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Paid request succeeded; JSON result of the tool or pack, including retrieved_at, licence_no, licence_end_date and (for name searches) match_type.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "retrieved_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC timestamp for this result. Compare with source_updated_at when the payload was served from cache."
                    },
                    "source_updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC time the upstream Health Canada data was fetched. Included whenever known, including cache hits, so retrieved_at is honest."
                    },
                    "cache_hit": {
                      "type": "boolean",
                      "description": "True when one or more upstream payloads were served from cache."
                    },
                    "name": {
                      "type": "string"
                    },
                    "found": {
                      "type": "integer",
                      "description": "Total matching devices from Health Canada, before the active_only filter and result cap."
                    },
                    "active": {
                      "type": "integer",
                      "description": "Count of matching devices whose licence is active, before the result cap."
                    },
                    "top_5": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "original_licence_no": {
                            "type": [
                              "integer",
                              "number",
                              "null"
                            ]
                          },
                          "device_id": {
                            "type": [
                              "integer",
                              "number",
                              "null"
                            ]
                          },
                          "first_licence_dt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "end_date": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "trade_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "licence_no": {
                            "type": [
                              "string",
                              "number",
                              "null"
                            ],
                            "description": "Health Canada original licence number."
                          },
                          "licence_end_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Licence end date (YYYY-MM-DD), or null if none."
                          },
                          "active": {
                            "type": "boolean",
                            "description": "Derived from the end date: no end date, or an end date today or later, means active."
                          },
                          "match_type": {
                            "type": "string",
                            "enum": [
                              "exact",
                              "prefix",
                              "partial"
                            ],
                            "description": "How the trade name matched the query. Name searches can match the wrong device."
                          }
                        }
                      }
                    },
                    "warning": {
                      "type": "string",
                      "description": "Present when matches are not exact or come from several licences or companies. Confirm with licence_detail using licence_no."
                    },
                    "pro": {
                      "type": "string"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "shown": {
                      "type": "integer",
                      "description": "Number of rows actually returned in this result (after sorting, optional active_only filter, and the top-5 or 200 cap)."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing required fields. Validated before any payment challenge; the request is not billed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "missing_required_fields"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. Retry with a PAYMENT-SIGNATURE header (x402 v2, exact scheme, USDC on Base eip155:8453; legacy X-PAYMENT v1 also accepted). The 402 body/header lists price and terms; payout address is only in the live 402 challenge, not in this spec."
          }
        },
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "active_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "If true, only active licences are returned. Default false."
          }
        ]
      }
    },
    "/x402/licence_detail": {
      "post": {
        "summary": "PRO. Licence details for an original licence number: name, device class, licence type and company. Each result includes `licence_no`, `licence_end_date` (null if none), and `active` (derived from the end date: no end date, or an end date today or later, means active). Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits).",
        "description": "PRO. Licence details for an original licence number: name, device class, licence type and company. Each result includes `licence_no`, `licence_end_date` (null if none), and `active` (derived from the end date: no end date, or an end date today or later, means active). Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits).",
        "operationId": "post_x402_licence_detail",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.050000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Paid request succeeded; JSON result of the tool or pack, including retrieved_at, licence_no, licence_end_date and (for name searches) match_type.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "retrieved_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC timestamp for this result. Compare with source_updated_at when the payload was served from cache."
                    },
                    "source_updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC time the upstream Health Canada data was fetched. Included whenever known, including cache hits, so retrieved_at is honest."
                    },
                    "cache_hit": {
                      "type": "boolean",
                      "description": "True when one or more upstream payloads were served from cache."
                    },
                    "licence_no": {
                      "type": [
                        "string",
                        "number",
                        "null"
                      ],
                      "description": "Health Canada original licence number."
                    },
                    "licence_end_date": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Licence end date (YYYY-MM-DD), or null if none."
                    },
                    "active": {
                      "type": "boolean",
                      "description": "Derived from the end date: no end date, or an end date today or later, means active."
                    },
                    "licence": {
                      "type": "object",
                      "description": "Health Canada licence record, also annotated with licence_no, licence_end_date and active."
                    },
                    "company": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Health Canada company record for the licence, when available."
                    },
                    "disclaimer": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing required fields. Validated before any payment challenge; the request is not billed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "missing_required_fields"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. Retry with a PAYMENT-SIGNATURE header (x402 v2, exact scheme, USDC on Base eip155:8453; legacy X-PAYMENT v1 also accepted). The 402 body/header lists price and terms; payout address is only in the live 402 challenge, not in this spec."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "licence_no": {
                    "type": "string"
                  }
                },
                "required": [
                  "licence_no"
                ]
              }
            }
          }
        }
      },
      "get": {
        "summary": "PRO. Licence details for an original licence number: name, device class, licence type and company. Each result includes `licence_no`, `licence_end_date` (null if none), and `active` (derived from the end date: no end date, or an end date today or later, means active). Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits). (query or 402 probe)",
        "description": "PRO. Licence details for an original licence number: name, device class, licence type and company. Each result includes `licence_no`, `licence_end_date` (null if none), and `active` (derived from the end date: no end date, or an end date today or later, means active). Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits). Accepts query args; unpaid calls return 402 after required fields are present.",
        "operationId": "get_x402_licence_detail",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.050000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Paid request succeeded; JSON result of the tool or pack, including retrieved_at, licence_no, licence_end_date and (for name searches) match_type.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "retrieved_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC timestamp for this result. Compare with source_updated_at when the payload was served from cache."
                    },
                    "source_updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC time the upstream Health Canada data was fetched. Included whenever known, including cache hits, so retrieved_at is honest."
                    },
                    "cache_hit": {
                      "type": "boolean",
                      "description": "True when one or more upstream payloads were served from cache."
                    },
                    "licence_no": {
                      "type": [
                        "string",
                        "number",
                        "null"
                      ],
                      "description": "Health Canada original licence number."
                    },
                    "licence_end_date": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Licence end date (YYYY-MM-DD), or null if none."
                    },
                    "active": {
                      "type": "boolean",
                      "description": "Derived from the end date: no end date, or an end date today or later, means active."
                    },
                    "licence": {
                      "type": "object",
                      "description": "Health Canada licence record, also annotated with licence_no, licence_end_date and active."
                    },
                    "company": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "Health Canada company record for the licence, when available."
                    },
                    "disclaimer": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing required fields. Validated before any payment challenge; the request is not billed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "missing_required_fields"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. Retry with a PAYMENT-SIGNATURE header (x402 v2, exact scheme, USDC on Base eip155:8453; legacy X-PAYMENT v1 also accepted). The 402 body/header lists price and terms; payout address is only in the live 402 challenge, not in this spec."
          }
        },
        "parameters": [
          {
            "name": "licence_no",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/x402/device_search_full": {
      "post": {
        "summary": "PRO. All licensed devices matching a trade name (up to 200), with `licence_no`, `licence_end_date`, and `active` (derived from the end date: no end date, or an end date today or later, means active). Sorted active first, then by match quality (`exact`, `prefix`, `partial`), then latest end date. Optional `active_only` (boolean, default false) returns only active licences. Counts: `found`, `active`, and `shown`. Each row includes `match_type`. Name searches can match the wrong device; when matches are not exact or come from several licences or companies, a top-level `warning` advises confirming with licence_detail using `licence_no`. Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits).",
        "description": "PRO. All licensed devices matching a trade name (up to 200), with `licence_no`, `licence_end_date`, and `active` (derived from the end date: no end date, or an end date today or later, means active). Sorted active first, then by match quality (`exact`, `prefix`, `partial`), then latest end date. Optional `active_only` (boolean, default false) returns only active licences. Counts: `found`, `active`, and `shown`. Each row includes `match_type`. Name searches can match the wrong device; when matches are not exact or come from several licences or companies, a top-level `warning` advises confirming with licence_detail using `licence_no`. Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits).",
        "operationId": "post_x402_device_search_full",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.050000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Paid request succeeded; JSON result of the tool or pack, including retrieved_at, licence_no, licence_end_date and (for name searches) match_type.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "retrieved_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC timestamp for this result. Compare with source_updated_at when the payload was served from cache."
                    },
                    "source_updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC time the upstream Health Canada data was fetched. Included whenever known, including cache hits, so retrieved_at is honest."
                    },
                    "cache_hit": {
                      "type": "boolean",
                      "description": "True when one or more upstream payloads were served from cache."
                    },
                    "name": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "devices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "original_licence_no": {
                            "type": [
                              "integer",
                              "number",
                              "null"
                            ]
                          },
                          "device_id": {
                            "type": [
                              "integer",
                              "number",
                              "null"
                            ]
                          },
                          "first_licence_dt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "end_date": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "trade_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "licence_no": {
                            "type": [
                              "string",
                              "number",
                              "null"
                            ],
                            "description": "Health Canada original licence number."
                          },
                          "licence_end_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Licence end date (YYYY-MM-DD), or null if none."
                          },
                          "active": {
                            "type": "boolean",
                            "description": "Derived from the end date: no end date, or an end date today or later, means active."
                          },
                          "match_type": {
                            "type": "string",
                            "enum": [
                              "exact",
                              "prefix",
                              "partial"
                            ],
                            "description": "How the trade name matched the query. Name searches can match the wrong device."
                          }
                        }
                      }
                    },
                    "warning": {
                      "type": "string",
                      "description": "Present when matches are not exact or come from several licences or companies. Confirm with licence_detail using licence_no."
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "found": {
                      "type": "integer",
                      "description": "Total matching devices from Health Canada, before the active_only filter and result cap."
                    },
                    "active": {
                      "type": "integer",
                      "description": "Count of matching devices whose licence is active, before the result cap."
                    },
                    "shown": {
                      "type": "integer",
                      "description": "Number of rows actually returned in this result (after sorting, optional active_only filter, and the top-5 or 200 cap)."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing required fields. Validated before any payment challenge; the request is not billed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "missing_required_fields"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. Retry with a PAYMENT-SIGNATURE header (x402 v2, exact scheme, USDC on Base eip155:8453; legacy X-PAYMENT v1 also accepted). The 402 body/header lists price and terms; payout address is only in the live 402 challenge, not in this spec."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "active_only": {
                    "type": "boolean",
                    "description": "If true, only active licences are returned. Default false."
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        }
      },
      "get": {
        "summary": "PRO. All licensed devices matching a trade name (up to 200), with `licence_no`, `licence_end_date`, and `active` (derived from the end date: no end date, or an end date today or later, means active). Sorted active first, then by match quality (`exact`, `prefix`, `partial`), then latest end date. Optional `active_only` (boolean, default false) returns only active licences. Counts: `found`, `active`, and `shown`. Each row includes `match_type`. Name searches can match the wrong device; when matches are not exact or come from several licences or companies, a top-level `warning` advises confirming with licence_detail using `licence_no`. Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits). (query or 402 probe)",
        "description": "PRO. All licensed devices matching a trade name (up to 200), with `licence_no`, `licence_end_date`, and `active` (derived from the end date: no end date, or an end date today or later, means active). Sorted active first, then by match quality (`exact`, `prefix`, `partial`), then latest end date. Optional `active_only` (boolean, default false) returns only active licences. Counts: `found`, `active`, and `shown`. Each row includes `match_type`. Name searches can match the wrong device; when matches are not exact or come from several licences or companies, a top-level `warning` advises confirming with licence_detail using `licence_no`. Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits). Accepts query args; unpaid calls return 402 after required fields are present.",
        "operationId": "get_x402_device_search_full",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.050000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Paid request succeeded; JSON result of the tool or pack, including retrieved_at, licence_no, licence_end_date and (for name searches) match_type.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "retrieved_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC timestamp for this result. Compare with source_updated_at when the payload was served from cache."
                    },
                    "source_updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC time the upstream Health Canada data was fetched. Included whenever known, including cache hits, so retrieved_at is honest."
                    },
                    "cache_hit": {
                      "type": "boolean",
                      "description": "True when one or more upstream payloads were served from cache."
                    },
                    "name": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "devices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "original_licence_no": {
                            "type": [
                              "integer",
                              "number",
                              "null"
                            ]
                          },
                          "device_id": {
                            "type": [
                              "integer",
                              "number",
                              "null"
                            ]
                          },
                          "first_licence_dt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "end_date": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "trade_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "licence_no": {
                            "type": [
                              "string",
                              "number",
                              "null"
                            ],
                            "description": "Health Canada original licence number."
                          },
                          "licence_end_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Licence end date (YYYY-MM-DD), or null if none."
                          },
                          "active": {
                            "type": "boolean",
                            "description": "Derived from the end date: no end date, or an end date today or later, means active."
                          },
                          "match_type": {
                            "type": "string",
                            "enum": [
                              "exact",
                              "prefix",
                              "partial"
                            ],
                            "description": "How the trade name matched the query. Name searches can match the wrong device."
                          }
                        }
                      }
                    },
                    "warning": {
                      "type": "string",
                      "description": "Present when matches are not exact or come from several licences or companies. Confirm with licence_detail using licence_no."
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "found": {
                      "type": "integer",
                      "description": "Total matching devices from Health Canada, before the active_only filter and result cap."
                    },
                    "active": {
                      "type": "integer",
                      "description": "Count of matching devices whose licence is active, before the result cap."
                    },
                    "shown": {
                      "type": "integer",
                      "description": "Number of rows actually returned in this result (after sorting, optional active_only filter, and the top-5 or 200 cap)."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing required fields. Validated before any payment challenge; the request is not billed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "missing_required_fields"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. Retry with a PAYMENT-SIGNATURE header (x402 v2, exact scheme, USDC on Base eip155:8453; legacy X-PAYMENT v1 also accepted). The 402 body/header lists price and terms; payout address is only in the live 402 challenge, not in this spec."
          }
        },
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "active_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "If true, only active licences are returned. Default false."
          }
        ]
      }
    },
    "/x402/batch_licence_check": {
      "post": {
        "summary": "PRO. Check up to 50 licence numbers for current validity. Each result includes `licence_no`, `licence_end_date` (null if none), and `active` (derived from the end date: no end date, or an end date today or later, means active). Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits).",
        "description": "PRO. Check up to 50 licence numbers for current validity. Each result includes `licence_no`, `licence_end_date` (null if none), and `active` (derived from the end date: no end date, or an end date today or later, means active). Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits).",
        "operationId": "post_x402_batch_licence_check",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.050000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Paid request succeeded; JSON result of the tool or pack, including retrieved_at, licence_no, licence_end_date and (for name searches) match_type.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "retrieved_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC timestamp for this result. Compare with source_updated_at when the payload was served from cache."
                    },
                    "source_updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC time the upstream Health Canada data was fetched. Included whenever known, including cache hits, so retrieved_at is honest."
                    },
                    "cache_hit": {
                      "type": "boolean",
                      "description": "True when one or more upstream payloads were served from cache."
                    },
                    "checked": {
                      "type": "integer"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "licence_no": {
                            "type": [
                              "string",
                              "number",
                              "null"
                            ],
                            "description": "Health Canada original licence number."
                          },
                          "licence_end_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Licence end date (YYYY-MM-DD), or null if none."
                          },
                          "active": {
                            "type": "boolean",
                            "description": "Derived from the end date: no end date, or an end date today or later, means active."
                          },
                          "licence": {
                            "type": "object"
                          },
                          "error": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "disclaimer": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing required fields. Validated before any payment challenge; the request is not billed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "missing_required_fields"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. Retry with a PAYMENT-SIGNATURE header (x402 v2, exact scheme, USDC on Base eip155:8453; legacy X-PAYMENT v1 also accepted). The 402 body/header lists price and terms; payout address is only in the live 402 challenge, not in this spec."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "licences": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "licences"
                ]
              }
            }
          }
        }
      },
      "get": {
        "summary": "PRO. Check up to 50 licence numbers for current validity. Each result includes `licence_no`, `licence_end_date` (null if none), and `active` (derived from the end date: no end date, or an end date today or later, means active). Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits). (query or 402 probe)",
        "description": "PRO. Check up to 50 licence numbers for current validity. Each result includes `licence_no`, `licence_end_date` (null if none), and `active` (derived from the end date: no end date, or an end date today or later, means active). Includes `retrieved_at` (ISO 8601 UTC) and `source_updated_at` (when the upstream Health Canada data was fetched, including cache hits). Accepts query args; unpaid calls return 402 after required fields are present.",
        "operationId": "get_x402_batch_licence_check",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.050000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Paid request succeeded; JSON result of the tool or pack, including retrieved_at, licence_no, licence_end_date and (for name searches) match_type.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "retrieved_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC timestamp for this result. Compare with source_updated_at when the payload was served from cache."
                    },
                    "source_updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "ISO 8601 UTC time the upstream Health Canada data was fetched. Included whenever known, including cache hits, so retrieved_at is honest."
                    },
                    "cache_hit": {
                      "type": "boolean",
                      "description": "True when one or more upstream payloads were served from cache."
                    },
                    "checked": {
                      "type": "integer"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "licence_no": {
                            "type": [
                              "string",
                              "number",
                              "null"
                            ],
                            "description": "Health Canada original licence number."
                          },
                          "licence_end_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Licence end date (YYYY-MM-DD), or null if none."
                          },
                          "active": {
                            "type": "boolean",
                            "description": "Derived from the end date: no end date, or an end date today or later, means active."
                          },
                          "licence": {
                            "type": "object"
                          },
                          "error": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "disclaimer": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing required fields. Validated before any payment challenge; the request is not billed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "missing_required_fields"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. Retry with a PAYMENT-SIGNATURE header (x402 v2, exact scheme, USDC on Base eip155:8453; legacy X-PAYMENT v1 also accepted). The 402 body/header lists price and terms; payout address is only in the live 402 challenge, not in this spec."
          }
        },
        "parameters": [
          {
            "name": "licences",
            "in": "query",
            "required": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ]
      }
    }
  }
}