API Endpoints
Explore the available endpoints in the AltTextAI API.
POST
/api/v1/generate
Generate alt text for images using our AI model. Supports three methods of providing images: file uploads, URLs, or base64 encoded images.
Request Formats
Method 1: File Upload
Use multipart/form-data to upload image files directly.
# Request
POST /api/v1/generate
Content-Type: multipart/form-data
{
"images": [file1, file2, ...], // Multiple files supported
"language": "en" // Optional, defaults to "en"
}
Method 2: Image URLs
Process images from URLs.
# Request
POST /api/v1/generate
Content-Type: application/json
{
"urls": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"language": "en" // Optional, defaults to "en"
}
Method 3: Base64 Encoded Image
Send base64 encoded image data.
# Request
POST /api/v1/generate
Content-Type: application/json
{
"image": "base64_encoded_image_data",
"language": "en" // Optional, defaults to "en"
}
Response Format
{
"success": true,
"results": [
{
"filename": "image1.jpg", // For file uploads
// or "url": "http://example.com/image1.jpg" // For URLs
"alt_text": "Generated alt text description",
"success": true
}
],
"credits_remaining": 95,
"processed_count": 1
}
Supported Languages
The API supports generating alt text in multiple languages:
- English (en)
- Spanish (es)
- French (fr)
- German (de)
- Italian (it)
- Portuguese (pt)
- Dutch (nl)
- Polish (pl)
- Russian (ru)
- Japanese (ja)
- Korean (ko)
- Chinese (zh)
GET
/api/v1/credits
Check your remaining API credits.
Response Format
{
"credits": 100,
"user_id": "your_user_id"
}
POST
/api/v1/verify-api-key
Verify if your API key is valid and get information about your account.
Response Format
{
"valid": true,
"user_id": "your_user_id",
"credits_remaining": 100
}
Error Handling
All endpoints follow the same error response format. For detailed information about error codes and handling, see our Error Documentation .
{
"error": "Error message description",
"results": [ // In case of partial failures
{
"filename": "image1.jpg",
"error": "Error processing this image",
"success": false
}
]
}