{
  "openapi": "3.0.3",
  "info": {
    "title": "Girlfriend Gifts API — gift lists & wishlists",
    "version": "0.1.0",
    "description": "Build gift recommendation lists, shopping lists, and shareable wishlists (owner + shopper) for girlfriend/wife. For humans and AI agents. Multi-country Amazon: always pass marketplace + locale (example US: marketplace=amazon.com&locale=en). Catalog has 170+ real amazon.se /dp ASINs. amazon.se trackingTag sw-girlfriend-21 when configured via NEXT_PUBLIC_AMAZON_TAGS_JSON; other storefronts may stay untagged. Prefer buyUrl. CORS *."
  },
  "servers": [
    {
      "url": "https://girlfriendgifts.vercel.app"
    }
  ],
  "paths": {
    "/api/v1/health": {
      "get": {
        "summary": "Health & catalog/list-building status",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "description": "Service health for Girlfriend Gifts list-building API. Returns trackingTag, catalogCount, marketplaces, storage."
      }
    },
    "/api/v1/search": {
      "get": {
        "summary": "Search gifts for a recommendation / shopping list",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "occasion",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "budgetBand",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "styleTag",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            }
          },
          {
            "name": "marketplace",
            "in": "query",
            "required": true,
            "description": "Amazon storefront id or domain (e.g. amazon.com, us, amazon.se)",
            "schema": {
              "type": "string",
              "example": "amazon.com"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": true,
            "description": "Locale for search cues (e.g. en, sv, de)",
            "schema": {
              "type": "string",
              "example": "en"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Search results"
          }
        },
        "description": "Open Amazon gift search on the user's marketplace. Use results to build a gift recommendation or shopping list. Always pass marketplace + locale."
      }
    },
    "/api/v1/catalog": {
      "get": {
        "summary": "Curated catalog (170+ real amazon.se /dp ASINs)",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "occasion",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "budgetBand",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "styleTag",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "styleTags",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "marketplace",
            "in": "query",
            "required": true,
            "description": "Amazon storefront id or domain (e.g. amazon.com, us, amazon.se)",
            "schema": {
              "type": "string",
              "example": "amazon.com"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": true,
            "description": "Locale for search cues (e.g. en, sv, de)",
            "schema": {
              "type": "string",
              "example": "en"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Catalog items"
          }
        },
        "description": "Curated girlfriend/wife gift catalog with 100+ verified amazon.se product ASINs for building shopping lists and wishlists. Prefer /dp on amazon.se; use search on other markets. Pass marketplace + locale."
      }
    },
    "/api/v1/wishlists": {
      "post": {
        "summary": "Create gift list / wishlist",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipientName": {
                    "type": "string"
                  },
                  "occasion": {
                    "type": "string"
                  },
                  "budgetBand": {
                    "type": "string"
                  },
                  "styleTags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "relationship": {
                    "type": "string"
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "marketplace": {
                    "type": "string",
                    "example": "amazon.com"
                  },
                  "locale": {
                    "type": "string",
                    "example": "en"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created (ownerUrl + shopUrl)"
          }
        },
        "description": "Create an empty gift list or wishlist for a girlfriend/wife. Returns ownerUrl (she edits) and shopUrl (he/agent shops)."
      }
    },
    "/api/v1/wishlists/{id}": {
      "get": {
        "summary": "Get wishlist",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Wishlist"
          }
        }
      },
      "patch": {
        "summary": "Patch wishlist",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Edit-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      }
    },
    "/api/v1/wishlists/{id}/items": {
      "post": {
        "summary": "Add item to gift list / wishlist",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Edit-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Item added"
          }
        },
        "description": "Add a product or search wish to an existing gift list. Pass asin for /dp links, or keywords/url. Requires X-Edit-Token."
      }
    },
    "/api/v1/wishlists/{id}/items/{itemId}": {
      "delete": {
        "summary": "Delete item",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Edit-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          }
        }
      }
    },
    "/api/v1/agent/create-and-fill": {
      "post": {
        "summary": "One-shot create + fill gift list",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "marketplace",
                  "locale"
                ],
                "properties": {
                  "recipientName": {
                    "type": "string"
                  },
                  "occasion": {
                    "type": "string"
                  },
                  "budgetBand": {
                    "type": "string"
                  },
                  "styleTags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "relationship": {
                    "type": "string"
                  },
                  "itemAsins": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "itemKeywords": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "itemQueries": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "marketplace": {
                    "type": "string",
                    "example": "amazon.com"
                  },
                  "locale": {
                    "type": "string",
                    "example": "en"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        },
        "description": "Preferred agent path for list-building: create a wishlist and fill it with ASINs, keywords, or search queries in one call. Returns ownerUrl + shopUrl."
      }
    },
    "/api/v1/products/resolve": {
      "post": {
        "summary": "Resolve ASIN/URL/keywords to buyUrl for a list item",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "marketplace",
                  "locale"
                ],
                "properties": {
                  "asin": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  },
                  "keywords": {
                    "type": "string"
                  },
                  "occasion": {
                    "type": "string"
                  },
                  "budgetBand": {
                    "type": "string"
                  },
                  "styleTag": {
                    "type": "string"
                  },
                  "marketplace": {
                    "type": "string",
                    "example": "amazon.com"
                  },
                  "locale": {
                    "type": "string",
                    "example": "en"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resolved"
          }
        },
        "description": "Resolve an ASIN, pasted Amazon URL, or keywords to a buyUrl suitable for adding to a shopping list or wishlist. Pass marketplace + locale."
      }
    },
    "/api/cron/refresh-catalog": {
      "get": {
        "summary": "Weekly catalog refresh stub (Bearer CRON_SECRET)",
        "responses": {
          "200": {
            "description": "Stub status"
          }
        }
      }
    },
    "/api/v1/marketplaces": {
      "get": {
        "summary": "List supported Amazon marketplaces",
        "responses": {
          "200": {
            "description": "Marketplace list + default"
          }
        }
      }
    }
  }
}
