{
 "openapi": "3.1.0",
 "info": {
  "title": "MicroHom seller import API",
  "version": "1.0.0",
  "description": "Preview and submit a seller’s public inventory to MicroHom, a referral-only micro home marketplace. Every submission is reviewed by a person before anything is published. No payments are taken. Docs: https://microhom.us/sell/agents/"
 },
 "servers": [
  {
   "url": "https://microhom.us"
  }
 ],
 "paths": {
  "/api/import": {
   "post": {
    "operationId": "importInventory",
    "summary": "Preview (default) or submit (submit:true) a seller’s inventory",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "url": {
          "type": "string",
          "format": "uri",
          "description": "Store, collection, product page, sitemap, or CSV/JSON feed (https only)."
         },
         "website": {
          "type": "string",
          "format": "uri",
          "description": "Seller site; required with csv or items."
         },
         "csv": {
          "type": "string",
          "description": "CSV text, header row first, up to 500 rows."
         },
         "items": {
          "type": "array",
          "maxItems": 500,
          "items": {
           "type": "object",
           "required": [
            "title",
            "url"
           ],
           "properties": {
            "title": {
             "type": "string"
            },
            "url": {
             "type": "string"
            },
            "price": {
             "type": "number"
            },
            "currency": {
             "type": "string"
            },
            "image": {
             "type": "string"
            },
            "stock": {
             "type": "string"
            },
            "location": {
             "type": "string"
            },
            "type": {
             "type": "string"
            },
            "sqft": {
             "type": "integer"
            },
            "condition": {
             "type": "string"
            }
           }
          }
         },
         "submit": {
          "type": "boolean",
          "default": false
         },
         "business": {
          "type": "string",
          "maxLength": 80
         },
         "email": {
          "type": "string",
          "format": "email"
         },
         "authorized": {
          "type": "boolean",
          "description": "Must be true to submit: you own or are authorized to list these items."
         },
         "notes": {
          "type": "string",
          "maxLength": 500
         },
         "agent": {
          "type": "string",
          "maxLength": 80,
          "description": "Name of the agent or tool submitting."
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Preview"
     },
     "201": {
      "description": "Submitted for review; returns id, statusKey, statusUrl (JSON) and statusPage (browser link)"
     },
     "400": {
      "description": "Bad input",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "const": false
          },
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "403": {
      "description": "Blocked by robots.txt"
     },
     "422": {
      "description": "Nothing importable, or refused"
     },
     "429": {
      "description": "Rate limited"
     }
    }
   }
  },
  "/api/import/status": {
   "get": {
    "operationId": "importStatus",
    "summary": "Status of a submission",
    "parameters": [
     {
      "name": "id",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "key",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Status"
     },
     "404": {
      "description": "Unknown id or key"
     }
    }
   }
  },
  "/api/listings": {
   "get": {
    "operationId": "listings",
    "summary": "Live inventory feeds",
    "parameters": [
     {
      "name": "feed",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "stores",
        "sellers"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Feed"
     }
    }
   }
  }
 }
}