{
  "openapi": "3.1.0",
  "info": {
    "title": "Current — Canadian KYB & Registry API",
    "version": "1.0.0",
    "summary": "Public endpoints for searching Canadian businesses and buying official corporate profile and PPSA (lien) reports.",
    "description": "Current is a Canadian Know-Your-Business (KYB) platform. These public endpoints let humans and AI agents look up registered Canadian businesses and purchase official reports without an account. Payment is handled by Stripe Checkout. See https://getcurrent.ca/agents.txt for agent guidance and https://getcurrent.ca/llms.txt for a site overview.",
    "contact": {
      "name": "Current Future Labs Inc.",
      "email": "contact@getcurrent.ca",
      "url": "https://getcurrent.ca"
    },
    "termsOfService": "https://getcurrent.ca/terms"
  },
  "servers": [
    { "url": "https://getcurrent.ca", "description": "Production" }
  ],
  "externalDocs": {
    "description": "Agent instructions (agents.txt)",
    "url": "https://getcurrent.ca/agents.txt"
  },
  "tags": [
    { "name": "Search", "description": "Look up Canadian businesses across federal and provincial registries." },
    { "name": "Checkout", "description": "Create a Stripe Checkout session to buy a report." }
  ],
  "paths": {
    "/api/corporate-search": {
      "get": {
        "operationId": "searchCanadianBusiness",
        "tags": ["Search"],
        "summary": "Search Canadian businesses by name",
        "description": "Searches federal and provincial Canadian business registries by name and returns matching entities with their registration number and jurisdiction. No authentication required.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Business name to search for. Must be at least 2 characters.",
            "schema": { "type": "string", "minLength": 2 },
            "example": "Shopify"
          }
        ],
        "responses": {
          "200": {
            "description": "Matching businesses (may be an empty list).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/BusinessResult" }
                    }
                  },
                  "required": ["results"]
                }
              }
            }
          }
        }
      }
    },
    "/api/checkout": {
      "post": {
        "operationId": "orderCorporateProfileReport",
        "tags": ["Checkout"],
        "summary": "Buy a corporate profile report (CA$30)",
        "description": "Creates a Stripe Checkout session for an official Canadian corporate profile report. The PDF is emailed to the buyer after payment succeeds, usually within minutes. Direct the user to the returned `url` to pay.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CorporateCheckoutRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Checkout session created.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CheckoutResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid or missing fields.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
          }
        }
      }
    },
    "/api/ppsa-checkout": {
      "post": {
        "operationId": "orderPpsaSearch",
        "tags": ["Checkout"],
        "summary": "Buy a PPSA (lien) search (CA$40)",
        "description": "Creates a Stripe Checkout session for an official Personal Property Security Act (PPSA) lien search against a business debtor (or Quebec's RDPRM). The report is emailed after payment, typically within one business day. There is no federal PPSA registry — pick a province or territory.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/PpsaCheckoutRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Checkout session created.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CheckoutResponse" }
              }
            }
          },
          "400": {
            "description": "Invalid or missing fields.",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BusinessResult": {
        "type": "object",
        "properties": {
          "name": { "type": "string", "example": "ACME CORPORATION INC." },
          "registrationNumber": { "type": "string", "example": "1234567" },
          "jurisdiction": { "$ref": "#/components/schemas/Jurisdiction" },
          "status": { "type": "string", "example": "Active" },
          "city": { "type": "string", "example": "Toronto" },
          "province": { "type": "string", "description": "Registered-office province or territory name (full name, not a jurisdiction code). Use `jurisdiction` for checkout requests.", "example": "Ontario" }
        },
        "required": ["name", "registrationNumber", "jurisdiction"]
      },
      "CorporateCheckoutRequest": {
        "type": "object",
        "properties": {
          "businessName": { "type": "string", "example": "ACME CORPORATION INC." },
          "registrationNumber": {
            "type": "string",
            "description": "The registry number (NOT the 9-digit CRA Business Number). Leading/trailing spaces are trimmed.",
            "example": "1234567"
          },
          "jurisdiction": { "$ref": "#/components/schemas/Jurisdiction" },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Where the report PDF is delivered. Use an address the user controls.",
            "example": "buyer@example.com"
          }
        },
        "required": ["businessName", "registrationNumber", "jurisdiction", "email"]
      },
      "PpsaCheckoutRequest": {
        "type": "object",
        "properties": {
          "businessName": {
            "type": "string",
            "description": "The debtor's legal name (2–150 characters).",
            "minLength": 2,
            "maxLength": 150,
            "example": "ACME CORPORATION INC."
          },
          "jurisdiction": { "$ref": "#/components/schemas/PpsaJurisdiction" },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Where the report is delivered. Use an address the user controls.",
            "example": "buyer@example.com"
          }
        },
        "required": ["businessName", "jurisdiction", "email"]
      },
      "CheckoutResponse": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Stripe Checkout URL. Direct the user here to complete payment.",
            "example": "https://checkout.stripe.com/c/pay/cs_test_..."
          }
        },
        "required": ["url"]
      },
      "Error": {
        "type": "object",
        "properties": { "error": { "type": "string" } },
        "required": ["error"]
      },
      "Jurisdiction": {
        "type": "string",
        "description": "Canadian jurisdiction code.",
        "enum": ["FED", "AB", "BC", "MB", "NB", "NL", "NT", "NS", "NU", "ON", "PE", "QC", "SK", "YT"]
      },
      "PpsaJurisdiction": {
        "type": "string",
        "description": "PPSA jurisdiction code (no federal registry; QC is the RDPRM).",
        "enum": ["AB", "BC", "MB", "NB", "NL", "NT", "NS", "NU", "ON", "PE", "QC", "SK", "YT"]
      }
    }
  }
}
