Introduction
The Alt Magic API allows you to make aPOST
request to generate alt text for any image. You can configure parameters in the API request body or provide additional context for better results. The API automatically falls back from Gemini to OpenAI if needed, ensuring maximum reliability.
How It Works
- Create an API key in your Alt Magic dashboard
- Share your image with a publicly accessible URL
- Make a POST request to your personal Alt Magic endpoint
- Track the response and get your generated alt text
Setting Up Parameters
Required Parameters
image_url
- Publicly accessible URL of the imageuser_id
- Your unique identifier (email address)
Optional Parameters
blog_title
- Context for better alt text generationseo_keywords
- Keywords for SEO optimizationlanguage_code
- Language for the generated text (All supported languages →).
Language Support
The Alt Magic API supports 200+ languages for generating alt text. You can specify the desired language using thelanguage_code
parameter in your requests.
Popular Languages:
- English (
en
) - Default language (fallback) - Spanish (
es
) - Español - French (
fr
) - Français - German (
de
) - Deutsch - Chinese (
zh-CN
,zh-TW
) - 中文 - Japanese (
ja
) - 日本語 - Korean (
ko
) - 한국어 - Arabic (
ar
) - العربية - Hindi (
hi
) - हिन्दी - Portuguese (
pt
,pt-BR
) - Português
Getting Your API Endpoint
Your API endpoint is automatically assigned when you create your account: Base URL:https://api.altmagic.pro
Alt Text Generation: POST /v1/generate-alt-text-api
- Generate AI-powered alt text for images with automatic fallback from Gemini to OpenAI.
User Details: POST /v1/get-user-details-api
- Retrieve user account information including subscription plan and available credits.
Authentication
The Alt Magic API uses API key authentication to ensure secure access. When making requests, you must include your unique API key in thex-api-key
header. This key can be generated and managed from your Alt Magic dashboard. Keep your API key confidential and never expose it in client-side code or public repositories.
API Key: Include the x-api-key
header in your request for authentication (recommended for server-to-server integrations).
Rate Limits
Rate limits are applied per user to ensure fair usage:- Standard Rate Limit: 100 requests per minute
Error Handling
The API returns standard HTTP status codes with detailed error messages:Status Code | Meaning | Description |
---|---|---|
200 | Success | Request was successful |
400 | Bad Request | Validation errors in the request |
401 | Unauthorized | Authentication required |
403 | Forbidden | Insufficient credits |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | An error occurred on the server |
Example Response
Each API request returns immediate results with your generated alt text.Complete API Example
Next Steps
- Generate your API key - Step-by-step guide
- Read the endpoint documentation for detailed parameters