API Endpoint Access URL
https://api.pixlab.io/seotag
Get Your API Key & Try SEOTAG Now ↗Description
The SEOTAG API endpoint enables you to programmatically generate SEO-optimized alternative tags for your image content. It supports multiple languages and various image sizes. For complex image queries, consider using the QUERY or DESCRIBE API endpoints, as they offer more robust image content description capabilities.
HTTP Methods
GET, POST
HTTP Parameters
Required
Fields | Type | Description |
---|---|---|
img |
URL | URL of the input image for alternative tags generation in the event of a GET request. If you want to upload an image directly from your app, then submit a multipart/form-data POST request instead. Refer to the POST Request Data section below. |
key |
String | Your PixLab API Key ↗. You can also embed your key in the WWW-Authenticate: HTTP header and omit this parameter if you want to. |
Optional
Fields | Type | Description |
---|---|---|
lang |
String | Default to english to generate the alternative tag description. |
short |
Boolean | If this optional parameter is set to true , a brief alternative tag will be generated instead of a full, accurate text description. The default value is false . |
POST Request Body
This section details the requirements for using a POST request instead of a simple GET request.
Allowed Content-Types:
multipart/form-data
application/json
Use multipart/form-data
to directly upload your image from you app (see the REST API code samples or The PixLab Github Repository↗ for a working example). If you're using JSON, the media file must already be uploaded. Consider calling store to upload an image before invoking this endpoint.
HTTP Response
application/json
This endpoint always returns a JSON object containing image description data. Response fields include:
Fields | Type | Description |
---|---|---|
status |
Integer | HTTP 200 indicates success. Any other code indicates failure. |
tag |
String | AI-generated alternative tag describing the image content, provided in the selected language (defaults to English). |
error |
String | Error description when status != 200. |
Code Samples
import requests
import json
# Generate SEO optimized alternative tag for a given image content
# Target Image: Change to any link or switch to POST if you want to upload your image directly, refer to the REST API code samples for more info.
img = 'https://pixlab.io/assets/images/nature31.jpg'
key = 'PIXLAB_API_KEY' # Get your API key from https://console.pixlab.io/
req = requests.get('https://api.pixlab.io/seotag',params={
'img':img,
'key':key,
'lang':'english',
'short':False
})
reply = req.json()
if reply['status'] != 200:
print (reply['error'])
else:
text = reply['tag']
print(f"SEO Optimized Alternative tag: {text}")
// Generate SEO optimized alternative tag for a given image content
// Target Image: Change to any link or switch to POST if you want to upload your image directly, refer to the REST API code samples for more info.
const img = 'https://pixlab.io/assets/images/nature31.jpg';
const key = 'PIXLAB_API_KEY'; // Get your API key from https://console.pixlab.io/
fetch('https://api.pixlab.io/seotag', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
img: img,
key: key,
lang: 'english',
short: false
})
})
.then(response => response.json())
.then(reply => {
if (reply.status !== 200) {
console.log(reply.error);
} else {
const text = reply.tag;
console.log(`SEO Optimized Alternative tag: ${text}`);
}
})
.catch(error => console.error('Error:', error));
<?php
# Generate SEO optimized alternative tag for a given image content
# Target Image: Change to any link or switch to POST if you want to upload your image directly, refer to the REST API code samples for more info.
$img = 'https://pixlab.io/assets/images/nature31.jpg';
$key = 'PIXLAB_API_KEY'; // Get your API key from https://console.pixlab.io/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.pixlab.io/seotag?img=' . urlencode($img) . '&key=' . $key . '&lang=english&short=false');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$reply = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($reply['status'] != 200) {
echo $reply['error'];
} else {
$text = $reply['tag'];
echo "SEO Optimized Alternative tag: " . $text;
}
require 'net/http'
require 'json'
# Generate SEO optimized alternative tag for a given image content
# Target Image: Change to any link or switch to POST if you want to upload your image directly, refer to the REST API code samples for more info.
img = 'https://pixlab.io/assets/images/nature31.jpg'
key = 'PIXLAB_API_KEY' # Get your API key from https://console.pixlab.io/
uri = URI('https://api.pixlab.io/describe')
params = {
'img' => img,
'key' => key,
'lang' => 'english',
'short' => false
}
uri.query = URI.encode_www_form(params)
response = Net::HTTP.get_response(uri)
reply = JSON.parse(response.body)
if reply['status'] != 200
puts reply['error']
else
text = reply['tag']
puts "SEO Optimized Alternative tag: #{text}"
end
Similar API Endpoints
tagimg, seotag, img-embed, docscan, chat, text-embed, crop, mogrify, facelookup ↗, faceverify ↗, query