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

# Pobierz status tłumaczenia

> Sprawdź status projektu tłumaczeniowego i pobierz wyniki

# Pobierz status tłumaczenia

Pobierz aktualny status projektu tłumaczeniowego. Użyj tego punktu końcowego, aby sprawdzać postępy i uzyskać adres URL przetłumaczonego wideo po zakończeniu przetwarzania.

## Żądanie

### Nagłówki

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

Twój klucz API VoiceCheap. Uzyskaj go z [app.voicecheap.ai/page-api](https://app.voicecheap.ai/page-api).

### Parametry ścieżki

**projectId** `string` *required*

Unikalny identyfikator projektu tłumaczeniowego zwrócony z punktu końcowego [Start Translation](https://api-docs.voicecheap.ai/docs/pl/api-reference/translate.md).

> [!NOTE]
>
> Projekt utworzony przez [Utwórz projekt](https://api-docs.voicecheap.ai/docs/pl/api-reference/create-project.md) przechodzi do przepływu `translation`, gdy tylko zostanie wywołany [Dubbing projektu](https://api-docs.voicecheap.ai/docs/pl/api-reference/dub-project.md): ten endpoint śledzi wtedy najnowsze uruchomienie dubbingu.

## Odpowiedź

Struktura odpowiedzi różni się w zależności od statusu tłumaczenia.

### Wspólne pola

**projectId** `string` *required*

Unikalny identyfikator projektu

**projectName** `string` *required*

Nazwa projektu

**originalVideoUrl** `string` *required*

Adres URL oryginalnego przesłanego pliku wideo/audio

**originalLanguage** `string` *required*

Wykryty lub określony język oryginalny

**targetLanguage** `string` *required*

Język docelowy tłumaczenia

**duration** `number` *required*

Czas trwania zawartości w sekundach

**createdAt** `number` *required*

Znacznik czasu Unix utworzenia projektu

**workflow** `string` *required*

Przepływ pracy API, który utworzył projekt: `translation` lub `transcription`.

**transcriptionStatus** `string` *required*

Status transkrypcji źródłowej: `processing`, `success` lub `failed`. Ten sygnał jest niezależny od zakończenia procesu dubbing.

**transcripts** `object` *required*

Dostępne znormalizowane transkrypcje.

**właściwości transkrypcji**

**transcripts.original** `object | null`

Transkrypcja w języku oryginalnym, jeśli jest dostępna, zawierająca znaczniki czasu i mówców.

**transcripts.translations** `array`

Dostępne transkrypcje w języku docelowym, z językiem i identyfikatorami pracy. Przetłumaczone segmenty zawierają `finalSpeedFactor` po wygenerowaniu głosu (zobacz [Eksportuj transkrypcję projektu](https://api-docs.voicecheap.ai/docs/pl/api-reference/project-transcript.md)).

**workId** `string`

Identyfikator pracy tłumaczeniowej dla aktualnie raportowanej wersji przetłumaczonej.

**translatedVersionId** `string`

Identyfikator wersji przetłumaczonej dla aktualnie raportowanej wersji przetłumaczonej.

**actualProgressStep** `string`

Aktualny krok projektu. Podczas tworzenia lub transkrypcji odzwierciedla to aktywny krok tworzenia.
Przykłady obejmują `downloading_content`, `content_validation` oraz `transcription_processing`.
Gdy rozpocznie się dubbing, może on przełączyć się na aktywny krok dubbingu, taki jak `smart_sync` lub `audio_assembling`.
`status: processing` może występować razem z `actualProgressStep: done`, gdy trwa późniejszy etap, na przykład synchronizacja ruchu ust.

**translationAndTranscriptionProgress** `number`

Przybliżony procent postępu tworzenia/transkrypcji projektu (0-100)

**dubbingStep** `string`

Aktualny krok dubbingu dla języka docelowego (np. `smart_sync`, `audio_enhancement`, `video_upload`)

**dubbingProgress** `number`

Przybliżony procent postępu dubbingu (0-100)

**status** `string` *required*

Aktualny status tłumaczenia: `processing`, `success` lub `failed`

### Pola Lip Sync

Gdy zażądano synchronizacji ruchu ust (lip sync), odpowiedź zawiera dodatkowy obiekt `lipSync`:

**lipSync** `object`

Status synchronizacji ruchu ust i szczegóły wyjściowe (obecne tylko wtedy, gdy zażądano synchronizacji ruchu ust)

**właściwości lipSync**

**lipSync.jobId** `string`

Identyfikator zadania synchronizacji ruchu ust

**lipSync.status** `string`

Status synchronizacji ruchu ust: `PENDING`, `PROCESSING`, `COMPLETED`, `FAILED`, `REJECTED` lub `CANCELED`

**lipSync.videoUrl** `string`

Adres URL wideo z synchronizacją ruchu ust. Użyj tego adresu URL dla końcowego wyniku z synchronizacją ruchu ust, gdy `lipSync.status` to `COMPLETED`.

**lipSync.errorMessage** `string | null`

Stały komunikat błędu VoiceCheap lub null, jeśli nie zapisano błędu.

**lipSync.type** `string`

Tryb synchronizacji ruchu ust: `standard`, `pro` lub `studio`.

**lipSync.createdAt** `string`

Znacznik czasu ISO utworzenia próby synchronizacji ruchu ust.

**lipSync.requestedAt** `string`

Znacznik czasu ISO żądania próby synchronizacji ruchu ust, jeśli jest dostępny.

**lipSync.completedAt** `string`

Znacznik czasu ISO zakończenia synchronizacji ruchu ust, jeśli jest dostępny.

**lipSync.failedAt** `string`

Znacznik czasu ISO niepowodzenia synchronizacji ruchu ust, jeśli jest dostępny.

**lipSync.timedOutAt** `string`

Znacznik czasu ISO, kiedy upłynął limit czasu synchronizacji ruchu ust, jeśli jest dostępny.

**lipSync.activeSpeakerDetectionEnabled** `boolean`

Czy wykrywanie aktywnego mówcy było włączone dla tej próby synchronizacji ruchu ust.

> [!NOTE]
>
> Gdy żądana jest synchronizacja ruchu ust, tłumaczenie pozostaje w `processing`, dopóki `lipSync.status` nie zostanie `COMPLETED`. Jeśli synchronizacja ruchu ust nie powiedzie się, status zmienia się na
> `failed`, a `error.code` to `LIPSYNC_FAILED`. Gdy synchronizacja ruchu ust zakończy się powodzeniem, odczytaj zasób z synchronizacją ruchu ust z `lipSync.videoUrl`; `translatedVideoUrl`
> to przetłumaczony plik wideo przed nałożeniem synchronizacji ruchu ust.

> [!TIP]
>
> Użyj `GET /v1/projects/{projectId}`, gdy potrzebujesz pełnej historii wersji tłumaczenia lub pełnej historii synchronizacji ruchu ust.

### Pola odpowiedzi o sukcesie

W przypadku przepływów pracy tłumaczenia, następujące pola są uwzględniane, gdy `status` to `success`. Przepływ pracy obejmujący tylko transkrypcję osiąga `success` bez pól przetłumaczonych mediów.

**translatedVideoUrl** `string`

URL do pobrania przetłumaczonego pliku wideo

**translatedAudioUrl** `string`

URL do pobrania przetłumaczonego pliku audio osobno

### Pola odpowiedzi o błędzie

Gdy `status` to `failed`, uwzględniane jest następujące dodatkowe pole:

**error** `object`

Szczegóły błędu

**właściwości błędu**

**error.code** `string`

Kod błędu czytelny dla maszyny

**error.message** `string`

Opis błędu czytelny dla człowieka

## Przykłady

```bash cURL theme={null}
curl -X GET "https://api.voicecheap.ai/v1/translate/abc123-def456-ghi789/status" \
  -H "x-api-key: vc_your-api-key"
```

```typescript TypeScript theme={null}
type TranslationStatus = 'processing' | 'success' | 'failed';

interface Transcript {
  source: 'original' | 'translated';
  language: string;
  text: string;
  segments: Array<{
    index: number;
    text: string;
    begin: number;
    end: number;
    speaker: number;
  }>;
}

interface TranslationStatusBase {
  projectId: string;
  projectName: string;
  originalVideoUrl: string;
  originalLanguage: string;
  targetLanguage: string;
  duration: number;
  createdAt: number;
  workflow: 'translation' | 'transcription';
  transcriptionStatus: TranslationStatus;
  transcripts: {
    original: Transcript | null;
    translations: Transcript[];
  };
  workId?: string;
  translatedVersionId?: string;
  actualProgressStep?: string;
  translationAndTranscriptionProgress?: number;
  dubbingStep?: string;
  dubbingProgress?: number;
  lipSync?: {
    jobId: string;
    status: 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'REJECTED' | 'CANCELED';
    videoUrl: string;
    errorMessage: string | null;
    type: 'standard' | 'pro' | 'studio';
    createdAt?: string;
    requestedAt?: string;
    completedAt?: string;
    failedAt?: string;
    timedOutAt?: string;
    activeSpeakerDetectionEnabled?: boolean;
  };
}

interface TranslationStatusProcessing extends TranslationStatusBase {
  status: 'processing';
}

interface TranslationStatusSuccess extends TranslationStatusBase {
  status: 'success';
  translatedVideoUrl?: string;
  translatedAudioUrl?: string;
}

interface TranslationStatusFailed extends TranslationStatusBase {
  status: 'failed';
  error: {
    code: string;
    message: string;
  };
}

type TranslationStatusResponse = TranslationStatusProcessing | TranslationStatusSuccess | TranslationStatusFailed;

async function getTranslationStatus(projectId: string): Promise<TranslationStatusResponse> {
  const response = await fetch(`https://api.voicecheap.ai/v1/translate/${projectId}/status`, {
    method: 'GET',
    headers: {
      'x-api-key': 'vc_your-api-key',
    },
  });

  if (!response.ok) {
    const error = await response.json();
    throw new Error(error.message || 'Failed to get status');
  }

  return response.json();
}

// Polling function with typed response handling
async function pollUntilComplete(projectId: string, intervalMs: number = 10000): Promise<TranslationStatusSuccess> {
  while (true) {
    const status = await getTranslationStatus(projectId);

    if (status.status === 'success') {
      return status;
    }

    if (status.status === 'failed') {
      throw new Error(`Translation failed: ${status.error.message}`);
    }

    console.log('Still processing...');
    await new Promise((resolve) => setTimeout(resolve, intervalMs));
  }
}

// Usage
try {
  const result = await pollUntilComplete('abc123-def456-ghi789');
  console.log('Translated video:', result.translatedVideoUrl);
  console.log('Translated audio:', result.translatedAudioUrl);
} catch (error) {
  console.error('Error:', error);
}
```

```javascript JavaScript theme={null}
const response = await fetch('https://api.voicecheap.ai/v1/translate/abc123-def456-ghi789/status', {
  method: 'GET',
  headers: {
    'x-api-key': 'vc_your-api-key',
  },
});

const status = await response.json();

if (status.status === 'success') {
  console.log('Translated video:', status.translatedVideoUrl);
} else if (status.status === 'processing') {
  console.log('Still processing...');
} else if (status.status === 'failed') {
  console.error('Translation failed:', status.error.message);
}
```

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

headers = {'x-api-key': 'vc_your-api-key'}
project_id = 'abc123-def456-ghi789'

# Poll until complete
while True:
    response = requests.get(
        f'https://api.voicecheap.ai/v1/translate/{project_id}/status',
        headers=headers
    )
    status = response.json()

    if status['status'] == 'success':
        print(f"Translated video: {status['translatedVideoUrl']}")
        print(f"Translated audio: {status['translatedAudioUrl']}")
        break
    elif status['status'] == 'failed':
        print(f"Translation failed: {status['error']['message']}")
        break
    else:
        print("Still processing...")
        time.sleep(10)  # Wait 10 seconds before polling again
```

```php PHP theme={null}
<?php
$apiKey = 'vc_your-api-key';
$projectId = 'abc123-def456-ghi789';

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.voicecheap.ai/v1/translate/{$projectId}/status",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "x-api-key: {$apiKey}"
    ]
]);

$response = curl_exec($curl);
$status = json_decode($response, true);

switch ($status['status']) {
    case 'success':
        echo "Translated video: " . $status['translatedVideoUrl'] . "\n";
        echo "Translated audio: " . $status['translatedAudioUrl'];
        break;
    case 'processing':
        echo "Still processing...";
        break;
    case 'failed':
        echo "Failed: " . $status['error']['message'];
        break;
}
```

## Przykłady odpowiedzi

### Status przetwarzania

```json theme={null}
{
  "projectId": "abc123-def456-ghi789",
  "projectName": "My Spanish Translation",
  "originalVideoUrl": "https://storage.voicecheap.ai/...",
  "originalLanguage": "en",
  "targetLanguage": "spanish",
  "duration": 125.5,
  "createdAt": 1702234567890,
  "workflow": "translation",
  "transcriptionStatus": "processing",
  "transcripts": { "original": null, "translations": [] },
  "actualProgressStep": "downloading_content",
  "translationAndTranscriptionProgress": 11,
  "dubbingStep": "smart_sync",
  "dubbingProgress": 30,
  "status": "processing"
}
```

### Status przetwarzania (Lip Sync żądane)

```json theme={null}
{
  "projectId": "abc123-def456-ghi789",
  "projectName": "My Spanish Translation",
  "originalVideoUrl": "https://storage.voicecheap.ai/...",
  "originalLanguage": "en",
  "targetLanguage": "spanish",
  "duration": 125.5,
  "createdAt": 1702234567890,
  "workflow": "translation",
  "transcriptionStatus": "success",
  "transcripts": { "original": null, "translations": [] },
  "actualProgressStep": "finalizing",
  "translationAndTranscriptionProgress": 95,
  "dubbingStep": "video_upload",
  "dubbingProgress": 95,
  "status": "processing",
  "lipSync": {
    "jobId": "syncjob_123",
    "status": "PROCESSING",
    "videoUrl": "",
    "errorMessage": null,
    "type": "standard"
  }
}
```

### Status sukcesu

```json theme={null}
{
  "projectId": "abc123-def456-ghi789",
  "projectName": "My Spanish Translation",
  "originalVideoUrl": "https://storage.voicecheap.ai/...",
  "originalLanguage": "en",
  "targetLanguage": "spanish",
  "duration": 125.5,
  "createdAt": 1702234567890,
  "workflow": "translation",
  "transcriptionStatus": "success",
  "transcripts": { "original": null, "translations": [] },
  "status": "success",
  "translatedVideoUrl": "https://storage.voicecheap.ai/translated/...",
  "translatedAudioUrl": "https://storage.voicecheap.ai/audio/..."
}
```

### Status sukcesu (Lip Sync ukończone)

```json theme={null}
{
  "projectId": "abc123-def456-ghi789",
  "projectName": "My Spanish Translation",
  "originalVideoUrl": "https://storage.voicecheap.ai/...",
  "originalLanguage": "en",
  "targetLanguage": "spanish",
  "duration": 125.5,
  "createdAt": 1702234567890,
  "workflow": "translation",
  "transcriptionStatus": "success",
  "transcripts": { "original": null, "translations": [] },
  "actualProgressStep": "done",
  "dubbingStep": "done",
  "dubbingProgress": 100,
  "status": "success",
  "translatedVideoUrl": "https://storage.voicecheap.ai/translated/...",
  "translatedAudioUrl": "https://storage.voicecheap.ai/audio/...",
  "lipSync": {
    "jobId": "syncjob_123",
    "status": "COMPLETED",
    "videoUrl": "https://storage.voicecheap.ai/lipsync/...",
    "errorMessage": null,
    "type": "pro"
  }
}
```

### Status błędu

```json theme={null}
{
  "projectId": "abc123-def456-ghi789",
  "projectName": "My Spanish Translation",
  "originalVideoUrl": "https://storage.voicecheap.ai/...",
  "originalLanguage": "en",
  "targetLanguage": "spanish",
  "duration": 125.5,
  "createdAt": 1702234567890,
  "workflow": "translation",
  "transcriptionStatus": "failed",
  "transcripts": { "original": null, "translations": [] },
  "status": "failed",
  "error": {
    "code": "TRANSCRIPTION_FAILED",
    "message": "The transcription could not be completed. Please try again."
  }
}
```

## Najlepsze praktyki odpytywania

> [!NOTE]
>
> **Zalecany interwał odpytywania:** 10-30 sekund
>
> Czas tłumaczenia różni się w zależności od długości i złożoności wideo. W przypadku typowego 2-minutowego wideo należy oczekiwać 2-5 minut czasu przetwarzania.

> [!WARNING]
>
> **Limit szybkości:** 30 żądań na minutę
>
> Unikaj odpytywania częściej niż raz na 2 sekundy, aby pozostać w granicach limitów szybkości.

## Błędy

| Status | Kod | Opis |
| - | - | - |
| 401 | `INVALID_API_KEY` | Podany klucz API jest nieprawidłowy |
| 403 | `FORBIDDEN` | Nie masz dostępu do tego projektu |
| 404 | `PROJECT_NOT_FOUND` | Określony projekt nie istnieje |
| 429 | `RATE_LIMIT_EXCEEDED` | Zbyt wiele żądań (limit: 30 żądań na minutę) |


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