@wix/agent-skills 1.19.1 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/package.json +1 -1
  2. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +1 -1
  3. package/skills/wix-app/references/SERVICE_PLUGIN.md +14 -1
  4. package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +7 -2
  5. package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +53 -28
  6. package/skills/wix-app/references/editor-react-component/COMPONENT-CONTRACT.md +17 -4
  7. package/skills/wix-app/references/editor-react-component/FUNCTION-HANDLERS.md +71 -31
  8. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +3 -4
  9. package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +4 -0
  10. package/skills/wix-app/references/service-plugin/AVAILABILITY-TIME-SLOTS-CONFIGURATION.md +118 -0
  11. package/skills/wix-app/references/service-plugin/BOOKING-POLICY.md +65 -0
  12. package/skills/wix-app/references/service-plugin/BOOKINGS-PRICING.md +71 -0
  13. package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +11 -3
  14. package/skills/wix-app/references/service-plugin/BOOKINGS-VALIDATION.md +137 -0
  15. package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +23 -16
  16. package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +4 -0
  17. package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +4 -2
  18. package/skills/wix-app/references/service-plugin/REALTIME-PERMISSIONS.md +45 -0
  19. package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +15 -0
  20. package/skills/wix-app/references/service-plugin/TOOLS_PROVIDER.md +4 -0
  21. package/skills/wix-app/references/service-plugin/VALIDATIONS.md +4 -0
  22. package/skills/wix-base44-connector/SKILL.md +46 -24
  23. package/skills/wix-headless/SKILL.md +1 -0
  24. package/skills/wix-headless/references/CAPABILITIES.md +7 -2
  25. package/skills/wix-headless/references/SDK_HANDOFF.md +2 -1
  26. package/skills/wix-headless/references/inline-recipes/experience-store.md +49 -0
  27. package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +431 -115
  28. package/skills/wix-headless/references/inline-recipes/how-to-code-members-astro.md +1 -1
  29. package/skills/wix-headless/references/managed/CREATE.md +5 -0
  30. package/skills/wix-headless/references/managed/DEPLOYMENT.md +8 -8
  31. package/skills/wix-headless-fast/install/fast-path.mjs +3 -1
  32. package/skills/wix-headless-fast/references/shared/app/wix/media.ts +13 -0
  33. package/skills/wix-headless-fast/references/storefront/INSTRUCTIONS.md +227 -56
  34. package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartDrawer.tsx +37 -3
  35. package/skills/wix-headless-fast/references/storefront/app/components/storefront/FilterPanel.tsx +266 -0
  36. package/skills/wix-headless-fast/references/storefront/app/components/storefront/QuickAdd.tsx +165 -0
  37. package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useProductDetail.ts +48 -15
  38. package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useShop.ts +129 -11
  39. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart.ts +36 -6
  40. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog.ts +190 -24
  41. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/types.ts +62 -4
  42. package/skills/wix-headless-fast/references/storefront/app-astro/layouts/SiteLayout.astro +21 -2
  43. package/skills/wix-headless-fast/references/storefront/seed/SEED.md +5 -1
  44. package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +59 -6
  45. package/skills/wix-manage/SKILL.md +8 -5
  46. package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +4 -1
  47. package/skills/wix-manage/references/bookings/create-appointment-service.md +3 -1
  48. package/skills/wix-manage/references/bookings/create-class-service.md +3 -1
  49. package/skills/wix-manage/references/bookings/create-course-service.md +4 -2
  50. package/skills/wix-manage/references/bookings/end-to-end-booking-flow.md +68 -3
  51. package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-seasonal-promotion.md +1 -1
  52. package/skills/wix-manage/references/events/create-wix-event.md +46 -0
  53. package/skills/wix-manage/references/events/manage-wix-events.md +51 -1
  54. package/skills/wix-manage/references/google-ads/manage-campaign-lifecycle.md +6 -6
  55. package/skills/wix-manage/references/google-ads/manage-campaign-success-guide.md +108 -14
  56. package/skills/wix-manage/references/seo/manage-content-plan.md +1 -1
  57. package/skills/wix-manage/references/seo/manage-seo-suggestions.md +351 -0
  58. package/skills/wix-manage/references/sites/upload-static-site.md +264 -34
  59. package/skills/wix-vibe-headless/install/deploy.cjs +33 -2
  60. package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed-with-install.md +1 -1
  61. package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +13 -4
  62. package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +1 -1
  63. package/skills/wix-vibe-headless/platforms/base44.md +19 -4
  64. package/skills/wix-vibe-headless/platforms/generic.md +6 -0
  65. package/skills/wix-vibe-headless/references/_shared/nav/nav.tanstack.js +30 -0
  66. package/skills/wix-vibe-headless/references/_shared/routing.md +86 -0
  67. package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +44 -0
  68. package/skills/wix-vibe-headless/references/blog/app/components/PostCard.jsx +1 -1
  69. package/skills/wix-vibe-headless/references/blog/app/components/PostChips.jsx +1 -1
  70. package/skills/wix-vibe-headless/references/blog/app/pages/CategoryPage.jsx +1 -1
  71. package/skills/wix-vibe-headless/references/blog/app/pages/PostDetail.jsx +1 -1
  72. package/skills/wix-vibe-headless/references/blog/app/pages/TagPage.jsx +1 -1
  73. package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +42 -0
  74. package/skills/wix-vibe-headless/references/bookings/app/components/ServiceCard.jsx +1 -1
  75. package/skills/wix-vibe-headless/references/bookings/app/pages/ServiceDetail.jsx +1 -1
  76. package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +42 -0
  77. package/skills/wix-vibe-headless/references/events/app/components/EventCard.jsx +1 -1
  78. package/skills/wix-vibe-headless/references/events/app/pages/EventDetail.jsx +1 -1
  79. package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +42 -0
  80. package/skills/wix-vibe-headless/references/members/app/components/MemberMenu.jsx +1 -1
  81. package/skills/wix-vibe-headless/references/members/app/components/RequireAuth.jsx +1 -1
  82. package/skills/wix-vibe-headless/references/members/app/pages/Login.jsx +1 -1
  83. package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +43 -0
  84. package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionCard.jsx +1 -1
  85. package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectCard.jsx +1 -1
  86. package/skills/wix-vibe-headless/references/portfolio/app/pages/CollectionPage.jsx +1 -1
  87. package/skills/wix-vibe-headless/references/portfolio/app/pages/ProjectDetail.jsx +1 -1
  88. package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +43 -0
  89. package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanCard.jsx +1 -1
  90. package/skills/wix-vibe-headless/references/pricing-plans/app/pages/PlanDetail.jsx +1 -1
  91. package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +36 -0
  92. package/skills/wix-vibe-headless/references/shared/app/lib/nav.js +9 -0
  93. package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +110 -27
  94. package/skills/wix-vibe-headless/references/storefront/app/components/CartDrawer.jsx +32 -14
  95. package/skills/wix-vibe-headless/references/storefront/app/context/CartContext.jsx +14 -3
  96. package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductCard.js +47 -35
  97. package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductDetail.js +77 -30
  98. package/skills/wix-vibe-headless/references/storefront/app/rest/wix-store-cart.js +31 -2
  99. package/skills/wix-vibe-headless/references/storefront/app/rest/wix-store-catalog.js +31 -6
@@ -0,0 +1,351 @@
1
+ ---
2
+ name: "Generate AI SEO Suggestions for a Wix Site"
3
+ description: "Generate AI-written SEO text for a Wix site through the public Tag Suggestions and Page Optimization APIs: title tag and meta description options for a page, alt text for the images of a page, store product, or blog post (one image or up to 20 per call), corrected heading levels for a page's headings, and a whole-page rewrite of title, description, headings, and body text aimed at the page's focus keyword, returned as before/after pairs. Use it when the user wants to improve, optimize, audit, or write the SEO text of a page or the homepage. Suggestions are returned for review; applying one is a separate SEO tags write."
4
+ ---
5
+
6
+ # Generate AI SEO Suggestions for a Wix Site
7
+
8
+ The **Tag Suggestions API** writes single texts from content you pass in: title
9
+ tags, meta descriptions, image alt text, heading levels. The **Page Optimization
10
+ API** reads a page from the Wix site itself and returns a whole-page rewrite as
11
+ before/after pairs. Neither changes the site: every result is a suggestion for
12
+ the user to review. Both select the site from the caller's authorization context
13
+ and take no site ID. Use the site already selected in the environment. If none
14
+ is selected, list the available sites. Select the only site automatically; if
15
+ several are available, ask the user to choose by name before making
16
+ site-specific calls. Never invent a site ID or ask the user to type one.
17
+
18
+ All endpoints are under `https://www.wixapis.com/seo/suggestions/v1`. Reads of
19
+ the site's pages and writes of its tags use the SEO Tags API under
20
+ `https://www.wixapis.com/promote/seo/v1`. Every request and response shape a
21
+ flow needs is in this recipe, verified against the live API: build the calls
22
+ from here, including the two SEO Tags calls (List Item SEO Tags, and the
23
+ focus-keyword write). Do not open the linked reference articles or search API
24
+ schemas before calling; the links are for cases this recipe does not cover.
25
+
26
+ | User asks for | Call |
27
+ |---|---|
28
+ | A better SEO title or meta description for a page | Generate Title Suggestions, Generate Description Suggestions |
29
+ | Alt text for images of a page, product, or post | Generate Alt Text Suggestions (one) or Bulk Generate Alt Text Suggestions (up to 20) |
30
+ | Check or fix a page's heading hierarchy | Generate Heading Structure Suggestions |
31
+ | Optimize or rewrite a page for a keyword, "improve this page's SEO" | Trigger Page Optimization, or Trigger Home Page Optimization for the homepage, then poll Get Page Optimization Results |
32
+
33
+ "Optimize", "rewrite", or "improve the SEO of" a page means the page
34
+ optimization flow: it reads the page's real text and rewrites title,
35
+ description, headings, and body together. The title and description generators
36
+ are not a substitute for it; they know nothing about the page's content and
37
+ cover two tags only. Use them when the user asks for title or description
38
+ options, not when they ask to optimize a page.
39
+
40
+ Each call spends AI generation and returns fresh text; nothing is stored except
41
+ page optimization results. Suggestions come back in the site's language, and
42
+ there is no parameter to change it.
43
+
44
+ ## Find the page first
45
+
46
+ Every flow except title and description needs the page's ID, and most need to
47
+ know what the page renders today. Read it once with
48
+ [List Item SEO Tags](https://dev.wix.com/docs/api-reference/business-management/seo/item-seo-tags-v1/list-item-seo-tags):
49
+
50
+ ```
51
+ GET https://www.wixapis.com/promote/seo/v1/item-seo-tags/STATIC_PAGE?paging.limit=50
52
+ ```
53
+
54
+ Relevant response fields (other tags omitted; IDs are illustrative):
55
+
56
+ ```json
57
+ { "itemSeoTags": [ { "itemId": "c1dmp", "itemType": "STATIC_PAGE",
58
+ "focusKeywords": [ { "term": "jewelry making styles", "isMain": true } ],
59
+ "resolvedTags": [
60
+ { "tag": { "type": "title", "children": "Home | Luna" }, "source": "TAG_SOURCE_DEFAULT_PATTERN" },
61
+ { "tag": { "type": "link", "props": { "rel": "canonical", "href": "https://www.example.com" } }, "source": "TAG_SOURCE_DEFAULT_PATTERN" },
62
+ { "tag": { "type": "meta", "props": { "name": "description", "content": "..." } }, "source": "TAG_SOURCE_ITEM" } ] } ],
63
+ "pagingMetadata": { "hasNext": false, "cursors": {} } }
64
+ ```
65
+
66
+ - `itemId` is the page ID (`pageId` in every call below). Identify the page by
67
+ its resolved `title` tag; if that is ambiguous, ask the user which page.
68
+ - The page path is the path of the canonical `link` `href`: `/cart-page` for
69
+ `https://www.example.com/cart-page`.
70
+ - The homepage is the entry whose canonical `link` `href` equals the site URL,
71
+ ignoring a trailing slash; on a free site that URL includes a path. Compare
72
+ only canonicals with `source` `TAG_SOURCE_DEFAULT_PATTERN`. Its path is `/`.
73
+ - `focusKeywords` with `isMain: true` is the focus keyword page optimization uses.
74
+ - The current title and description are the `title` tag and the `meta` tag named
75
+ `description` in `resolvedTags`; pass them as context, never present them as
76
+ suggestions.
77
+ - If `pagingMetadata.hasNext` is `true`, pass `pagingMetadata.cursors.next` as
78
+ `paging.cursor` on the next request until it is `false`.
79
+
80
+ The SEO Tags API names a site page `STATIC_PAGE`; the suggestion APIs name the
81
+ same page `STATIC_PAGE_V2`. Other item types are spelled the same in both:
82
+ `STORES_PRODUCT`, `BLOG_POST`, `BOOKINGS_SERVICE`. Any other string returns
83
+ `INVALID_ARGUMENT` with "expected itemType to be a seo supported item type".
84
+
85
+ ## Title and description suggestions
86
+
87
+ Both take the content in the request, so they work for any page, including one
88
+ the site does not have yet. Default `pageType` is `WEBSITE_PAGE`; use `HOMEPAGE`
89
+ for the homepage, `PRODUCT_PAGE`, `PRODUCT_CATEGORY_PAGE`, `BLOG_POST`,
90
+ `BLOG_CATEGORY_PAGE`, `SERVICE_BOOKING_PAGE`, `EVENT_PAGE`,
91
+ `RESTAURANT_MENU_PAGE`, `PORTFOLIO_PROJECT_PAGE`, or `OTHER_APP_PAGE` as fits.
92
+ `primaryKeyword` is the keyword the user wants the page to rank for; when the
93
+ user named none, use the page's `isMain` focus keyword if it has one.
94
+
95
+ [Generate Title Suggestions](https://dev.wix.com/docs/api-reference/business-management/seo/tag-suggestions-v1/generate-title-suggestions),
96
+ `pageName` required:
97
+
98
+ ```
99
+ POST https://www.wixapis.com/seo/suggestions/v1/tag-suggestions/title
100
+ ```
101
+
102
+ ```json
103
+ { "pageType": "HOMEPAGE", "pageName": "Home", "primaryKeyword": "boutique hotel santorini" }
104
+ ```
105
+
106
+ ```json
107
+ { "tagSuggestions": { "suggestions": [ "Experience Boutique Hotel Santorini Luxury and Charm | Luna", "Discover Boutique Hotel Santorini: Unique Stays & Stunning Views | Luna" ] } }
108
+ ```
109
+
110
+ [Generate Description Suggestions](https://dev.wix.com/docs/api-reference/business-management/seo/tag-suggestions-v1/generate-description-suggestions),
111
+ `pageName` and `topic` required; `primaryKeyword`, `toneOfVoice`,
112
+ `businessType`, `businessLocation`, and `pageContent` (the page's text, up to
113
+ 100,000 characters) are optional hints that may or may not appear in the text:
114
+
115
+ ```
116
+ POST https://www.wixapis.com/seo/suggestions/v1/tag-suggestions/description
117
+ ```
118
+
119
+ ```json
120
+ { "pageType": "HOMEPAGE", "pageName": "Home", "topic": "Boutique hotel in Santorini",
121
+ "primaryKeyword": "boutique hotel santorini", "toneOfVoice": "warm" }
122
+ ```
123
+
124
+ The response has the same `tagSuggestions.suggestions` shape. Both return best
125
+ match first, up to 10, often fewer: texts outside the target length or missing
126
+ the keyword are filtered out. Titles aim for 45 to 65 characters, descriptions
127
+ for 130 to 165. Send page content only in the free-text fields, never personal
128
+ data: they are sent to the AI model and written to service logs.
129
+
130
+ Applying a text is a separate write that needs the user's approval. Read the
131
+ page's current tags with
132
+ `GET https://www.wixapis.com/promote/seo/v1/item-seo-tags/STATIC_PAGE/{pageId}`,
133
+ merge the new `{ "type": "title", "children": "..." }` or
134
+ `{ "type": "meta", "props": { "name": "description", "content": "..." } }` into
135
+ the full `tags` array it returns, and send the whole array back with
136
+ `PATCH https://www.wixapis.com/promote/seo/v1/item-seo-tags/STATIC_PAGE/{pageId}`
137
+ and body `{ "itemSeoTags": { "tags": [ ... ] }, "fieldMask": "tags" }`. The
138
+ write replaces the page's tags in full, so a body holding only the new tag
139
+ deletes every other tag the page had. Static pages save to the draft unless the
140
+ body also has `"publish": true`. Full rules:
141
+ [Set Item SEO Tags](https://dev.wix.com/docs/api-reference/business-management/seo/item-seo-tags-v1/set-item-seo-tags).
142
+
143
+ ## Alt text suggestions
144
+
145
+ Alt text is generated only for images that belong to a Wix item, identified by
146
+ the item's ID and type; the item's stored SEO data gives the AI its context.
147
+ The image URL must be on a Wix media domain (`static.wixstatic.com` or another
148
+ `wixstatic.com` / `wixmp.com` host). Any other host fails the whole call with
149
+ `INVALID_ARGUMENT` on `image.url`: "Alt text can only be generated for
150
+ Wix-hosted images". Do not retry with the same URL.
151
+
152
+ For a store product, get the ID and image URLs from Query Products
153
+ (`POST https://www.wixapis.com/stores/v3/products/query` with
154
+ `{ "query": { "cursorPaging": { "limit": 20 } }, "fields": ["MEDIA_ITEMS_INFO"] }`):
155
+ each product's `id` is the `parentItemId`, and `media.itemsInfo.items[].image.url`
156
+ are its image URLs. For a site page, `parentItemId` is the page's `itemId` from
157
+ List Item SEO Tags (listed there under `STATIC_PAGE`), and the alt-text call's
158
+ `itemType` is `STATIC_PAGE_V2`.
159
+
160
+ [Generate Alt Text Suggestions](https://dev.wix.com/docs/api-reference/business-management/seo/tag-suggestions-v1/generate-alt-text-suggestions),
161
+ one image; `id` is your own label, echoed back:
162
+
163
+ ```
164
+ POST https://www.wixapis.com/seo/suggestions/v1/tag-suggestions/alt-text
165
+ ```
166
+
167
+ ```json
168
+ { "itemType": "STORES_PRODUCT",
169
+ "image": { "id": "main", "url": "https://static.wixstatic.com/media/22e53e_5a34c410f18f4760b451208652e8cf27~mv2.jpg",
170
+ "parentItemId": "7ef5f127-5e5d-4ebb-9957-d122ce56daec" } }
171
+ ```
172
+
173
+ ```json
174
+ { "altTextSuggestions": { "imageId": "main", "url": "https://static.wixstatic.com/media/22e53e_5a34c410f18f4760b451208652e8cf27~mv2.jpg",
175
+ "suggestions": [ "Ceramic flower vase with dried roses on a stone surface" ] } }
176
+ ```
177
+
178
+ [Bulk Generate Alt Text Suggestions](https://dev.wix.com/docs/api-reference/business-management/seo/tag-suggestions-v1/bulk-generate-alt-text-suggestions),
179
+ up to 20 images of the same `itemType` per call; split larger sets:
180
+
181
+ ```
182
+ POST https://www.wixapis.com/seo/suggestions/v1/tag-suggestions/alt-text-bulk
183
+ ```
184
+
185
+ ```json
186
+ { "itemType": "STORES_PRODUCT", "images": [
187
+ { "id": "main", "url": "https://static.wixstatic.com/media/22e53e_5a34c410f18f4760b451208652e8cf27~mv2.jpg", "parentItemId": "7ef5f127-5e5d-4ebb-9957-d122ce56daec" },
188
+ { "id": "second", "url": "https://static.wixstatic.com/media/22e53e_0a3fe4969636459b8fde2bde4bbe109d~mv2.jpg", "parentItemId": "7ef5f127-5e5d-4ebb-9957-d122ce56daec" } ] }
189
+ ```
190
+
191
+ ```json
192
+ { "results": [ { "imageId": "main", "success": true, "suggestions": [ "Dried roses in a matte ceramic flower vase on a stone ledge." ] },
193
+ { "imageId": "second", "success": true, "suggestions": [ "Minimalist matte beige ceramic flower vase" ] } ],
194
+ "successCount": 2, "failureCount": 0 }
195
+ ```
196
+
197
+ `results` follow request order. An entry with `success: false` has no
198
+ suggestions: retry that image alone with the single-image call, once. Up to 5
199
+ suggestions per image, often one. Report `failureCount` as returned. Applying
200
+ alt text happens in the product's or page's own settings, not through these APIs.
201
+
202
+ ## Heading structure suggestions
203
+
204
+ [Generate Heading Structure Suggestions](https://dev.wix.com/docs/api-reference/business-management/seo/tag-suggestions-v1/generate-heading-structure-suggestions)
205
+ takes the page's headings in page order, each with its raw HTML and your own
206
+ `id`; `sectionId` groups headings that belong to one section. It must be called
207
+ with a Wix user identity (a signed-in site owner or an app acting for one);
208
+ with an API key the call fails, by design, because the page title is read
209
+ through the site's accessibility analysis, which runs as the user.
210
+
211
+ ```
212
+ POST https://www.wixapis.com/seo/suggestions/v1/tag-suggestions/heading-structure
213
+ ```
214
+
215
+ ```json
216
+ { "pageId": "c1dmp", "itemType": "STATIC_PAGE_V2",
217
+ "headings": [ { "id": "hero", "htmlString": "<h1>Luna Boutique Hotel</h1>", "sectionId": "hero" },
218
+ { "id": "rooms", "htmlString": "<h3>Our rooms</h3>", "sectionId": "rooms" },
219
+ { "id": "rooms-suite", "htmlString": "<h4>Caldera suite</h4>", "sectionId": "rooms" },
220
+ { "id": "contact", "htmlString": "<h1>Contact us</h1>", "sectionId": "contact" } ] }
221
+ ```
222
+
223
+ ```json
224
+ { "suggestions": [ { "headingId": "rooms", "currentTag": "H3", "proposedTag": "H2" },
225
+ { "headingId": "rooms-suite", "currentTag": "H4", "proposedTag": "H3" },
226
+ { "headingId": "contact", "currentTag": "H1", "proposedTag": "H2" } ] }
227
+ ```
228
+
229
+ Only headings that should change are returned; an empty `suggestions` array
230
+ means the structure is already correct. `proposedTag` `P` means the text should
231
+ not be a heading. Up to 200 headings per call. The heading text comes from the
232
+ user or from the page content you already have; this recipe has no method that
233
+ fetches a page's headings.
234
+
235
+ ## Page optimization: trigger, then poll
236
+
237
+ Page optimization reads the page from the site's latest saved revision, so
238
+ unpublished edits count and the site need not be published. It needs two
239
+ things, checked in this order:
240
+
241
+ 1. **A Wix-rendered site.** Headless projects fail with `FAILED_PRECONDITION`,
242
+ code `SITE_NOT_SUPPORTED`. Stop and tell the user: nothing else in this
243
+ section can work on that site.
244
+ 2. **A focus keyword on the page** (`focusKeywords` entry with `isMain: true`
245
+ from List Item SEO Tags). Without one the trigger fails with
246
+ `FAILED_PRECONDITION`, code `FOCUS_KEYWORD_NOT_SET`. If the user named the
247
+ keyword they want the page to rank for, set it, then trigger; if they did
248
+ not, ask for it. The focus keyword is the input the job needs, not one of the
249
+ suggested changes: a user who says "optimize my page for X but don't apply
250
+ anything yet" still expects X to be set as the focus keyword, and only the
251
+ returned before/after texts to be held back. Setting it is a write to the
252
+ page's SEO settings:
253
+
254
+ ```
255
+ PATCH https://www.wixapis.com/promote/seo/v1/item-seo-tags/STATIC_PAGE/{pageId}
256
+ ```
257
+
258
+ ```json
259
+ { "itemSeoTags": { "focusKeywords": [ { "term": "handmade ceramic mugs", "isMain": true } ] }, "fieldMask": "focusKeywords" }
260
+ ```
261
+
262
+ The field mask limits the write to `focusKeywords`, so the page's tags are
263
+ untouched and no read is needed before this write: List Item SEO Tags already
264
+ returned the page's current `focusKeywords`, and the SEO Tags API's
265
+ read-before-write rule exists for the `tags` array, which this call does not
266
+ send. The response echoes the page with its new `focusKeywords`.
267
+
268
+ Then start one job. Use
269
+ [Trigger Home Page Optimization](https://dev.wix.com/docs/api-reference/business-management/seo/page-optimization-v1/trigger-home-page-optimization)
270
+ for the homepage (its text represents the whole site, so it gets its own
271
+ guidance) and
272
+ [Trigger Page Optimization](https://dev.wix.com/docs/api-reference/business-management/seo/page-optimization-v1/trigger-page-optimization)
273
+ for any other page. Both need a Wix user identity, like heading structure;
274
+ both take the page ID and its path:
275
+
276
+ ```
277
+ POST https://www.wixapis.com/seo/suggestions/v1/page-optimization/trigger-home
278
+ ```
279
+
280
+ ```json
281
+ { "pageId": "c1dmp", "pagePath": "/" }
282
+ ```
283
+
284
+ ```json
285
+ { "predictionId": "2247d724-1440-483d-bf66-f7edf8582a34" }
286
+ ```
287
+
288
+ Keep `predictionId`. Triggering the same page again while its job runs returns
289
+ the same `predictionId`, so a duplicate call is harmless, but do not send one on
290
+ purpose: each trigger is counted against the daily cap below. Then poll
291
+ [Get Page Optimization Results](https://dev.wix.com/docs/api-reference/business-management/seo/page-optimization-v1/get-page-optimization-results)
292
+ every few seconds until `status` leaves `IN_PROGRESS`; generation usually
293
+ finishes within two minutes:
294
+
295
+ ```
296
+ GET https://www.wixapis.com/seo/suggestions/v1/page-optimization/results?predictionId=2247d724-1440-483d-bf66-f7edf8582a34
297
+ ```
298
+
299
+ ```json
300
+ { "status": "IN_PROGRESS" }
301
+ ```
302
+
303
+ ```json
304
+ { "pageOptimization": {
305
+ "metaTitle": { "before": "Home | Luna", "after": "Jewelry Making Styles by Luna in New York City | Online" },
306
+ "metaDescription": { "before": "", "after": "Explore jewelry making styles from Luna in New York City – shop our online store today." },
307
+ "h1": { "before": "Luna & Loop", "after": "Artisanal Jewelry Making Styles by Luna & Loop" },
308
+ "h2OrH3": { "before": "Luna & Loop Jewelry", "after": "Luna & Loop Jewelry Making Styles" },
309
+ "content": [] },
310
+ "status": "COMPLETED" }
311
+ ```
312
+
313
+ - `COMPLETED`: present each pair as the current text and the proposed text. An
314
+ empty `before` means the page has no text in that slot yet (here, no meta
315
+ description). `content` lists body-text rewrites and can be empty.
316
+ - `FAILED`: the job failed; trigger once more, and if it fails again report it.
317
+ - `NOT_FOUND`: no job matches. The `predictionId` expires two hours after the
318
+ trigger, and a later trigger for the same page replaces the earlier job.
319
+ `GET .../page-optimization/results?pageId=c1dmp` returns the page's latest
320
+ completed set at any time, so use it when the user comes back later.
321
+ - Applying a pair is the user's decision. Title and description go through Set
322
+ Item SEO Tags as described above; headings and body text are edited in the
323
+ page itself, which these APIs cannot do.
324
+
325
+ ## Limits and errors
326
+
327
+ - Per-second limits: 5 requests per second per user for tag suggestions, 2 for
328
+ page optimization. A call rejected for rate limiting can be retried once after
329
+ a short pause.
330
+ - Per-user daily caps on `www.wixapis.com`: 200 title, 200 description, 500
331
+ alt-text, 100 bulk alt-text, and 50 page-optimization triggers per day. A `429`
332
+ means the cap for that method is spent: stop calling it and tell the user it
333
+ resets the next day. Do not switch to another method to get the same text.
334
+ - `403` or `PERMISSION_DENIED`: stop after the first one and report that the
335
+ current identity lacks the SEO permission (reads and generators need view
336
+ access to SEO settings, triggers and tag writes need manage access). Do not
337
+ try another site, path, method, or request shape: the same identity gets the
338
+ same answer.
339
+ - Heading structure or a trigger failing with an internal error or `403` under
340
+ an API key is the identity rule above, not an outage: say a Wix user identity
341
+ is required and stop.
342
+ - `FAILED_PRECONDITION`: read `details.applicationError.code`.
343
+ `FOCUS_KEYWORD_NOT_SET` and `SITE_NOT_SUPPORTED` are covered above;
344
+ `CONTENT_TOO_SHORT` means the page has too little text to optimize, so the user
345
+ must add content first; `SUGGESTIONS_ALREADY_IN_PROGRESS` means a job with a
346
+ different focus keyword is still running, so poll that page by `pageId` and
347
+ trigger again when it completes. None of these succeeds on retry.
348
+ - `GENERATION_FAILED` (`500`): the AI pipeline failed for this call; retry once,
349
+ then report.
350
+ - `INVALID_ARGUMENT` (`400`): fix the field named in `fieldViolations` and send
351
+ once more; never cycle through guessed shapes.