# API Key Generation
Source: https://docs.altmagic.pro/api-reference/api-key-generation
Learn how to generate your first API key for Alt Magic API
Generate your first API key to start using the Alt Magic API. This guide walks you through the process step-by-step.
## 🚀 Quick Start
Your API key is your authentication credential for accessing the Alt Magic API. Follow these simple steps to create your first key.
## 📋 Step-by-Step Guide
### Step 1: Access Your Dashboard
1. **Go to** [app.altmagic.pro](https://app.altmagic.pro)
2. **Sign in** to your account (or create one if you don't have it)
3. **Wait for** the dashboard to load
### Step 2: Navigate to API Section
1. **Look for** the left navigation menu
2. **Click on** "API" from the left navigation menu
3. **You'll see** the API management interface
### Step 3: Create Your API Key
1. **Click on** the "Create API Key" button
2. **Enter** the name you want to give to your API key
3. **Click** "Create" button
4. **Success!** Your API key is generated
## 🎥 Video Tutorial
Watch our step-by-step video guide for generating API keys:
[Watch on YouTube](https://www.youtube.com/watch?v=Fm0grW8zpKc)
## 🔑 What Happens Next
### After Creating Your API Key
1. **Copy the key immediately** - it won't be shown again
2. **Store it securely** in your environment variables
3. **Test your key** with a simple API call
4. **Start integrating** with your applications
### Your API Key Format
Your API key will look like this:
```
0a87fa05d42f5c66a9180ebe
```
**Important**: Keep this key secure and never share it publicly.
## 📊 API Key Management
### View Your Keys
* **Dashboard**: See all your API keys
* **Creation Date**: When each key was generated
* **Last Used**: Track key activity
* **Permissions**: View key capabilities
### Revoke Keys
1. **Navigate** to the API section
2. **Find** the key you want to revoke
3. **Click** "Delete" icon on the right of the key
4. **Confirm** the action

**⚠️ Warning**: Revoking a key immediately invalidates it.
## 🎯 Next Steps
Now that you have your API key:
1. **[Read the API introduction](/api-reference/introduction)** to understand the basics
2. **[Try the alt text endpoint](/api-reference/alt-text-generation)** to generate your first alt text
***
**Ready to start?** [Generate your API key now →](https://app.altmagic.pro)
# Generate Alt Text
Source: https://docs.altmagic.pro/api-reference/endpoints/generate-alt-text
api-reference/openapi.json post /v1/generate-alt-text-api
Generate descriptive alt text for images using AI with automatic fallback from Gemini to OpenAI
# Get User Details
Source: https://docs.altmagic.pro/api-reference/endpoints/get-user-details
api-reference/openapi.json post /v1/get-user-details-api
Retrieves user details including their current subscription plan and available credits
# API Introduction
Source: https://docs.altmagic.pro/api-reference/introduction
Get started with the Alt Magic API for generating AI-powered alt text
Use the Alt Magic REST API to programmatically generate descriptive, SEO-optimized alt text for images using advanced AI models with automatic fallback capabilities.
## Introduction
The Alt Magic API allows you to make a `POST` 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
1. **Create an API key** in your [Alt Magic dashboard](https://app.altmagic.pro)
2. **Share your image** either by:
* Providing a publicly accessible URL (`image_url`), or
* Uploading the image file directly as base64 data URI (`image_file`)
3. **Make a POST request** to your personal Alt Magic endpoint
4. **Track the response** and get your generated alt text
## Setting Up Parameters
### Required Parameters
* `user_id` - Your unique identifier (email address)
* Either `image_url` OR `image_file` - You must provide one of these:
* `image_url` - Publicly accessible URL of the image
* `image_file` - Image file in data URI format with base64 encoded image data (format: `data:image/[type];base64,[base64-data]`)
### Optional Parameters
* `blog_title` - Context for better alt text generation
* `seo_keywords` - Keywords for SEO optimization
* `language_code` - Language for the generated text ([All supported languages →](/api-reference/language-support)).
## Language Support
The Alt Magic API supports **200+ languages** for generating alt text. You can specify the desired language using the `language_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
[View complete language list →](/api-reference/language-support)
## 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 the `x-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).
```http theme={null}
x-api-key: YOUR_API_KEY_HERE
```
## 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.
```json theme={null}
{
"altText": "A close-up photo of a red apple on a wooden table with natural lighting",
"CreditsAvailable": 49,
"plan_type": "pro"
}
```
## Complete API Examples
### Option 1 (using image URL)
```bash theme={null}
curl -X POST "https://api.altmagic.pro/v1/generate-alt-text-api" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"image_url": "https://example.com/image.jpg",
"blog_title": "Healthy Eating Guide",
"seo_keywords": "healthy, food, nutrition, apples",
"language_code": "en",
"user_id": "user@example.com"
}'
```
### Option 2 (using image file)
```bash theme={null}
curl -X POST "https://api.altmagic.pro/v1/generate-alt-text-api" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"image_file": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAv/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAX/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABmX/9k=",
"user_id": "user123",
"blog_title": "Beautiful Sunset Over Mountains",
"seo_keywords": "sunset, mountains, nature, landscape, photography",
"language_code": "en"
}'
```
When using `image_file`, ensure your base64 data URI follows the format: `data:image/[type];base64,[base64-data]`. Supported image types include JPEG, PNG, GIF, and WebP.
## Next Steps
1. **[Generate your API key](/api-reference/api-key-generation)** - Step-by-step guide
2. **[Read the endpoint documentation](/api-reference/alt-text-generation)** for detailed parameters
Ready to get started? [Generate your first API key →](/api-reference/api-key-generation)
# Language Support
Source: https://docs.altmagic.pro/api-reference/language-support
Complete list of supported languages and their language codes for Alt Magic API
# Language Support
The Alt Magic API supports a wide range of languages for generating alt text. You can specify the desired language using the `language_code` parameter in your API requests.
## How to Use Language Codes
Include the `language_code` parameter in your API request body. If left empty or not provided, the API will automatically fallback to English (`en`):
```json theme={null}
{
"image_url": "https://example.com/image.jpg",
"user_id": "user@example.com",
"language_code": "es"
}
```
## Supported Languages
### A
* **Abkhaz** - `ab`
* **Acehnese** - `ace`
* **Acholi** - `ach`
* **Afrikaans** - `af`
* **Albanian** - `sq`
* **Alur** - `alz`
* **Amharic** - `am`
* **Arabic** - `ar`
* **Armenian** - `hy`
* **Assamese** - `as`
* **Awadhi** - `awa`
* **Aymara** - `ay`
* **Azerbaijani** - `az`
### B
* **Balinese** - `ban`
* **Bambara** - `bm`
* **Bashkir** - `ba`
* **Basque** - `eu`
* **Batak Karo** - `btx`
* **Batak Simalungun** - `bts`
* **Batak Toba** - `bbc`
* **Belarusian** - `be`
* **Bemba** - `bem`
* **Bengali** - `bn`
* **Betawi** - `bew`
* **Bhojpuri** - `bho`
* **Bikol** - `bik`
* **Bosnian** - `bs`
* **Breton** - `br`
* **Bulgarian** - `bg`
* **Buryat** - `bua`
### C
* **Cantonese** - `yue`
* **Catalan** - `ca`
* **Cebuano** - `ceb`
* **Chichewa (Nyanja)** - `ny`
* **Chinese (Simplified)** - `zh-CN`
* **Chinese (Traditional)** - `zh-TW`
* **Chuvash** - `cv`
* **Corsican** - `co`
* **Crimean Tatar** - `crh`
* **Croatian** - `hr`
* **Czech** - `cs`
### D
* **Danish** - `da`
* **Dinka** - `din`
* **Divehi** - `dv`
* **Dogri** - `doi`
* **Dombe** - `dov`
* **Dutch** - `nl`
* **Dzongkha** - `dz`
### E
* **English** - `en`
* **Esperanto** - `eo`
* **Estonian** - `et`
* **Ewe** - `ee`
### F
* **Fijian** - `fj`
* **Filipino (Tagalog)** - `fil`
* **Finnish** - `fi`
* **French** - `fr`
* **French (French)** - `fr-FR`
* **French (Canadian)** - `fr-CA`
* **Frisian** - `fy`
* **Fulfulde** - `ff`
### G
* **Ga** - `gaa`
* **Galician** - `gl`
* **Ganda (Luganda)** - `lg`
* **Georgian** - `ka`
* **German** - `de`
* **Greek** - `el`
* **Guarani** - `gn`
* **Gujarati** - `gu`
### H
* **Haitian Creole** - `ht`
* **Hakha Chin** - `cnh`
* **Hausa** - `ha`
* **Hawaiian** - `haw`
* **Hebrew** - `he`
* **Hiligaynon** - `hil`
* **Hindi** - `hi`
* **Hmong** - `hmn`
* **Hungarian** - `hu`
* **Hunsrik** - `hrx`
### I
* **Icelandic** - `is`
* **Igbo** - `ig`
* **Iloko** - `ilo`
* **Indonesian** - `id`
* **Irish** - `ga`
* **Italian** - `it`
### J
* **Japanese** - `ja`
* **Javanese** - `jv`
### K
* **Kannada** - `kn`
* **Kapampangan** - `pam`
* **Kazakh** - `kk`
* **Khmer** - `km`
* **Kiga** - `cgg`
* **Kinyarwanda** - `rw`
* **Kituba** - `ktu`
* **Konkani** - `gom`
* **Korean** - `ko`
* **Krio** - `kri`
* **Kurdish (Kurmanji)** - `ku`
* **Kurdish (Sorani)** - `ckb`
* **Kyrgyz** - `ky`
### L
* **Lao** - `lo`
* **Latgalian** - `ltg`
* **Latin** - `la`
* **Latvian** - `lv`
* **Ligurian** - `lij`
* **Limburgan** - `li`
* **Lingala** - `ln`
* **Lithuanian** - `lt`
* **Lombard** - `lmo`
* **Luo** - `luo`
* **Luxembourgish** - `lb`
### M
* **Macedonian** - `mk`
* **Maithili** - `mai`
* **Makassar** - `mak`
* **Malagasy** - `mg`
* **Malay** - `ms`
* **Malay (Jawi)** - `ms-Arab`
* **Malayalam** - `ml`
* **Maltese** - `mt`
* **Maori** - `mi`
* **Marathi** - `mr`
* **Meadow Mari** - `chm`
* **Meiteilon (Manipuri)** - `mni-Mtei`
* **Minang** - `min`
* **Mizo** - `lus`
* **Mongolian** - `mn`
* **Myanmar (Burmese)** - `my`
### N
* **Ndebele (South)** - `nr`
* **Nepalbhasa (Newari)** - `new`
* **Nepali** - `ne`
* **Northern Sotho (Sepedi)** - `nso`
* **Norwegian** - `no`
* **Nuer** - `nus`
### O
* **Occitan** - `oc`
* **Odia (Oriya)** - `or`
* **Oromo** - `om`
### P
* **Pangasinan** - `pag`
* **Papiamento** - `pap`
* **Pashto** - `ps`
* **Persian** - `fa`
* **Polish** - `pl`
* **Portuguese** - `pt`
* **Portuguese (Portugal)** - `pt-PT`
* **Portuguese (Brazil)** - `pt-BR`
* **Punjabi** - `pa`
* **Punjabi (Shahmukhi)** - `pa-Arab`
### Q
* **Quechua** - `qu`
### R
* **Romani** - `rom`
* **Romanian** - `ro`
* **Rundi** - `rn`
* **Russian** - `ru`
### S
* **Samoan** - `sm`
* **Sango** - `sg`
* **Sanskrit** - `sa`
* **Scots Gaelic** - `gd`
* **Serbian** - `sr`
* **Sesotho** - `st`
* **Seychellois Creole** - `crs`
* **Shan** - `shn`
* **Shona** - `sn`
* **Sicilian** - `scn`
* **Silesian** - `szl`
* **Sindhi** - `sd`
* **Sinhala (Sinhalese)** - `si`
* **Slovak** - `sk`
* **Slovenian** - `sl`
* **Somali** - `so`
* **Spanish** - `es`
* **Sundanese** - `su`
* **Swahili** - `sw`
* **Swati** - `ss`
* **Swedish** - `sv`
### T
* **Tajik** - `tg`
* **Tamil** - `ta`
* **Tatar** - `tt`
* **Telugu** - `te`
* **Tetum** - `tet`
* **Thai** - `th`
* **Tigrinya** - `ti`
* **Tsonga** - `ts`
* **Tswana** - `tn`
* **Turkish** - `tr`
* **Turkmen** - `tk`
* **Twi (Akan)** - `ak`
### U
* **Ukrainian** - `uk`
* **Urdu** - `ur`
* **Uyghur** - `ug`
* **Uzbek** - `uz`
### V
* **Vietnamese** - `vi`
### W
* **Welsh** - `cy`
### X
* **Xhosa** - `xh`
### Y
* **Yiddish** - `yi`
* **Yoruba** - `yo`
* **Yucatec Maya** - `yua`
### Z
* **Zulu** - `zu`
## Language Code Format
Language codes follow the ISO 639-1 standard for most languages, with some extended codes for regional variants:
* **Two-letter codes**: Most languages use standard two-letter codes (e.g., `en`, `es`, `fr`)
* **Extended codes**: Some languages have regional variants (e.g., `zh-CN`, `zh-TW`, `pt-BR`, `pt-PT`)
* **Three-letter codes**: Some less common languages use three-letter codes (e.g., `ace`, `ach`, `alz`)
## Example Usage
### Generate Alt Text in Spanish
```bash theme={null}
curl -X POST "https://api.altmagic.pro/v1/generate-alt-text-api" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"image_url": "https://example.com/image.jpg",
"user_id": "user@example.com",
"language_code": "es"
}'
```
### Generate Alt Text in French
```bash theme={null}
curl -X POST "https://api.altmagic.pro/v1/generate-alt-text-api" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"image_url": "https://example.com/image.jpg",
"user_id": "user@example.com",
"language_code": "fr"
}'
```
### Generate Alt Text in Japanese
```bash theme={null}
curl -X POST "https://api.altmagic.pro/v1/generate-alt-text-api" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"image_url": "https://example.com/image.jpg",
"user_id": "user@example.com",
"language_code": "ja"
}'
```
## Best Practices
1. **Always specify the language**: Use the `language_code` parameter to ensure alt text is generated in the desired language
2. **Consider your audience**: Choose the language that best serves your target audience
3. **Test with different languages**: Verify that the generated alt text is appropriate for each language
4. **Fallback behavior**: If `language_code` is not provided or left empty, the API automatically defaults to English (`en`)
5. **Invalid language codes**: If an unrecognized language code is provided, the API will also fallback to English
## Need Help?
If you have questions about language support or need assistance with specific languages, contact us at [advait@altmagic.pro](mailto:advait@altmagic.pro).