The ShopTag.ai API offers a reliable way to generate titles, descriptions, and keywords for your eCommerce product images. By automating the product tagging process, the API saves time and ensures consistent, high-quality metadata for your product catalog. This guide provides a detailed overview of how to use the ShopTag.ai API, including its features, request formats, and example code snippets.
API Overview
The ShopTag.ai API is designed to help eCommerce platforms, businesses, and developers automate the generation of SEO-friendly metadata for product images. This includes:
- Titles: Create concise, engaging product titles.
- Descriptions: Generate detailed and informative descriptions.
- Keywords: Produce relevant keywords to improve product discoverability.
API Endpoint
Endpoint URL:POST https://server.shoptag.ai/api/keywords
This endpoint accepts a product image and optional parameters to generate metadata. Each successful request consumes one product credit.
Request Details
- Authorization: Include your API token in the
Authorization
header. Example:Authorization: Bearer YOUR_API_TOKEN
- Request Time: Each request takes up to 30 seconds to process, depending on the file size.
- Rate Limit: The API allows one request per second.
Form Data Parameters
The API accepts the following parameters in the request body as Form Data:
Parameter | Required | Type | Description |
---|---|---|---|
file | Yes | File | The product image file (PNG, JPG, JPEG, WEBP, SVG). Must be less than 30MB. |
language | No | String | Language for metadata (default: en ). Supported: en , es , fr , de , etc. |
minKeywords | No | Integer | Minimum number of keywords (range: 5–40). |
maxKeywords | No | Integer | Maximum number of keywords (range: 5–200). Overrides minKeywords . |
requiredKeywords | No | String | Comma-separated list of keywords to include. |
excludedKeywords | No | String | Comma-separated list of keywords to exclude. |
customContext | No | String | Additional context to improve metadata relevance. |
prohibitedCharacters | No | String | Characters to exclude from titles, descriptions, and keywords. |
minDescriptionCharacters | No | Integer | Minimum characters in the description (range: 5–200). |
maxDescriptionCharacters | No | Integer | Maximum characters in the description (range: 50–500). Overrides minDescriptionCharacters . |
minTitleCharacters | No | Integer | Minimum characters in the title (range: 5–200). |
maxTitleCharacters | No | Integer | Maximum characters in the title (range: 50–500). Overrides minTitleCharacters . |
useFileNameForContext | No | Boolean | Use the file name as context for metadata generation. |
singleWordKeywordsOnly | No | Boolean | Restrict keywords to single words only. |
Example Responses
Success Response
{ "error": null, "data": { "title": "Teal Blue Weighted Blanket", "description": "This teal blue weighted blanket is perfect for sleeping.", "keywords": ["blanket", "weighted", "teal", "sleep", "cotton"] } }
Failure Response
{ "error": "There was no file uploaded", "data": null }
Example Code Snippets
CURL
curl -X POST https://server.shoptag.ai/api/keywords \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -F 'file=@path_to_image.jpg' \ -F 'language=en' \ -F 'maxKeywords=10' \ -F 'customContext=weighted blanket'
Python
import requests url = "https://server.shoptag.ai/api/keywords" headers = { "Authorization": "Bearer YOUR_API_TOKEN" } payload = { "language": "en", "maxKeywords": 10, "customContext": "weighted blanket" } files = { "file": open("path_to_image.jpg", "rb") } response = requests.post(url, headers=headers, data=payload, files=files) print(response.json())
PHP
<?php $url = "https://server.shoptag.ai/api/keywords"; $headers = [ "Authorization: Bearer YOUR_API_TOKEN" ]; $data = [ "file" => new CURLFile('path_to_image.jpg'), "language" => "en", "maxKeywords" => 10, "customContext" => "weighted blanket" ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); echo $response; ?>
Node.js
const axios = require('axios'); const FormData = require('form-data'); const fs = require('fs'); const url = "https://server.shoptag.ai/api/keywords"; const form = new FormData(); form.append('file', fs.createReadStream('path_to_image.jpg')); form.append('language', 'en'); form.append('maxKeywords', 10); form.append('customContext', 'weighted blanket'); axios.post(url, form, { headers: { ...form.getHeaders(), "Authorization": "Bearer YOUR_API_TOKEN" } }).then(response => { console.log(response.data); }).catch(error => { console.error(error); });
Frequently Asked Questions
How much does it cost?
Each API call uses one product credit. Credits start as low as $0.01 per credit.
Does it support multiple languages?
Yes, metadata can be generated in over 15 languages, including English, Spanish, French, German, and more.
Can I customize metadata generation?
Yes, you can use the customContext
parameter to provide specific instructions for the AI.
What file formats are supported?
The API supports PNG, JPG, JPEG, WEBP, and SVG files up to 30MB.
Can I restrict metadata length?
Yes, you can define minimum and maximum lengths for titles, descriptions, and keywords.
What is the response format?
The API returns a JSON object containing the generated title, description, and keywords or an error message if the request fails.
How do I get started?
Visit ShopTag.ai to generate your API access token and start automating your product tagging process.
By integrating the ShopTag.ai API into your eCommerce platform, you can streamline your workflow, enhance SEO, and improve product discoverability, all with minimal effort.