> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Recuperare un video Veo 3

> Usa l'API di recupero Veo3 di CometAPI (GET /v1/videos/{video_id}) per ottenere lo stato, interrogare i metadati o scaricare i risultati della generazione video Veo3 tramite video_id.

Usa questo endpoint per effettuare il polling di un job Veo. Restituisce lo stato corrente dell'attività e le informazioni risolte sul model ID del provider.

## Loop di polling

<Steps>
  <Step title="Crea prima il job">
    Inizia con [Veo3 Async Generation](./create) e salva l'`id` restituito.
  </Step>

  <Step title="Esegui il polling finché l'attività non è terminale">
    Continua a chiamare questo endpoint finché il job non esce da `queued` o `in_progress` e raggiunge uno stato finale.
  </Step>

  <Step title="Memorizza il risultato">
    Quando l'output è pronto, spostalo nel tuo sistema di archiviazione se la tua applicazione ha bisogno di una copia persistente.
  </Step>
</Steps>

## Perché il model ID può cambiare

La risposta può mostrare il model ID risolto del provider invece dell'alias che hai inviato. Questo è un comportamento previsto.


## OpenAPI

````yaml api/openapi/video/veo3/get-retrieve.openapi.json GET /v1/videos/{video_id}
openapi: 3.1.0
info:
  title: Veo3 Retrieve API
  version: 1.0.0
  description: >-
    Retrieve the current state of a Veo job created through the CometAPI
    /v1/videos route.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /v1/videos/{video_id}:
    get:
      summary: Retrieve a Veo video job
      description: >-
        Poll a Veo job created through CometAPI. The response may include a
        resolved provider model ID instead of the alias you submitted.
      operationId: veo3_retrive
      parameters:
        - name: video_id
          in: path
          required: true
          description: Task id returned by the create endpoint.
          schema:
            type: string
      responses:
        '200':
          description: Current job state.
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - size
                  - model
                  - object
                  - status
                  - progress
                  - created_at
                properties:
                  id:
                    type: string
                  size:
                    type: string
                  model:
                    type: string
                  object:
                    type: string
                  status:
                    type: string
                  task_id:
                    type: string
                  progress:
                    type: integer
                  created_at:
                    type: integer
                example:
                  id: task_pa9CKKtYlTdxO7IIHOKKhXfjxEu4EQoR
                  size: 16x9
                  model: veo_3_1-4K
                  object: video
                  status: queued
                  task_id: task_pa9CKKtYlTdxO7IIHOKKhXfjxEu4EQoR
                  progress: 0
                  created_at: 1773297229
              example:
                id: <video_id>
                object: video
                model: veo3.1-fast
                status: completed
                progress: '100'
                created_at: '1781079479'
                completed_at: '1781079580'
                video_url: >-
                  https://comet-api-bucket.s3.us-east-1.amazonaws.com/videos/<video_id>.mp4?...
      x-codeSamples:
        - lang: Shell
          label: Default
          source: |
            VIDEO_ID="<video_id>"

            curl "https://api.cometapi.com/v1/videos/$VIDEO_ID" \
              -H "Authorization: Bearer $COMETAPI_KEY"
        - lang: Shell
          label: Poll until done
          source: |
            VIDEO_ID="<video_id>"

            while true; do
              STATUS=$(curl -s "https://api.cometapi.com/v1/videos/$VIDEO_ID" \
                -H "Authorization: Bearer $COMETAPI_KEY" | python3 -c "import json,sys; print(json.load(sys.stdin)['status'])")
              echo "status: $STATUS"
              case "$STATUS" in completed | failed) break;; esac
              sleep 20
            done
        - lang: Python
          label: Default
          source: |
            import os
            import requests

            video_id = "<video_id>"

            response = requests.get(
                f"https://api.cometapi.com/v1/videos/{video_id}",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
            )

            print(response.json())
        - lang: Python
          label: Poll until done
          source: |
            import os
            import time
            import requests

            video_id = "<video_id>"
            headers = {"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]}

            while True:
                video = requests.get(
                    f"https://api.cometapi.com/v1/videos/{video_id}", headers=headers
                ).json()
                print(video["status"], video.get("progress"))
                if video["status"] in ("completed", "failed"):
                    break
                time.sleep(20)

            if video["status"] == "completed":
                print(video["video_url"])
        - lang: JavaScript
          label: Default
          source: >
            const videoId = "<video_id>";


            const response = await
            fetch(`https://api.cometapi.com/v1/videos/${videoId}`, {
                headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
            });


            console.log(await response.json());
        - lang: JavaScript
          label: Poll until done
          source: >
            const videoId = "<video_id>";

            const headers = { Authorization: `Bearer
            ${process.env.COMETAPI_KEY}` };


            let video;

            while (true) {
                video = await (await fetch(`https://api.cometapi.com/v1/videos/${videoId}`, { headers })).json();
                console.log(video.status, video.progress);
                if (video.status === "completed" || video.status === "failed") break;
                await new Promise((resolve) => setTimeout(resolve, 20000));
            }


            if (video.status === "completed") console.log(video.video_url);
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````