# Getting started

Authenticate safely, make your first Lingopal API request, and choose the right workflow for text, files, media, documents, or subtitles.

URL: /guides/getting-started



Lingopal uses `X-API-Key` authentication. Text translation returns immediately; file-based workflows return a reusable `job_id` and run asynchronously.

## Authentication [#authentication]

Every public API request uses an `X-API-Key` header. Lingopal does not use bearer tokens for this API.

Store the key server-side in an environment variable:

```bash
export LINGOPAL_API_KEY="your-api-key"
```

Obtain, rotate, and revoke keys through the Lingopal dashboard or your account contact.

Keep API keys private:

* Never commit a key or put it in browser-side code.
* Keep `.env` files out of version control.
* Rotate a key immediately if it is exposed.
* Use separate keys for development and production when available.

A `401` response means the header is missing or the key is invalid. Confirm the header name is exactly `X-API-Key`, the environment variable is populated, and the key has not been revoked.

## Make your first request [#make-your-first-request]

With `LINGOPAL_API_KEY` set, translate one string:

```bash
curl https://api.lingopal.ai/v2/translate/text \
  -H "X-API-Key: $LINGOPAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"texts":["Hello world"],"target_language":"es"}'
```

## POST /v2/translate/text

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Translate text",
    "description": "Lingopal v2 public API for text translation, storage uploads, registered jobs, job workflows, and job outputs.",
    "version": "v2"
  },
  "servers": [
    {
      "url": "https://vod-api.lingopal-dev.com"
    }
  ],
  "security": [
    {
      "APIKeyHeader": []
    }
  ],
  "paths": {
    "/v2/translate/text": {
      "post": {
        "tags": [
          "Text Translation"
        ],
        "summary": "Translate text",
        "description": "Translates one to 100 text inputs with a shared target language and optional context. Use `GET /v2/languages/text` to list supported languages.",
        "operationId": "translateText",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TranslateTextRequest"
              },
              "examples": {
                "translateTextMinimal": {
                  "summary": "Translate text minimal",
                  "description": "Translate text with only the required text inputs and target language.",
                  "value": {
                    "texts": [
                      "Hello world",
                      "Welcome to Lingopal"
                    ],
                    "target_language": "es"
                  }
                },
                "translateTextWithOptions": {
                  "summary": "Translate text options",
                  "description": "Translate text with optional source language, context, and credit deduction control.",
                  "value": {
                    "texts": [
                      "Hello world",
                      "Welcome to Lingopal"
                    ],
                    "source_language": "en",
                    "target_language": "es",
                    "context": "Marketing landing page copy",
                    "deduct_credits": true
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Completed text translations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TextTranslationResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid authentication token."
          },
          "422": {
            "description": "Request validation error."
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    }
  },
  "tags": [
    {
      "name": "Text Translation",
      "description": "Translate text directly without creating a job."
    }
  ],
  "components": {
    "schemas": {
      "TranslateTextRequest": {
        "properties": {
          "texts": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "maxItems": 100,
            "minItems": 1,
            "title": "Texts",
            "description": "One to 100 source text inputs to translate. Aliases accepted: `text`, `content`.",
            "examples": [
              [
                "Hello world",
                "Welcome to Lingopal"
              ]
            ]
          },
          "target_language": {
            "type": "string",
            "minLength": 1,
            "title": "Target Language",
            "description": "Single target locale code. Use `GET /v2/languages/text` to list supported text translation languages. Alias accepted: `language`.",
            "examples": [
              "es"
            ]
          },
          "source_language": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Language",
            "description": "Optional source locale code. Use `GET /v2/languages/text` to list supported text translation languages. If omitted, Lingopal may auto-detect it.",
            "examples": [
              "en"
            ]
          },
          "context": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Context",
            "description": "Optional context to improve translation quality.",
            "examples": [
              "Marketing landing page copy"
            ]
          },
          "deduct_credits": {
            "type": "boolean",
            "title": "Deduct Credits",
            "description": "Whether this request should deduct credits. Alias accepted: `deduct_credits_flag`.",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "texts",
          "target_language"
        ],
        "title": "TranslateTextRequest"
      },
      "TextTranslationResponse": {
        "properties": {
          "workflow": {
            "type": "string",
            "const": "translate_text",
            "title": "Workflow",
            "default": "translate_text"
          },
          "status": {
            "type": "string",
            "const": "completed",
            "title": "Status",
            "default": "completed"
          },
          "translations": {
            "items": {
              "$ref": "#/components/schemas/TextTranslation"
            },
            "type": "array",
            "title": "Translations",
            "description": "Completed text translations."
          }
        },
        "type": "object",
        "required": [
          "translations"
        ],
        "title": "TextTranslationResponse",
        "examples": [
          {
            "status": "completed",
            "translations": [
              {
                "source_text": "Hello world",
                "target_language": "es",
                "translated_text": "Hola mundo"
              }
            ],
            "workflow": "translate_text"
          }
        ]
      },
      "TextTranslation": {
        "properties": {
          "source_text": {
            "type": "string",
            "title": "Source Text",
            "description": "Original source text."
          },
          "translated_text": {
            "type": "string",
            "title": "Translated Text",
            "description": "Translated text."
          },
          "target_language": {
            "type": "string",
            "title": "Target Language",
            "description": "Target locale code for this translation."
          }
        },
        "type": "object",
        "required": [
          "source_text",
          "translated_text",
          "target_language"
        ],
        "title": "TextTranslation"
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "in": "header",
        "name": "X-API-Key",
        "type": "apiKey"
      }
    }
  }
}
```

A successful response contains the translated text. For all request and response fields, use the [API Reference entry for translateText](/reference/text-translation/translateText).

## Choose a workflow [#choose-a-workflow]

| Goal                              | Start here                                                               |
| --------------------------------- | ------------------------------------------------------------------------ |
| Translate one to 100 text strings | [Translate text](/guides/translation/text)                               |
| Translate audio or video          | [Translate media](/guides/translation/media)                             |
| Translate a document              | [Translate documents](/guides/translation/documents)                     |
| Generate subtitle tracks          | [Generate subtitles](/guides/subtitles/generate)                         |
| Upload or register a file         | [Upload and register source files](/guides/uploads/choose-upload-method) |

For asynchronous workflows, save the returned `job_id`, start a workflow, and follow the [job lifecycle](/guides/jobs/job-lifecycle).
