> ## Documentation Index
> Fetch the complete documentation index at: https://docs.submagic.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Languages

> Retrieve a list of all supported languages for video transcription

# Get Languages

Retrieve a comprehensive list of all supported languages for video transcription and caption generation. This endpoint returns language codes and names that can be used when creating projects.

> [!NOTE]
>
> This endpoint requires authentication and has a rate limit of 100 requests per
> minute.

## Authentication

**x-api-key** `string` *required*

Your Submagic API key starting with `sk-`

## Response

**languages** `array`

Array of supported language objects

**Language Object**

**name** `string`

Human-readable name of the language (e.g., "English", "Spanish")

**code** `string`

ISO language code used for API requests (e.g., "en", "es", "fr")

```bash cURL theme={null}
curl -X GET "https://api.submagic.co/v1/languages" \
  -H "x-api-key: sk-your-api-key-here"
```

```javascript JavaScript theme={null}
const response = await fetch("https://api.submagic.co/v1/languages", {
  headers: {
    "x-api-key": "sk-your-api-key-here",
  },
});

const data = await response.json();
console.log(data.languages);
```

```python Python theme={null}
import requests

headers = {
    'x-api-key': 'sk-your-api-key-here'
}

response = requests.get('https://api.submagic.co/v1/languages', headers=headers)
data = response.json()

for language in data['languages']:
    print(f"{language['name']}: {language['code']}")
```

```json Response theme={null}
{
  "languages": [
    {
      "name": "English",
      "code": "en"
    },
    {
      "name": "Spanish",
      "code": "es"
    },
    {
      "name": "French",
      "code": "fr"
    },
    {
      "name": "German",
      "code": "de"
    },
    {
      "name": "Italian",
      "code": "it"
    },
    {
      "name": "Portuguese",
      "code": "pt"
    },
    {
      "name": "Dutch",
      "code": "nl"
    },
    {
      "name": "Russian",
      "code": "ru"
    },
    {
      "name": "Chinese (Simplified)",
      "code": "zh"
    },
    {
      "name": "Japanese",
      "code": "ja"
    },
    {
      "name": "Korean",
      "code": "ko"
    },
    {
      "name": "Arabic",
      "code": "ar"
    },
    {
      "name": "Hindi",
      "code": "hi"
    }
  ]
}
```

## Popular Languages

Here are some of the most commonly used language codes:

> [card] English
>
> **Code:** `en` Most widely supported with highest accuracy

> [card] Spanish
>
> **Code:** `es` Excellent support for Latin American and European Spanish

> [card] French
>
> **Code:** `fr` High accuracy for both European and Canadian French

> [card] German
>
> **Code:** `de` Great support for German language nuances

> [card] Italian
>
> **Code:** `it` Optimized for Italian pronunciation patterns

> [card] Portuguese
>
> **Code:** `pt` Supports both Brazilian and European Portuguese

## Using Language Codes

Once you have the language codes, you can use them when creating projects:

```json theme={null}
{
  "title": "My Spanish Video",
  "language": "es",
  "videoUrl": "https://example.com/spanish-video.mp4"
}
```

## Best Practices

### Caching Language Data

Since the list of supported languages doesn't change frequently, consider caching the response:

```javascript theme={null}
class LanguageCache {
  constructor() {
    this.cache = null;
    this.lastFetch = null;
    this.cacheDuration = 24 * 60 * 60 * 1000; // 24 hours
  }

  async getLanguages() {
    const now = Date.now();

    if (
      this.cache &&
      this.lastFetch &&
      now - this.lastFetch < this.cacheDuration
    ) {
      return this.cache;
    }

    const response = await fetch("https://api.submagic.co/v1/languages", {
      headers: { "x-api-key": process.env.SUBMAGIC_API_KEY },
    });

    this.cache = await response.json();
    this.lastFetch = now;

    return this.cache;
  }
}
```

### Building Language Selectors

Create user-friendly language selection interfaces:

```javascript theme={null}
const buildLanguageSelector = (languages) => {
  return languages
    .sort((a, b) => a.name.localeCompare(b.name))
    .map((lang) => ({
      value: lang.code,
      label: lang.name,
      flag: getFlagEmoji(lang.code), // Helper function for flag emojis
    }));
};
```

## Error Responses

**401 Unauthorized** `object`

```json theme={null}
{
  "error": "UNAUTHORIZED",
  "message": "Invalid or missing API key"
}
```

**429 Rate Limited** `object`

```json theme={null}
{
  "error": "RATE_LIMIT_EXCEEDED",
  "message": "Too many requests",
  "retryAfter": 30
}
```

**500 Server Error** `object`

```json theme={null}
{
  "error": "INTERNAL_SERVER_ERROR",
  "message": "An unexpected error occurred"
}
```

> [!TIP]
>
> The language list is updated periodically as we add support for new languages.
> We recommend fetching this list dynamically rather than hard-coding language
> options in your application.

&#x20;


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.