{
  "openapi": "3.1.0",
  "info": {
    "title": "hinode（ひので）商品データ API",
    "version": "1.0.0",
    "summary": "hinode.jp の公開・読み取り専用 JSON API。商品・コレクション・検索・コンテンツを AI エージェントやクローラーが取得するための入口。",
    "description": "hinode（ひので）は作家ものの和食器・日用品を販売するオンラインショップです。この API は商品・作家・読みものの公開データを JSON で返します。\n\n- すべて読み取り専用（GET）です。カート・注文・再入荷登録・お問い合わせはこの API の対象外です。\n- 認証は不要です。\n- 応答は CDN / isolate でキャッシュされるため、在庫や価格は数分〜1時間ほど遅れることがあります。\n- 機械可読なサイト案内は https://hinode.jp/llms.txt 、人間向けの説明は https://hinode.jp/developers にあります。\n- 商品ページの Markdown 版は `/products/{handle}.md`、作家は `/creators/{handle}.md` です。",
    "contact": {
      "name": "hinode（ひので）",
      "url": "https://hinode.jp/contact",
      "email": "info@hinode.jp"
    },
    "license": {
      "name": "All rights reserved",
      "identifier": "LicenseRef-All-Rights-Reserved"
    }
  },
  "servers": [
    {
      "url": "https://hinode.jp",
      "description": "本番"
    }
  ],
  "tags": [
    {
      "name": "products",
      "description": "商品・コレクション・検索"
    },
    {
      "name": "content",
      "description": "お知らせ・読みもの"
    },
    {
      "name": "site",
      "description": "サイト構成・配送日"
    }
  ],
  "paths": {
    "/api/products/{handle}": {
      "get": {
        "tags": [
          "products"
        ],
        "operationId": "getProduct",
        "summary": "商品 1 件を取得する",
        "description": "Shopify Storefront API の商品のうち、店頭で使う項目だけを返します。`metafields` には素材・寸法・電子レンジ可否などの仕様が含まれます。",
        "parameters": [
          {
            "name": "handle",
            "in": "path",
            "required": true,
            "description": "商品 handle（例: `haramuratoshiyuki-cyawan-kuma`）。英数字・ハイフン・アンダースコアのみ。",
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "商品",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "400": {
            "description": "handle の形式が不正",
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "description": "商品が存在しない",
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/products/search": {
      "get": {
        "tags": [
          "products"
        ],
        "operationId": "searchProducts",
        "summary": "商品を検索する（在庫連動）",
        "description": "キーワード検索。店頭の検索結果ページと同じ Shopify `search` を使います。",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "検索キーワード",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "並び順",
            "schema": {
              "type": "string",
              "enum": [
                "RELEVANCE",
                "PRICE"
              ],
              "default": "RELEVANCE"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "description": "次のページのカーソル（`pageInfo.endCursor`）",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "description": "前のページのカーソル",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "prev",
            "in": "query",
            "required": false,
            "description": "前ページ取得フラグ",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "desc",
            "in": "query",
            "required": false,
            "description": "逆順にする",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "検索結果",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "nodes": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ProductSummary"
                      }
                    },
                    "pageInfo": {
                      "$ref": "#/components/schemas/PageInfo"
                    },
                    "totalCount": {
                      "type": "integer"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "503": {
            "description": "検索バックエンドが一時的に利用できない",
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/products/collection/{handle}": {
      "get": {
        "tags": [
          "products"
        ],
        "operationId": "getCollectionProducts",
        "summary": "コレクション（カテゴリ・作家）の商品を取得する",
        "parameters": [
          {
            "name": "handle",
            "in": "path",
            "required": true,
            "description": "コレクション handle（例: `tableware`）",
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_-]+$"
            }
          },
          {
            "name": "numberOfProductsPerPage",
            "in": "query",
            "required": false,
            "description": "1 ページの件数（1〜250）",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 250,
              "default": 60
            }
          },
          {
            "name": "params",
            "in": "query",
            "required": false,
            "description": "ページングと並び順をまとめた JSON 文字列。例: `{\"after\":\"...\",\"sort\":\"PRICE\"}`。キーは `after` / `before` / `prev` / `desc` / `sort`。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "コレクションと商品一覧",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string"
                    },
                    "handle": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "products": {
                      "type": "object",
                      "properties": {
                        "nodes": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ProductSummary"
                          }
                        },
                        "pageInfo": {
                          "$ref": "#/components/schemas/PageInfo"
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/api/products/recommend": {
      "get": {
        "tags": [
          "products"
        ],
        "operationId": "getProductRecommendations",
        "summary": "関連商品を取得する",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "description": "起点となる商品の GID（例: `gid://shopify/Product/1234567890`）",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "関連商品の配列",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProductSummary"
                  }
                }
              }
            }
          },
          "400": {
            "description": "id が無い・不正",
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/storeData": {
      "get": {
        "tags": [
          "site"
        ],
        "operationId": "getStoreData",
        "summary": "カテゴリ・作家などの店舗データを取得する",
        "description": "ナビゲーションに使うカテゴリ一覧・サブカテゴリ・作家一覧を返します。商品横断の索引として使えます。",
        "responses": {
          "200": {
            "description": "店舗データ",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "503": {
            "description": "一時的な取得失敗",
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/slider": {
      "get": {
        "tags": [
          "site"
        ],
        "operationId": "getSlider",
        "summary": "トップのスライダー（特集）を取得する",
        "responses": {
          "200": {
            "description": "スライドの配列",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/delivery-dates": {
      "get": {
        "tags": [
          "site"
        ],
        "operationId": "getDeliveryDates",
        "summary": "配送希望日の候補を取得する",
        "responses": {
          "200": {
            "description": "配送希望日",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "配送希望日の候補（例: \"2026-09-19（土）\"）"
                }
              }
            }
          }
        }
      }
    },
    "/api/sitemap/urls": {
      "get": {
        "tags": [
          "site"
        ],
        "operationId": "getSitemapUrls",
        "summary": "サイトマップの URL 一覧を取得する",
        "description": "XML サイトマップに入る URL と同じ一覧を JSON で返します。",
        "responses": {
          "200": {
            "description": "URL 一覧",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "loc": {
                        "type": "string",
                        "format": "uri-reference",
                        "description": "サイト内の相対パス（例: /products/haramuratoshiyuki-cyawan-kuma）"
                      },
                      "lastmod": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "loc"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/content/list": {
      "get": {
        "tags": [
          "content"
        ],
        "operationId": "listContent",
        "summary": "お知らせ・読みものの一覧を取得する",
        "parameters": [
          {
            "name": "segment",
            "in": "query",
            "required": false,
            "description": "`news` または `notes`",
            "schema": {
              "type": "string",
              "enum": [
                "news",
                "notes"
              ],
              "default": "news"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "perPage",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 60,
              "default": 24
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "カテゴリの slug",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "一覧",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/api/content/item": {
      "get": {
        "tags": [
          "content"
        ],
        "operationId": "getContentItem",
        "summary": "記事 1 件を取得する",
        "parameters": [
          {
            "name": "path",
            "in": "query",
            "required": true,
            "description": "記事のパス（例: `/notes/life/feeling`）",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "記事。該当が無ければ null",
            "content": {
              "application/json": {
                "schema": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/api/content/top": {
      "get": {
        "tags": [
          "content"
        ],
        "operationId": "getTopContent",
        "summary": "トップに出すお知らせ・読みものを取得する",
        "responses": {
          "200": {
            "description": "お知らせと読みもの",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "news": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/api/content/known": {
      "get": {
        "tags": [
          "content"
        ],
        "operationId": "isKnownContentPath",
        "summary": "公開済みの記事パスかどうかを判定する",
        "parameters": [
          {
            "name": "path",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "公開済みなら true",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Error": {
        "description": "エラー",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "integer"
          },
          "statusMessage": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "Money": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "string",
            "description": "金額（文字列。例: \"2400.0\"）"
          },
          "currencyCode": {
            "type": "string",
            "default": "JPY"
          }
        },
        "required": [
          "amount"
        ],
        "additionalProperties": true
      },
      "Image": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "width": {
            "type": [
              "integer",
              "null"
            ]
          },
          "height": {
            "type": [
              "integer",
              "null"
            ]
          },
          "altText": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "url"
        ],
        "additionalProperties": true,
        "description": "Storefront API の Image。一覧の featuredImage は `thumbnail`、商品詳細の variants/media は `url` を使う。"
      },
      "ProductVariant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Shopify GID"
          },
          "title": {
            "type": "string"
          },
          "sku": {
            "type": [
              "string",
              "null"
            ]
          },
          "price": {
            "$ref": "#/components/schemas/Money"
          },
          "quantityAvailable": {
            "type": [
              "integer",
              "null"
            ],
            "description": "在庫数。0 は売り切れ（再入荷通知のみ）"
          },
          "image": {
            "description": "画像未設定の場合は null",
            "oneOf": [
              {
                "$ref": "#/components/schemas/Image"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "price"
        ],
        "additionalProperties": true
      },
      "ProductSummary": {
        "type": "object",
        "properties": {
          "handle": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "vendor": {
            "type": "string",
            "description": "作家・ブランド名"
          },
          "availableForSale": {
            "type": "boolean",
            "description": "購入可能なバリエーションが 1 つ以上あるか"
          },
          "priceRange": {
            "type": "object",
            "properties": {
              "minVariantPrice": {
                "$ref": "#/components/schemas/Money"
              },
              "maxVariantPrice": {
                "$ref": "#/components/schemas/Money"
              }
            },
            "additionalProperties": true
          },
          "featuredImage": {
            "description": "画像未設定の場合は null。一覧の投影は thumbnail 名。",
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "thumbnail": {
                    "type": "string",
                    "format": "uri-reference"
                  }
                },
                "additionalProperties": true
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "handle",
          "title"
        ],
        "additionalProperties": true,
        "description": "一覧・検索・関連商品で返る商品の要約。`server/utils/graphql.js` の PRODUCT_FRAGMENT が投影する項目だけを持ち、商品詳細の `id` は含まない。"
      },
      "Product": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ProductSummary"
          },
          {
            "type": "object",
            "properties": {
              "description": {
                "type": "string"
              },
              "descriptionHtml": {
                "type": "string"
              },
              "productType": {
                "type": "string"
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "totalInventory": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "publishedAt": {
                "type": "string",
                "format": "date-time"
              },
              "seo": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "additionalProperties": true
              },
              "category": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "Shopify の商品分類（name と ancestors）",
                "additionalProperties": true
              },
              "variants": {
                "type": "object",
                "properties": {
                  "nodes": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ProductVariant"
                    }
                  }
                },
                "additionalProperties": true
              },
              "media": {
                "type": "object",
                "properties": {
                  "nodes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "additionalProperties": true
              },
              "metafields": {
                "type": [
                  "array",
                  "null"
                ],
                "description": "仕様（素材・寸法・重量・容量・手触り・電子レンジ/食洗機の可否・注意点・購入者の声）。未設定の key は null。",
                "items": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "key": {
                      "type": "string"
                    },
                    "value": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              },
              "collections": {
                "type": "object",
                "properties": {
                  "nodes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "additionalProperties": true
              },
              "id": {
                "type": "string",
                "description": "Shopify GID（商品詳細のみ）"
              }
            },
            "additionalProperties": true,
            "required": [
              "id",
              "handle",
              "title"
            ]
          }
        ]
      },
      "PageInfo": {
        "type": "object",
        "properties": {
          "hasNextPage": {
            "type": "boolean"
          },
          "hasPreviousPage": {
            "type": "boolean"
          },
          "startCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "endCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": true
      }
    }
  }
}
