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

# Vertaalstatus ophalen

> Controleer de status van een vertaalproject en haal resultaten op

# Vertaalstatus ophalen

Haal de huidige status van een vertaalproject op. Gebruik dit eindpunt om de voortgang te peilen en de URL van de vertaalde video te verkrijgen wanneer de verwerking is voltooid.

## Aanvraag

### Headers

<ParamField header="x-api-key" type="string" required>
  Uw VoiceCheap API-sleutel. Haal er een op via [app.voicecheap.ai/page-api](https://app.voicecheap.ai/page-api).
</ParamField>

### Padparameters

<ParamField path="projectId" type="string" required>
  De unieke identificatie van het vertaalproject die wordt geretourneerd door het [Start Translation](/docs/nl/api-reference/translate)-eindpunt.
</ParamField>

## Antwoord

De antwoordstructuur varieert op basis van de vertaalstatus.

### Algemene velden

<ResponseField name="projectId" type="string" required>
  De unieke identificatie van het project
</ResponseField>

<ResponseField name="projectName" type="string" required>
  De naam van het project
</ResponseField>

<ResponseField name="originalVideoUrl" type="string" required>
  URL naar het originele geüploade video-/audiobestand
</ResponseField>

<ResponseField name="originalLanguage" type="string" required>
  De gedetecteerde of opgegeven brontaal
</ResponseField>

<ResponseField name="targetLanguage" type="string" required>
  De doeltaal voor vertaling
</ResponseField>

<ResponseField name="duration" type="number" required>
  Duur van de inhoud in seconden
</ResponseField>

<ResponseField name="createdAt" type="number" required>
  Unix-tijdstempel waarop het project is aangemaakt
</ResponseField>

<ResponseField name="workflow" type="string" required>
  API-workflow die het project heeft aangemaakt: `translation` of `transcription`.
</ResponseField>

<ResponseField name="transcriptionStatus" type="string" required>
  Status van bron-transcriptie: `processing`, `success` of `failed`. Dit signaal staat los van de voltooiing van de nasynchronisatie.
</ResponseField>

<ResponseField name="transcripts" type="object" required>
  Beschikbare genormaliseerde transcripties.

  <Expandable title="transcripts eigenschappen">
    <ResponseField name="transcripts.original" type="object | null">
      Transcriptie in de brontaal indien beschikbaar, inclusief tijdstempels en sprekers.
    </ResponseField>

    <ResponseField name="transcripts.translations" type="array">
      Beschikbare transcripties in de doeltaal met hun taal- en werk-identificaties.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="workId" type="string">
  Identificatie van het vertaalwerk voor de momenteel gerapporteerde vertaalde versie.
</ResponseField>

<ResponseField name="translatedVersionId" type="string">
  Identificatie van de vertaalde versie voor de momenteel gerapporteerde vertaalde versie.
</ResponseField>

<ResponseField name="actualProgressStep" type="string">
  Huidige projectstap. Tijdens het aanmaken of transcriberen weerspiegelt dit de actieve aanmaakstap.
  Voorbeelden zijn `downloading_content`, `content_validation` en `transcription_processing`.
  Zodra de nasynchronisatie begint, kan dit overschakelen naar een actieve nasynchronisatiestap zoals `smart_sync` of `audio_assembling`.
  `status: processing` koppelt niet met `actualProgressStep: done`.
</ResponseField>

<ResponseField name="translationAndTranscriptionProgress" type="number">
  Geschat voortgangspercentage voor het aanmaken/transcriberen van het project (0-100)
</ResponseField>

<ResponseField name="dubbingStep" type="string">
  Huidige nasynchronisatiestap voor de doeltaal (bijv. `smart_sync`, `audio_enhancement`, `video_upload`)
</ResponseField>

<ResponseField name="dubbingProgress" type="number">
  Geschat voortgangspercentage voor nasynchronisatie (0-100)
</ResponseField>

<ResponseField name="status" type="string" required>
  Huidige status van de vertaling: `processing`, `success` of `failed`
</ResponseField>

### Lip Sync velden

Wanneer lipsynchronisatie werd aangevraagd, bevat het antwoord een extra `lipSync`-object:

<ResponseField name="lipSync" type="object">
  Status en uitvoerdetails van lipsynchronisatie (alleen aanwezig wanneer lipsynchronisatie werd aangevraagd)

  <Expandable title="lipSync eigenschappen">
    <ResponseField name="lipSync.jobId" type="string">
      Identificatie van de lipsynchronisatietaak
    </ResponseField>

    <ResponseField name="lipSync.status" type="string">
      Status van lipsynchronisatie: `PENDING`, `PROCESSING`, `COMPLETED`, `FAILED`, `REJECTED` of `CANCELED`
    </ResponseField>

    <ResponseField name="lipSync.videoUrl" type="string">
      URL van de video met lipsynchronisatie. Gebruik deze URL voor de uiteindelijke lipsynchronisatie-uitvoer wanneer `lipSync.status` gelijk is aan `COMPLETED`.
    </ResponseField>

    <ResponseField name="lipSync.errorMessage" type="string">
      Foutdetails als lipsynchronisatie is mislukt
    </ResponseField>

    <ResponseField name="lipSync.type" type="string">
      Modus voor lipsynchronisatie: `standard`, `pro` of `studio`.
    </ResponseField>

    <ResponseField name="lipSync.createdAt" type="string">
      ISO-tijdstempel waarop de lipsynchronisatiepoging is aangemaakt.
    </ResponseField>

    <ResponseField name="lipSync.requestedAt" type="string">
      ISO-tijdstempel waarop de lipsynchronisatiepoging werd aangevraagd, indien beschikbaar.
    </ResponseField>

    <ResponseField name="lipSync.completedAt" type="string">
      ISO-tijdstempel waarop de lipsynchronisatie is voltooid, indien beschikbaar.
    </ResponseField>

    <ResponseField name="lipSync.failedAt" type="string">
      ISO-tijdstempel waarop de lipsynchronisatie is mislukt, indien beschikbaar.
    </ResponseField>

    <ResponseField name="lipSync.timedOutAt" type="string">
      ISO-tijdstempel wanneer de lipsynchronisatie een time-out kreeg, indien beschikbaar.
    </ResponseField>

    <ResponseField name="lipSync.activeSpeakerDetectionEnabled" type="boolean">
      Of detectie van de actieve spreker was ingeschakeld voor deze poging tot lipsynchronisatie.
    </ResponseField>
  </Expandable>
</ResponseField>

<Info>
  Wanneer lipsynchronisatie wordt aangevraagd, blijft de vertaling in `processing` totdat `lipSync.status` `COMPLETED` is. Als de lipsynchronisatie mislukt, wordt de status
  `failed` en de `error.code` is `LIPSYNC_FAILED`. Wanneer de lipsynchronisatie slaagt, lees het lipsynchronisatie-asset uit `lipSync.videoUrl`; `translatedVideoUrl`
  is de vertaalde video-output vóór de lipsynchronisatie-overlay.
</Info>

<Tip>Gebruik `GET /v1/projects/{projectId}` wanneer u de volledige vertaalde versiegeschiedenis of de volledige lipsynchronisatiegeschiedenis nodig heeft.</Tip>

### Velden voor succesvolle respons

Voor vertaalworkflows worden de volgende velden opgenomen wanneer `status` `success` is. Een workflow die alleen uit transcriptie bestaat, bereikt `success` zonder vertaalde mediavelden.

<ResponseField name="translatedVideoUrl" type="string">
  URL om het vertaalde videobestand te downloaden
</ResponseField>

<ResponseField name="translatedAudioUrl" type="string">
  URL om het vertaalde audiobestand afzonderlijk te downloaden
</ResponseField>

### Velden voor mislukte respons

Wanneer `status` `failed` is, wordt het volgende extra veld opgenomen:

<ResponseField name="error" type="object">
  Foutdetails

  <Expandable title="fouteigenschappen">
    <ResponseField name="error.code" type="string">
      Machineleesbare foutcode
    </ResponseField>

    <ResponseField name="error.message" type="string">
      Menselijk leesbare foutbeschrijving
    </ResponseField>
  </Expandable>
</ResponseField>

## Voorbeelden

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

## Respons-voorbeelden

### Verwerkingsstatus

```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"
}
```

### Verwerkingsstatus (Lip Sync aangevraagd)

```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 succes

```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 succes (Lip Sync voltooid)

```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 mislukt

```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."
  }
}
```

## Best practices voor polling

<Info>
  **Aanbevolen polling-interval:** 10-30 seconden

  De vertaaltijd varieert op basis van videolengte en complexiteit. Reken voor een typische video van 2 minuten op 2-5 minuten verwerkingstijd.
</Info>

<Warning>
  **Snelheidslimiet:** 30 verzoeken per minuut

  Vermijd vaker dan eens per 2 seconden te pollen om binnen de snelheidslimieten te blijven.
</Warning>

## Fouten

| Status | Code                  | Beschrijving                                        |
| ------ | --------------------- | --------------------------------------------------- |
| 401    | `INVALID_API_KEY`     | De opgegeven API-sleutel is ongeldig                |
| 403    | `FORBIDDEN`           | U heeft geen toegang tot dit project                |
| 404    | `PROJECT_NOT_FOUND`   | Het opgegeven project bestaat niet                  |
| 429    | `RATE_LIMIT_EXCEEDED` | Te veel verzoeken (limiet: 30 verzoeken per minuut) |
