{
  "openapi": "3.1.0",
  "info": {
    "title": "Northfield Product Data API",
    "version": "1.6",
    "description": "Read-only product search and comparison for the Northfield Goods catalog. Uses the same product records as northfieldbackpacks.com. No sign-in or API key. Send product requirements only, not personal details. Documentation: https://northfieldbackpacks.com/developers"
  },
  "servers": [{ "url": "https://northfieldbackpacks.com" }],
  "paths": {
    "/agent/search": {
      "get": {
        "operationId": "searchProducts",
        "summary": "Find every pack that meets a plain-language description",
        "description": "Interprets the description (budget, laptop size, weather protection, use) and returns all qualifying SKUs, why each catalog SKU did or didn't qualify, and a session_id for follow-up requests.",
        "parameters": [
          { "name": "q", "in": "query", "required": true, "schema": { "type": "string" }, "example": "waterproof commuter backpack for a 15-inch laptop under $120" }
        ],
        "responses": { "200": { "description": "Criteria, eligible_products, eligible_product_table, qualification_audit and session_id", "content": { "application/json": { "schema": { "type": "object" } } } } }
      },
      "post": {
        "operationId": "searchProductsPost",
        "summary": "Same as GET, with the description in a JSON body",
        "requestBody": { "required": true, "content": { "application/json": { "schema": {
          "type": "object",
          "properties": {
            "context": { "type": "string", "minLength": 1, "description": "Product requirements in plain words" },
            "session_id": { "type": "string", "description": "Existing session when refining the same task" },
            "new_context": { "type": "boolean", "description": "Start an independent task" }
          },
          "required": ["context"]
        } } } },
        "responses": { "200": { "description": "Same as GET", "content": { "application/json": { "schema": { "type": "object" } } } } }
      }
    },
    "/agent/table": {
      "get": {
        "operationId": "compareDetails",
        "summary": "Compare further details for the qualifying packs",
        "description": "Ask for details in your own words, comma-separated. Each detail is marked answered, partly answered or not listed per SKU.",
        "parameters": [
          { "name": "session_id", "in": "query", "required": false, "schema": { "type": "string" }, "description": "From searchProducts; needed only when skus is omitted" },
          { "name": "ask", "in": "query", "required": false, "schema": { "type": "string" }, "example": "weight, seam construction" },
          { "name": "skus", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Comma-separated SKUs; defaults to the qualifying packs" },
          { "name": "scope", "in": "query", "required": false, "schema": { "type": "string", "enum": ["eligible", "catalog"] } }
        ],
        "responses": { "200": { "description": "Attribute table", "content": { "application/json": { "schema": { "type": "object" } } } } }
      },
      "post": {
        "operationId": "compareDetailsPost",
        "summary": "Same as GET, with a JSON body",
        "requestBody": { "required": true, "content": { "application/json": { "schema": {
          "type": "object",
          "properties": {
            "session_id": { "type": "string" },
            "attributes": { "type": "array", "items": { "type": "string" }, "description": "Details in your own words" },
            "skus": { "type": "array", "items": { "type": "string" } },
            "scope": { "type": "string", "enum": ["eligible", "catalog"] }
          },
          "anyOf": [{ "required": ["session_id"] }, { "required": ["skus"] }]
        } } } },
        "responses": { "200": { "description": "Attribute table", "content": { "application/json": { "schema": { "type": "object" } } } } }
      }
    },
    "/agent/products": {
      "get": {
        "operationId": "getProduct",
        "summary": "Full catalog record for one SKU",
        "parameters": [
          { "name": "sku", "in": "query", "required": true, "schema": { "type": "string" }, "example": "vector-24" },
          { "name": "session_id", "in": "query", "required": false, "schema": { "type": "string" } }
        ],
        "responses": { "200": { "description": "Product record", "content": { "application/json": { "schema": { "type": "object" } } } } }
      }
    },
    "/agent/follow-ups": {
      "post": {
        "operationId": "askNorthfield",
        "summary": "Send a product question the catalog doesn't answer to Northfield's team",
        "requestBody": { "required": true, "content": { "application/json": { "schema": {
          "type": "object",
          "properties": {
            "session_id": { "type": "string" },
            "type": { "type": "string", "enum": ["product_question"] },
            "request": { "type": "string", "description": "The question in plain words" },
            "product_sku": { "type": "string" },
            "product_skus": { "type": "array", "items": { "type": "string" }, "maxItems": 30 },
            "related_attributes": { "type": "array", "items": { "type": "string" } }
          },
          "required": ["type", "request"]
        } } } },
        "responses": { "202": { "description": "Question recorded; includes a capability_token to check for the answer", "content": { "application/json": { "schema": { "type": "object" } } } } }
      },
      "get": {
        "operationId": "getAnswer",
        "summary": "Check whether Northfield has answered a question",
        "parameters": [ { "name": "capability_token", "in": "query", "required": true, "schema": { "type": "string" } } ],
        "responses": { "200": { "description": "Question status and answer", "content": { "application/json": { "schema": { "type": "object" } } } } }
      }
    }
  }
}
