{
  "openapi": "3.0.1",
  "info": {
    "title": "Staples Canada Store Stock & Clearance Tracker",
    "description": "Staples Canada in-store stock near a postal code: one row per product and store with the live unit count, distance, regular and sale price, discount and clearance flag. Look up SKUs or product links, or list clearance, sale, search or category items; track restocks and price drops.",
    "version": "0.3",
    "x-build-id": "WZiSuhePNUF0LQYGT"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/automatic~staples-ca-store-stock/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-automatic-staples-ca-store-stock",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/automatic~staples-ca-store-stock/runs": {
      "post": {
        "operationId": "runs-sync-automatic-staples-ca-store-stock",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/automatic~staples-ca-store-stock/run-sync": {
      "post": {
        "operationId": "run-sync-automatic-staples-ca-store-stock",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "postalCode": {
            "title": "Postal code",
            "type": "string",
            "description": "Canadian postal code to search around, for example M5V 3L9. Stores are ranked by distance from it. Leave empty only when you give latitude and longitude.",
            "default": "M5V 3L9"
          },
          "latitude": {
            "title": "Latitude",
            "type": "number",
            "description": "Optional. Search around this exact point instead of the postal code area. Give it together with longitude."
          },
          "longitude": {
            "title": "Longitude",
            "type": "number",
            "description": "Optional. Search around this exact point instead of the postal code area. Give it together with latitude."
          },
          "radiusKm": {
            "title": "Radius (km)",
            "minimum": 1,
            "maximum": 250,
            "type": "number",
            "description": "Only stores within this distance are checked.",
            "default": 25
          },
          "maxStores": {
            "title": "Max stores",
            "minimum": 1,
            "maximum": 25,
            "type": "integer",
            "description": "How many of the nearest stores inside the radius to check.",
            "default": 5
          },
          "products": {
            "title": "Products (SKUs or product links)",
            "type": "array",
            "description": "Staples item numbers (SKU, for example 3099949) or staples.ca product links. Every product listed here is checked at every selected store.",
            "items": {
              "type": "string"
            }
          },
          "searchQuery": {
            "title": "Search words",
            "type": "string",
            "description": "Optional. Also check products matching these words, as the staples.ca search finds them."
          },
          "category": {
            "title": "Category",
            "type": "string",
            "description": "Optional. A staples.ca category link (https://www.staples.ca/collections/...) or its last part, for example pens-6745."
          },
          "clearanceOnly": {
            "title": "Clearance items only",
            "type": "boolean",
            "description": "List items Staples marks as clearance (combined with the search words or category when given). With no products, search or category, the run lists clearance items."
          },
          "onSaleOnly": {
            "title": "Discounted items only",
            "type": "boolean",
            "description": "List only items whose price is below their regular price."
          },
          "maxProducts": {
            "title": "Max listed products",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "How many products to take from the search, category or clearance list. Products you list by SKU or link come on top.",
            "default": 20
          },
          "onlyInStock": {
            "title": "Only stores with stock",
            "type": "boolean",
            "description": "Leave out stores that have zero units. Applies to full results; change tracking always follows every listed store.",
            "default": false
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "discount",
              "distance",
              "stock"
            ],
            "type": "string",
            "description": "Order of the rows: biggest discount first, nearest store first, or most units first.",
            "default": "discount"
          },
          "maxItems": {
            "title": "Max rows",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Most rows (product-store pairs) to deliver in one run.",
            "default": 500
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "full",
              "changes"
            ],
            "type": "string",
            "description": "Full returns every product-store row. Changes returns only what moved since the last run with the same state key: new rows, stock changes, restocks, sell-outs, price changes and rows no longer listed.",
            "default": "full"
          },
          "stateKey": {
            "title": "State key",
            "type": "string",
            "description": "Name of the saved state used in Changes mode. Runs with the same key compare against each other. Leave empty to derive it from the location and product settings."
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Connection used for the stock, store and product lookups. The default Apify proxy works.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}