Alt Text Generator AI API Documentation

Overview

Alt Text Generator AI provides a simple and powerful API for generating SEO-friendly alt text for images. This documentation covers the API endpoint that allows you to integrate alt text generation directly into any application, website, or content management system.

Base URL:

https://alttextgeneratorai.com/api/wp

Authentication

All API requests require authentication using your API key. You can obtain an API key by registering for an account at Alt Text Generator AI.

Each API key comes with 5 free credits upon signup. Once your free credits are exhausted, you will need to buy credits from one of our pricing plans (one time payment).

Endpoints

POST/api/wp

Generate Alt Text

Generates SEO-friendly alt text for an image URL.

Request Body

{
  "image": "https://example.com/path/to/image.jpg",
  "wpkey": "your-api-key"
}

Parameters

ParameterTypeRequiredDescription
imageStringYesThe URL of the image to generate alt text for
wpkeyStringYesYour API key for authentication

Response

On success, the API returns the generated alt text as a plain text string.

"A golden retriever puppy playing with a red ball in a green grassy park"

Status Codes

CodeDescription
200Success
401Unauthorized - Invalid API key or no credits remaining
500Server error

Platform Integrations

Alt Text Generator AI is designed to work with various platforms and content management systems. We offer ready-to-use integrations for popular platforms:

WordPress

Generate alt text for your WordPress media library

Learn more

Shopify

Enhance product images with SEO-friendly alt text

Learn more

Webflow

Add alt text to your Webflow site images

Learn more

Wix

Add alt text to your Wix site images

Learn more

Note:

Each image processed will consume one credit from your account. Make sure you have sufficient credits available.

Example Usage

cURL

curl -X POST https://alttextgeneratorai.com/api/wp \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://example.com/path/to/image.jpg",
    "wpkey": "your-api-key"
  }'

JavaScript (Fetch)

fetch('https://alttextgeneratorai.com/api/wp', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    image: 'https://example.com/path/to/image.jpg',
    wpkey: 'your-api-key'
  })
})
.then(response => response.text())
.then(altText => {
  console.log('Generated Alt Text:', altText);
})
.catch(error => {
  console.error('Error:', error);
});

PHP

<?php
$url = 'https://alttextgeneratorai.com/api/wp';
$data = array(
    'image' => 'https://example.com/path/to/image.jpg',
    'wpkey' => 'your-api-key'
);

$options = array(
    'http' => array(
        'header'  => "Content-type: application/json\r\n",
        'method'  => 'POST',
        'content' => json_encode($data)
    )
);

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

if ($result === FALSE) {
    // Handle error
} else {
    // $result contains the alt text
    echo "Generated Alt Text: " . $result;
}
?>

Python

import requests
import json

url = 'https://alttextgeneratorai.com/api/wp'
data = {
    'image': 'https://example.com/path/to/image.jpg',
    'wpkey': 'your-api-key'
}

response = requests.post(url, json=data)

if response.status_code == 200:
    alt_text = response.text
    print('Generated Alt Text:', alt_text)
else:
    print('Error:', response.text)

Rate Limits and Usage

Your API usage is limited by the number of free credits available on your account. Each API call consumes one credit.

To check your current usage and remaining credits, visit your dashboard.

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of a request:

When an error occurs, the response will contain a plain text message describing the error.

Support

If you have any questions or need assistance with the API, please contact our support team at balt1794@gmail.com.