# Translate text

`POST /v1/speech-to-speech`

Translates text between spoken languages. Billed at $0.33 / min of spoken length.

## Headers

- `Authorization` (string, required): Bearer authentication of the form `Bearer <token>`, where the token is your API key (`sk-live-…` or `sk-test-…`).
- `Idempotency-Key` (string): Any unique string (up to 255 characters). A retry with the same key and body returns the first answer and is never charged twice. See [Idempotency](/docs/idempotency).

## Request body

- `text` (string, required): Up to 5,000 characters.
- `toLang` (string, required): ISO 639-1 target, e.g. `es`.
- `fromLang` (string): ISO 639-1 source. Detected when left out.
- `model` (enum): Defaults to `google-translate`. One of: `google-translate`.

## Response

Returns `data`:

- `translatedText` (string): The translation.
- `fromLang` (string): Source language, or `null`.
- `toLang` (string): Target language.

## Errors

- 400 Bad request: A required field is missing or a value is not allowed (`invalid_request`).
- 401 Unauthorized: The API key is missing or not valid (`invalid_api_key`).
- 402 Payment required: Your wallet does not have enough funds for this request (`insufficient_credits`). Nothing is charged.
- 413 Payload too large: `text` is longer than 5,000 characters (`text_too_long`). Nothing is charged.
- 429 Too many requests: You hit a rate limit. Wait for `Retry-After` seconds. See [Rate limits](/docs/rate-limits).

## Example request

```bash
curl https://api-staging.talksign.co/v1/speech-to-speech \
  -H "Authorization: Bearer $TALKSIGN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Where is the station?",
    "toLang": "es"
  }'
```

## Example response

```json
{
  "success": true,
  "data": {
    "translatedText": "¿Dónde está la estación?",
    "fromLang": "en",
    "toLang": "es"
  }
}
```
