Overview
The REST API gives you full programmatic access. Use standard HTTP requests — no client libraries needed.
Authentication
Include your API key in every authenticated request via the X-API-Key header:
X-API-Key: alt_YOUR_KEY_HERE
Get a key at altextapi.com/signup.
Endpoints
| Method | Path | Auth | Description |
|--------|------|------|-------------|
| POST | /api/register | — | Create account + get API key |
| POST | /api/login | — | Sign in, view key prefixes |
| POST | /api/forgot-password | — | Request password reset token |
| POST | /api/reset-password | — | Reset password with token |
| POST | /api/alt-text | X-API-Key | Generate alt text for an image |
| GET | /api/usage | X-API-Key | Check credits remaining |
| POST | /api/validate-key | — | Validate an API key |
| GET | /api/keys | X-API-Key | List your API keys |
| POST | /api/keys | X-API-Key | Create new API key |
| POST | /api/keys/revoke | X-API-Key | Revoke an API key |
| POST | /api/keys/rotate | X-API-Key | Rotate an API key |
Generate Alt Text
curl -X POST https://api.altextapi.com/api/alt-text \
-H "Content-Type: application/json" \
-H "X-API-Key: alt_YOUR_KEY" \
-d '{"image_url": "https://example.com/photo.jpg"}'
Response:
{
"alt_text": "A red fox stands alert on sandy dunes with dry grass and a blurred ocean horizon.",
"length": 112,
"language": "en",
"cached": false
}
JavaScript (fetch)
const res = await fetch("https://api.altextapi.com/api/alt-text", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "alt_YOUR_KEY",
},
body: JSON.stringify({ image_url: "https://example.com/photo.jpg" }),
});
const data = await res.json();
console.log(data.alt_text);
Python
import requests
res = requests.post(
"https://api.altextapi.com/api/alt-text",
headers={"Content-Type": "application/json", "X-API-Key": "alt_YOUR_KEY"},
json={"image_url": "https://example.com/photo.jpg"},
)
print(res.json()["alt_text"])
PHP
$ch = curl_init("https://api.altextapi.com/api/alt-text");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Content-Type: application/json", "X-API-Key: alt_YOUR_KEY"],
CURLOPT_POSTFIELDS => json_encode(["image_url" => "https://example.com/photo.jpg"]),
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
echo $data["alt_text"];
Account Management
Sign Up
curl -X POST https://api.altextapi.com/api/register \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "password": "YourPassword123"}'
Returns your API key immediately. Save it — it won't be shown again.
Sign In
curl -X POST https://api.altextapi.com/api/login \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "password": "YourPassword123"}'
Returns your active key prefixes and account info. Does not return full keys.
Password Reset
Request a token:
curl -X POST https://api.altextapi.com/api/forgot-password \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com"}'
Use the token to set a new password (this revokes all existing keys):
curl -X POST https://api.altextapi.com/api/reset-password \
-H "Content-Type: application/json" \
-d '{"token": "reset_token_here", "new_password": "NewPassword123"}'
Check Usage
curl https://api.altextapi.com/api/usage \
-H "X-API-Key: alt_YOUR_KEY"
Response:
{
"plan": "free",
"credits": { "total": 50, "used": 12, "remaining": 38 },
"api_calls_today": 5
}
Validate a Key
curl -X POST https://api.altextapi.com/api/validate-key \
-H "Content-Type: application/json" \
-d '{"api_key": "alt_KEY_TO_CHECK"}'
Rate Limits
| Endpoint | Limit |
|----------|-------|
| /api/alt-text | 60 req/min per IP |
| /api/login, /api/register, /api/forgot-password | 5 req/min per IP |
| Other endpoints | 60 req/min per IP |
If exceeded, HTTP 429 is returned. Spread batch processing across multiple seconds.
Supported Image Formats
JPG, PNG, GIF, WebP. Images up to 10 MB. Must be publicly accessible via HTTPS.