{
  "openapi": "3.1.1",
  "info": {
    "title": "inSitu Sales REST API — Starter Reference",
    "version": "1.0.0",
    "description": "A verified subset of the existing REST API: web-user authentication and product/customer reads. This is not the complete API catalog and does not define a new service. Schema fields and query parameters are intentionally limited to the reviewed web-user flows. The broader legacy Swagger documentation is linked separately. MCP clients should connect to https://api.insitusales.com/mcp and discover tools through MCP tools/list after OAuth authentication.",
    "license": {
      "name": "Proprietary",
      "identifier": "LicenseRef-Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.insitusales.com/api/v1",
      "description": "Existing production REST API"
    }
  ],
  "externalDocs": {
    "description": "Broader legacy API documentation; not all operations are included in this starter reference.",
    "url": "https://api.insitusales.com/api-docs"
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Authentication",
      "description": "Existing web-user REST authentication."
    },
    {
      "name": "Products",
      "description": "Product reads."
    },
    {
      "name": "Customers",
      "description": "Customer reads."
    }
  ],
  "paths": {
    "/users/company/login": {
      "post": {
        "operationId": "loginWebUser",
        "summary": "Authenticate an existing web user",
        "description": "Returns a bearer token for the existing REST API. This is separate from MCP OAuth. Use only credentials supplied through a secure client sign-in flow.",
        "tags": [
          "Authentication"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authentication succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid login credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/products": {
      "get": {
        "operationId": "listProducts",
        "summary": "List products for the authenticated web user",
        "description": "Documents the web-user flow using the token from /users/company/login. Default visibility and access filters apply. Only offset, limit and order are covered in this starter reference; other supported filters and other user types are outside its scope.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "description": "Number of records to skip. Use a stable order when paging.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum records requested. Set an explicit page size; omission may return an unbounded list.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "example": 50
            }
          },
          {
            "name": "order",
            "in": "query",
            "description": "JSON-encoded array of [field, direction] pairs. URL-encode this query parameter.",
            "schema": {
              "type": "string",
              "example": "[[\"id\",\"ASC\"]]"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Accessible product records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductList"
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Bearer token absent or rejected.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "example": "Unauthorized"
                }
              }
            }
          },
          "default": {
            "description": "Other server or gateway error; inspect the HTTP status and response body."
          }
        }
      }
    },
    "/customers": {
      "get": {
        "operationId": "listCustomers",
        "summary": "List customers for the authenticated web user",
        "description": "Documents the web-user flow using the token from /users/company/login. Default visibility and access filters apply. Only offset, limit and order are covered in this starter reference; other supported filters and other user types are outside its scope.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "description": "Number of records to skip. Use a stable order when paging.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum records requested. Set an explicit page size; omission may return an unbounded list.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "example": 50
            }
          },
          {
            "name": "order",
            "in": "query",
            "description": "JSON-encoded array of [field, direction] pairs. URL-encode this query parameter.",
            "schema": {
              "type": "string",
              "example": "[[\"id\",\"ASC\"]]"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Accessible customer records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerList"
                }
              }
            }
          },
          "400": {
            "description": "Request could not be completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Bearer token absent or rejected.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "example": "Unauthorized"
                }
              }
            }
          },
          "default": {
            "description": "Other server or gateway error; inspect the HTTP status and response body."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Existing REST bearer token from web-user authentication. Do not substitute the separate MCP OAuth flow."
      }
    },
    "schemas": {
      "LoginRequest": {
        "type": "object",
        "required": [
          "email",
          "password"
        ],
        "properties": {
          "email": {
            "type": "string",
            "description": "Web-user login identifier. Despite the field name, this need not be an email address."
          },
          "password": {
            "type": "string",
            "writeOnly": true
          }
        },
        "additionalProperties": false
      },
      "LoginResponse": {
        "type": "object",
        "required": [
          "success",
          "token",
          "user"
        ],
        "properties": {
          "success": {
            "const": true
          },
          "token": {
            "type": "string",
            "description": "Treat as a secret. Send in Authorization: Bearer <token> for REST requests."
          },
          "user": {
            "type": "object",
            "additionalProperties": true,
            "description": "Authenticated web-user profile; fields depend on account configuration."
          }
        },
        "additionalProperties": true
      },
      "Error": {
        "type": "object",
        "required": [
          "success",
          "error"
        ],
        "properties": {
          "success": {
            "const": false
          },
          "error": {
            "description": "Error detail returned by the API; may be text or structured data."
          }
        },
        "additionalProperties": true
      },
      "Product": {
        "type": "object",
        "description": "Selected identifying fields only. Additional account-dependent fields may be returned.",
        "properties": {
          "id": {
            "type": [
              "integer",
              "string"
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": true
      },
      "ProductList": {
        "type": "object",
        "required": [
          "success",
          "products",
          "count"
        ],
        "properties": {
          "success": {
            "const": true
          },
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Product"
            }
          },
          "count": {
            "type": "integer",
            "description": "Number of records returned for the documented web-user flow; not a total across all pages."
          },
          "last_updated_time": {
            "type": [
              "string",
              "null"
            ],
            "description": "Legacy field; do not rely on it for pagination."
          }
        },
        "additionalProperties": true
      },
      "Customer": {
        "type": "object",
        "description": "Selected identifying fields only. Additional account-dependent fields may be returned.",
        "properties": {
          "id": {
            "type": [
              "integer",
              "string"
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": true
      },
      "CustomerList": {
        "type": "object",
        "required": [
          "success",
          "customers",
          "count"
        ],
        "properties": {
          "success": {
            "const": true
          },
          "customers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Customer"
            }
          },
          "count": {
            "type": "integer",
            "description": "Number of records returned for the documented web-user flow; not a total across all pages."
          },
          "last_updated_time": {
            "type": [
              "string",
              "null"
            ],
            "description": "Legacy field; do not rely on it for pagination."
          }
        },
        "additionalProperties": true
      }
    }
  },
  "x-mcp": {
    "url": "https://api.insitusales.com/mcp",
    "transport": "streamable-http",
    "oauthProtectedResourceMetadata": "https://api.insitusales.com/.well-known/oauth-protected-resource",
    "description": "Informational extension only. Use an MCP client and tools/list for the MCP tool catalog."
  }
}
