> ## 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

<ParamField header="x-api-key" type="string" required>
  Twój klucz API VoiceCheap. Uzyskaj go z [app.voicecheap.ai/page-api](https://app.voicecheap.ai/page-api).
</ParamField>

### Parametry ścieżki

<ParamField path="projectId" type="string" required>
  Unikalny identyfikator projektu tłumaczeniowego zwrócony z punktu końcowego [Start Translation](/docs/pl/api-reference/translate).
</ParamField>

## Odpowiedź

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

### Wspólne pola

<ResponseField name="projectId" type="string" required>
  Unikalny identyfikator projektu
</ResponseField>

<ResponseField name="projectName" type="string" required>
  Nazwa projektu
</ResponseField>

<ResponseField name="originalVideoUrl" type="string" required>
  Adres URL oryginalnego przesłanego pliku wideo/audio
</ResponseField>

<ResponseField name="originalLanguage" type="string" required>
  Wykryty lub określony język oryginalny
</ResponseField>

<ResponseField name="targetLanguage" type="string" required>
  Język docelowy tłumaczenia
</ResponseField>

<ResponseField name="duration" type="number" required>
  Czas trwania zawartości w sekundach
</ResponseField>

<ResponseField name="createdAt" type="number" required>
  Znacznik czasu Unix utworzenia projektu
</ResponseField>

<ResponseField name="workflow" type="string" required>
  Przepływ pracy API, który utworzył projekt: `translation` lub `transcription`.
</ResponseField>

<ResponseField name="transcriptionStatus" type="string" required>
  Status transkrypcji źródłowej: `processing`, `success` lub `failed`. Ten sygnał jest niezależny od zakończenia procesu dubbing.
</ResponseField>

<ResponseField name="transcripts" type="object" required>
  Dostępne znormalizowane transkrypcje.

  <Expandable title="właściwości transkrypcji">
    <ResponseField name="transcripts.original" type="object | null">
      Transkrypcja w języku oryginalnym, jeśli jest dostępna, zawierająca znaczniki czasu i mówców.
    </ResponseField>

    <ResponseField name="transcripts.translations" type="array">
      Dostępne transkrypcje w języku docelowym wraz z ich identyfikatorami języka i pracy.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="workId" type="string">
  Identyfikator pracy tłumaczeniowej dla aktualnie raportowanej wersji przetłumaczonej.
</ResponseField>

<ResponseField name="translatedVersionId" type="string">
  Identyfikator wersji przetłumaczonej dla aktualnie raportowanej wersji przetłumaczonej.
</ResponseField>

<ResponseField name="actualProgressStep" type="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` nie łączy się z `actualProgressStep: done`.
</ResponseField>

<ResponseField name="translationAndTranscriptionProgress" type="number">
  Przybliżony procent postępu tworzenia/transkrypcji projektu (0-100)
</ResponseField>

<ResponseField name="dubbingStep" type="string">
  Aktualny krok dubbingu dla języka docelowego (np. `smart_sync`, `audio_enhancement`, `video_upload`)
</ResponseField>

<ResponseField name="dubbingProgress" type="number">
  Przybliżony procent postępu dubbingu (0-100)
</ResponseField>

<ResponseField name="status" type="string" required>
  Aktualny status tłumaczenia: `processing`, `success` lub `failed`
</ResponseField>

### Pola Lip Sync

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

<ResponseField name="lipSync" type="object">
  Status synchronizacji ruchu ust i szczegóły wyjściowe (obecne tylko wtedy, gdy zażądano synchronizacji ruchu ust)

  <Expandable title="właściwości lipSync">
    <ResponseField name="lipSync.jobId" type="string">
      Identyfikator zadania synchronizacji ruchu ust
    </ResponseField>

    <ResponseField name="lipSync.status" type="string">
      Status synchronizacji ruchu ust: `PENDING`, `PROCESSING`, `COMPLETED`, `FAILED`, `REJECTED` lub `CANCELED`
    </ResponseField>

    <ResponseField name="lipSync.videoUrl" type="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`.
    </ResponseField>

    <ResponseField name="lipSync.errorMessage" type="string">
      Szczegóły błędu, jeśli synchronizacja ruchu ust nie powiodła się
    </ResponseField>

    <ResponseField name="lipSync.type" type="string">
      Tryb synchronizacji ruchu ust: `standard`, `pro` lub `studio`.
    </ResponseField>

    <ResponseField name="lipSync.createdAt" type="string">
      Znacznik czasu ISO utworzenia próby synchronizacji ruchu ust.
    </ResponseField>

    <ResponseField name="lipSync.requestedAt" type="string">
      Znacznik czasu ISO żądania próby synchronizacji ruchu ust, jeśli jest dostępny.
    </ResponseField>

    <ResponseField name="lipSync.completedAt" type="string">
      Znacznik czasu ISO zakończenia synchronizacji ruchu ust, jeśli jest dostępny.
    </ResponseField>

    <ResponseField name="lipSync.failedAt" type="string">
      Znacznik czasu ISO niepowodzenia synchronizacji ruchu ust, jeśli jest dostępny.
    </ResponseField>

    <ResponseField name="lipSync.timedOutAt" type="string">
      Znacznik czasu ISO, kiedy upłynął limit czasu synchronizacji ruchu ust, jeśli jest dostępny.
    </ResponseField>

    <ResponseField name="lipSync.activeSpeakerDetectionEnabled" type="boolean">
      Czy wykrywanie aktywnego mówcy było włączone dla tej próby synchronizacji ruchu ust.
    </ResponseField>
  </Expandable>
</ResponseField>

<Info>
  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.
</Info>

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

### 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.

<ResponseField name="translatedVideoUrl" type="string">
  URL do pobrania przetłumaczonego pliku wideo
</ResponseField>

<ResponseField name="translatedAudioUrl" type="string">
  URL do pobrania przetłumaczonego pliku audio osobno
</ResponseField>

### Pola odpowiedzi o błędzie

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

<ResponseField name="error" type="object">
  Szczegóły błędu

  <Expandable title="właściwości błędu">
    <ResponseField name="error.code" type="string">
      Kod błędu czytelny dla maszyny
    </ResponseField>

    <ResponseField name="error.message" type="string">
      Opis błędu czytelny dla człowieka
    </ResponseField>
  </Expandable>
</ResponseField>

## Przykłady

<CodeGroup>
  ```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;
  }
  ```
</CodeGroup>

## 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": "Could not transcribe the audio. Please ensure the audio quality is sufficient."
  }
}
```

## Najlepsze praktyki odpytywania

<Info>
  **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.
</Info>

<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.
</Warning>

## 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ę) |
