> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# GenerateAltTextSuggestions

# Package: seo

# Namespace: TagsSuggestionsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/seo/tag-suggestions-v1/generate-alt-text-suggestions.md

## Permission Scopes:
View SEO Settings: SCOPE.PROMOTE.VIEW-SEO

## Introduction

Generates alt text suggestions for a single image of a Wix-managed item.

The image must be Wix-hosted media and belong to a Wix-managed item, such
as a site page or a store product, identified by `image.parentItemId` and
`itemType`. That item's stored SEO data gives the AI context about what
the image is for. This method can't generate alt text for an arbitrary
image URL with no owning item.

Returns up to 5 ready-to-use alt texts in the site's language.

To generate alt text for up to 20 images in a single call, call
[Bulk Generate Alt Text Suggestions](https://dev.wix.com/docs/api-reference/business-management/seo/tag-suggestions-v1/bulk-generate-alt-text-suggestions.md).

---

## REST API

### Schema

```
 Method: generateAltTextSuggestions
 Description: Generates alt text suggestions for a single image of a Wix-managed item.  The image must be Wix-hosted media and belong to a Wix-managed item, such as a site page or a store product, identified by `image.parentItemId` and `itemType`. That item's stored SEO data gives the AI context about what the image is for. This method can't generate alt text for an arbitrary image URL with no owning item.  Returns up to 5 ready-to-use alt texts in the site's language.  To generate alt text for up to 20 images in a single call, call [Bulk Generate Alt Text Suggestions](https://dev.wix.com/docs/api-reference/business-management/seo/tag-suggestions-v1/bulk-generate-alt-text-suggestions.md).
 URL: https://www.wixapis.com/seo/suggestions/v1/tag-suggestions/alt-text
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  image, itemType
 Method parameters: 
   param name: image | type: ImageReference | description: An image of a Wix-managed item, identified for alt text generation. | required: true 
        - name: id | type: string | description: Your reference GUID for the image. Echoed back in the result so you can match suggestions to images. It isn't interpreted.  | validation: maxLength 1000
        - name: url | type: string | description: URL of the image file. Must be Wix-hosted media, meaning a URL on a Wix media domain such as `static.wixstatic.com`. Other hosts are rejected.  | validation: maxLength 1000, format WEB_URL
        - name: parentItemId | type: string | description: GUID of the Wix item the image belongs to, for example, a page GUID or a store product GUID, matching the request's `itemType`.  | validation: maxLength 100
   param name: itemType | type: itemType | description: Type of the Wix item the image belongs to, as an SEO item type identifier. For example, `STATIC_PAGE_V2` for a regular site page, `STORES_PRODUCT` for a store product, or `BLOG_POST` for a blog post. Other values are rejected. | required: true | validation: minLength 1, maxLength 100
 Return type: GenerateAltTextSuggestionsResponse
  - name: altTextSuggestions | type: AltTextSuggestions | description: The generated alt text suggestions.  
     - name: imageId | type: string | description: Your reference GUID for the image, echoed from the request.  | read-only: true | validation: maxLength 1000
     - name: url | type: string | description: URL of the image, echoed from the request.  | read-only: true | validation: maxLength 1000
     - name: suggestions | type: array<string> | description: Suggested alt texts, best match first.  | read-only: true | validation: maxItems 5, maxLength 1000

 Possible Errors:
   HTTP Code: 429 | Status Code: RESOURCE_EXHAUSTED | Application Code: QUOTA_LIMIT_REACHED | Description: The caller's generation quota is exhausted. Reserved for future metering and not currently returned.
   HTTP Code: 500 | Status Code: INTERNAL | Application Code: GENERATION_FAILED | Description: The AI generation pipeline failed. Retry the call.


```

### Examples

### Generate alt text for a store product image
The image is Wix-hosted media that belongs to a store product, so `parentItemId` is the product ID and `itemType` is `STORES_PRODUCT`.

```curl
curl -X POST \
'https://www.wixapis.com/seo/suggestions/v1/tag-suggestions/alt-text' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "itemType": "STORES_PRODUCT",
  "image": {
    "id": "main-image",
    "url": "https://static.wixstatic.com/media/11062b_5f0a1e4d2c8b4e7f9a3c6d1e8b2f4a7c~mv2.jpg",
    "parentItemId": "37915fe9-4975-4fcd-9703-e2790a5a31a5"
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.seo.tagSuggestions.generateAltTextSuggestions(image, options)
 Description: Generates alt text suggestions for a single image of a Wix-managed item.  The image must be Wix-hosted media and belong to a Wix-managed item, such as a site page or a store product, identified by `image.parentItemId` and `itemType`. That item's stored SEO data gives the AI context about what the image is for. This method can't generate alt text for an arbitrary image URL with no owning item.  Returns up to 5 ready-to-use alt texts in the site's language.  To generate alt text for up to 20 images in a single call, call [Bulk Generate Alt Text Suggestions](https://dev.wix.com/docs/api-reference/business-management/seo/tag-suggestions-v1/bulk-generate-alt-text-suggestions.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  image, options.itemType, options
 Method parameters: 
   param name: image | type: ImageReference | description: An image of a Wix-managed item, identified for alt text generation. | required: true 
        - name: _id | type: string | description: Your reference GUID for the image. Echoed back in the result so you can match suggestions to images. It isn't interpreted.  | validation: maxLength 1000
        - name: url | type: string | description: URL of the image file. Must be Wix-hosted media, meaning a URL on a Wix media domain such as `static.wixstatic.com`. Other hosts are rejected.  | validation: maxLength 1000, format WEB_URL
        - name: parentItemId | type: string | description: GUID of the Wix item the image belongs to, for example, a page GUID or a store product GUID, matching the request's `itemType`.  | validation: maxLength 100
   param name: options | type: GenerateAltTextSuggestionsOptions  none | required: true 
        - name: itemType | type: string | description: Type of the Wix item the image belongs to, as an SEO item type identifier. For example, `STATIC_PAGE_V2` for a regular site page, `STORES_PRODUCT` for a store product, or `BLOG_POST` for a blog post. Other values are rejected. | required: true | validation: minLength 1, maxLength 100
 Return type: PROMISE<GenerateAltTextSuggestionsResponse>
  - name: altTextSuggestions | type: AltTextSuggestions | description: The generated alt text suggestions.  
     - name: imageId | type: string | description: Your reference GUID for the image, echoed from the request.  | read-only: true | validation: maxLength 1000
     - name: url | type: string | description: URL of the image, echoed from the request.  | read-only: true | validation: maxLength 1000
     - name: suggestions | type: array<string> | description: Suggested alt texts, best match first.  | read-only: true | validation: maxItems 5, maxLength 1000

 Possible Errors:
   HTTP Code: 429 | Status Code: RESOURCE_EXHAUSTED | Application Code: QUOTA_LIMIT_REACHED | Description: The caller's generation quota is exhausted. Reserved for future metering and not currently returned.
   HTTP Code: 500 | Status Code: INTERNAL | Application Code: GENERATION_FAILED | Description: The AI generation pipeline failed. Retry the call.


```

### Examples

### Generate alt text for a store product image
The image is Wix-hosted media that belongs to a store product, so `parentItemId` is the product ID and `itemType` is `STORES_PRODUCT`.

```javascript
import { tagSuggestions } from "@wix/seo";

async function generateAltTextSuggestions() {
  const response = await tagSuggestions.generateAltTextSuggestions(
    {
      _id: "main-image",
      url: "https://static.wixstatic.com/media/11062b_5f0a1e4d2c8b4e7f9a3c6d1e8b2f4a7c~mv2.jpg",
      parentItemId: "37915fe9-4975-4fcd-9703-e2790a5a31a5",
    },
    {
      itemType: "STORES_PRODUCT",
    },
  );
}

/* Promise resolves to:
 * {
 *   "altTextSuggestions": {
 *     "imageId": "main-image",
 *     "url": "https://static.wixstatic.com/media/11062b_5f0a1e4d2c8b4e7f9a3c6d1e8b2f4a7c~mv2.jpg",
 *     "suggestions": [
 *       "White classic cotton t-shirt laid flat on a wooden table",
 *       "Classic white t-shirt with a crew neck, front view",
 *       "Unisex white cotton t-shirt from the Classic collection"
 *     ]
 *   }
 * }
 */

```

### generateAltTextSuggestions (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { tagSuggestions } from '@wix/seo';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { tagSuggestions },
  // Include the auth strategy and host as relevant
});


async function generateAltTextSuggestions(image,options) {
  const response = await myWixClient.tagSuggestions.generateAltTextSuggestions(image,options);
};
```

---