{
  "openapi": "3.0.1",
  "info": {
    "title": "Trefac Scraper – Treasure Factory Japan Secondhand Fashion",
    "description": "Scrape Trefac ONLINE (トレファク, Treasure Factory) — Japan's largest secondhand fashion chain. Search by brand, category, price or new arrivals; get normalized size, condition rank, measurements and images. Part of the JP Data Works series (Mercari, Yahoo Auctions, Komehyo coming).",
    "version": "0.3",
    "x-build-id": "zPDGa6dsJftZ6Vx3P"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tokyo-select-jp~trefac-search-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tokyo-select-jp-trefac-search-scraper",
        "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/tokyo-select-jp~trefac-search-scraper/runs": {
      "post": {
        "operationId": "runs-sync-tokyo-select-jp-trefac-search-scraper",
        "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/tokyo-select-jp~trefac-search-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-tokyo-select-jp-trefac-search-scraper",
        "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": {
          "keywords": {
            "title": "Keywords",
            "uniqueItems": true,
            "type": "array",
            "description": "Simple keyword searches, one per line — brand names, item types, Japanese or English (e.g. `KAPITAL`, `リーバイス 501`, `visvim`). Each keyword is one search and inherits the default sort / price range / condition below. Optional when `searches` is set.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "searches": {
            "title": "Structured searches",
            "type": "array",
            "description": "Advanced searches as JSON objects. Every field is optional, but each search needs at least one of `keyword`, `brand`, `brandId`, `categoryId`, `categoryPath`.\n\n- `keyword` — free text (`srchword`).\n- `brand` — brand name as listed on trefac.jp/brand (English or katakana, e.g. `KAPITAL`, `キャピタル`); resolved to the site's brand id. `brandId` — that id directly (the number in `/store/tcpsb<ID>/`, e.g. 17171 = KAPITAL, 36518 = VISVIM, 18847 = LEVI'S).\n- `categoryPath` — `トップス`, `アウター・ジャケット > デニムジャケット`, `pants > デニムパンツ`, `shoes`, `デニムパンツ` …; `categoryId` — the site's category id (top level `gcateg` such as 92, or sub category `kind` such as 154).\n- `priceMinJpy` / `priceMaxJpy` — tax-included price bounds.\n- `sort` — `relevance` (default), `newest` (新着順), `priceAsc`, `priceDesc`.\n- `conditionMin` — minimum condition rank 1–6 (6 = unused, 5 = like new, 4 = little sign of use).\n- `gender` — `mens`, `ladies`, `kids`, `any`.\n- `storeName` — keep only items held by a shop whose name contains this text (client-side).\n\nValues set here override the defaults below.",
            "items": {
              "type": "object",
              "properties": {
                "keyword": {
                  "type": "string",
                  "title": "Keyword",
                  "description": "Free-text search (the site's srchword)."
                },
                "brand": {
                  "type": "string",
                  "title": "Brand name",
                  "description": "Brand name as listed on trefac.jp/brand (English or katakana); resolved to brandId."
                },
                "brandId": {
                  "type": "integer",
                  "title": "Brand id",
                  "description": "Site brand id: the number in /store/tcpsb<ID>/ (17171 = KAPITAL)."
                },
                "categoryPath": {
                  "type": "string",
                  "title": "Category path",
                  "description": "Category name or path such as `アウター・ジャケット > デニムジャケット`, `pants > デニムパンツ`, `shoes`."
                },
                "categoryId": {
                  "type": "integer",
                  "title": "Category id",
                  "description": "Site category id: top level (gcateg, e.g. 92) or sub category (kind, e.g. 154)."
                },
                "priceMinJpy": {
                  "type": "integer",
                  "title": "Min price (JPY)",
                  "description": "Lower price bound, tax included.",
                  "minimum": 0
                },
                "priceMaxJpy": {
                  "type": "integer",
                  "title": "Max price (JPY)",
                  "description": "Upper price bound, tax included.",
                  "minimum": 0
                },
                "sort": {
                  "type": "string",
                  "title": "Sort",
                  "description": "relevance (default), newest (新着順), priceAsc, priceDesc.",
                  "enum": [
                    "relevance",
                    "newest",
                    "priceAsc",
                    "priceDesc"
                  ]
                },
                "conditionMin": {
                  "type": "integer",
                  "title": "Min condition rank",
                  "description": "Minimum condition rank 1–6 (6 = unused).",
                  "minimum": 1,
                  "maximum": 6
                },
                "gender": {
                  "type": "string",
                  "title": "Gender",
                  "description": "mens, ladies, kids or any.",
                  "enum": [
                    "mens",
                    "ladies",
                    "kids",
                    "any"
                  ]
                },
                "storeName": {
                  "type": "string",
                  "title": "Store name (client-side filter)",
                  "description": "Keep only items whose shop name contains this text (applied client-side)."
                }
              }
            },
            "default": []
          },
          "outputMode": {
            "title": "Output mode",
            "enum": [
              "items",
              "summary",
              "both"
            ],
            "type": "string",
            "description": "`items` (default): one dataset row per listing. `summary`: one market-summary row per search instead of the listings — sample size, price min / p25 / median / mean / p75 / max, price histogram, condition-rank, size, brand and category breakdowns, cheapest listings — billed once per search as the `summary` event (listings are not billed). `both`: listings plus the summary row.",
            "default": "items"
          },
          "sort": {
            "title": "Default sort order",
            "enum": [
              "relevance",
              "newest",
              "priceAsc",
              "priceDesc"
            ],
            "type": "string",
            "description": "Applied to every keyword / search that does not set its own `sort`. `newest` = 新着順 (new arrivals first), `priceAsc` = 価格の安い順, `priceDesc` = 価格の高い順.",
            "default": "relevance"
          },
          "priceMinJpy": {
            "title": "Default min price (JPY)",
            "minimum": 0,
            "type": "integer",
            "description": "Lower price bound (tax included) for every search without its own `priceMinJpy`. Leave empty for no lower bound."
          },
          "priceMaxJpy": {
            "title": "Default max price (JPY)",
            "minimum": 0,
            "type": "integer",
            "description": "Upper price bound (tax included) for every search without its own `priceMaxJpy`. Leave empty for no upper bound."
          },
          "conditionMin": {
            "title": "Default min condition rank",
            "minimum": 1,
            "maximum": 6,
            "type": "integer",
            "description": "Only listings with this condition rank (★) or better: 6 未使用品, 5 未使用に近い, 4 使用感をあまり感じない, 3 やや傷や汚れがあり, 2 傷や汚れがあり, 1 全体的に使用感あり. Leave empty (or 1) for all."
          },
          "maxItemsPerKeyword": {
            "title": "Max items per search",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Stop after this many listings for each keyword / search. The site shows 90 listings per page, so up to 6 pages are fetched (12 when a client-side filter such as storeName is active).",
            "default": 60
          },
          "maxTotalItems": {
            "title": "Max total items",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Hard cap on listings saved in one run, across all keywords and searches. Leave empty for no cap (each search is still limited by Max items per search)."
          },
          "dedupeAcrossSearches": {
            "title": "Deduplicate across searches",
            "type": "boolean",
            "description": "When several keywords / searches return the same listing (same itemId), save it only once — with the first search that found it. Turn off to get one row per search.",
            "default": true
          },
          "enrichDetail": {
            "title": "Enrich with item detail pages",
            "type": "boolean",
            "description": "Also open each item's page to get the condition rank (★1–6 + label), measurements in cm (肩幅/身幅/袖丈/着丈/ウエスト/股下 …), staff comment, material, country and full-size image URLs. Costs one extra request (and one `detail-page` event) per item.",
            "default": false
          },
          "maxDetailPages": {
            "title": "Max detail pages",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Upper bound on item pages opened in one run (across all searches) when enrichDetail is on. Items beyond this limit are still returned, just without detail fields.",
            "default": 100
          },
          "requestDelayMs": {
            "title": "Delay between requests (ms)",
            "minimum": 1000,
            "maximum": 60000,
            "type": "integer",
            "description": "Minimum pause between consecutive requests to trefac.jp. Keep it at 3000 ms or more to stay polite — the site is a small retailer and its robots.txt asks search engines for a 30 s crawl delay.",
            "default": 3000
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. trefac.jp serves pages without a proxy, so leave this off unless your runs get blocked. Apify Proxy (datacenter or residential) is supported."
          },
          "outputFields": {
            "title": "Output fields",
            "uniqueItems": true,
            "type": "array",
            "description": "Optional list of top-level fields to keep in each dataset item (itemId and url are always kept). Leave empty for the full item.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}