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

# Ein Sora 2-Video abrufen

> Verwenden Sie CometAPI GET /v1/videos/{video_id}, um den Status, den Fortschritt und Metadaten eines Sora 2-Videos wie Dauer, Abmessungen, Zeitstempel und Ablaufzeit abzurufen.

Verwenden Sie diesen Endpoint, nachdem Sie einen Sora-Job gestartet haben. Er meldet den aktuellen Jobstatus, die konfigurierte Größe und Dauer sowie jeden vom Provider zurückgegebenen Fehler.

## Achten Sie auf diese Felder

* `status` für den Status im Lebenszyklus
* `progress` für ein grobes Fortschrittssignal
* `error`, wenn der Provider den Job ablehnt oder er fehlschlägt
* `expires_at` nach Abschluss, wenn Sie wissen müssen, wann temporäre Assets ablaufen

## Bis zum Abschluss pollen

<Steps>
  <Step title="Erstellen Sie zuerst das Video">
    Beginnen Sie mit [Create Video](./create).
  </Step>

  <Step title="Per id pollen">
    Übergeben Sie hier die zurückgegebene `id` und prüfen Sie weiter, bis der Job `completed` oder `failed` erreicht.
  </Step>

  <Step title="Laden Sie die Datei herunter">
    Wenn der Job `completed` ist, wechseln Sie zu [Retrieve Video Content](./retrieve-content).
  </Step>
</Steps>

## Response-Form auf CometAPI

Dieser Schritt entspricht dem Sora-Polling-Workflow sehr genau. CometAPI behält die Objektform im OpenAI-Stil bei, sodass Sie Statusprüfungen mit minimaler Anpassung verdrahten können.


## OpenAPI

````yaml api/openapi/video/sora-2/get-retrieve.openapi.json GET /v1/videos/{video_id}
openapi: 3.1.0
info:
  title: Retrieve Video API
  version: 1.0.0
  description: Retrieve the current status of a Sora video job created through CometAPI.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /v1/videos/{video_id}:
    get:
      summary: Retrieve a Sora video job
      description: >-
        Poll a previously created Sora video job until it is completed or
        failed.
      operationId: retrieve_video
      parameters:
        - name: video_id
          in: path
          required: true
          description: Video id returned by the create or remix endpoint.
          schema:
            type: string
      responses:
        '200':
          description: Current job state.
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - size
                  - model
                  - object
                  - status
                  - seconds
                  - progress
                  - created_at
                properties:
                  id:
                    type: string
                    description: Task id.
                  size:
                    type: string
                  error:
                    type:
                      - object
                      - 'null'
                  model:
                    type: string
                  object:
                    type: string
                  prompt:
                    type: string
                  status:
                    type: string
                    description: >-
                      Task state: `queued`, `in_progress`, `completed`, or
                      `failed`.
                  seconds:
                    type: string
                  progress:
                    type: integer
                    description: Render progress from 0 to 100.
                  created_at:
                    type: integer
                    description: Unix timestamp of task creation.
                  expires_at:
                    type:
                      - integer
                      - 'null'
                  completed_at:
                    type:
                      - integer
                      - 'null'
                    description: Unix timestamp of completion.
                  remixed_from_video_id:
                    type:
                      - string
                      - 'null'
                  video_url:
                    type: string
                    description: >-
                      Time-limited download URL present when `status` is
                      `completed`. Mirror the file to your own storage for long
                      retention.
                example:
                  id: video_69b25d5f467c81908733a56bc236b4df
                  size: 1280x720
                  error: null
                  model: sora-2
                  object: video
                  prompt: A paper airplane glides across a desk.
                  status: in_progress
                  seconds: '4'
                  progress: 0
                  created_at: 1773296991
                  expires_at: null
                  completed_at: null
                  remixed_from_video_id: null
              examples:
                In progress:
                  summary: Task still rendering
                  value:
                    id: <video_id>
                    model: sora-2
                    object: video
                    status: in_progress
                    progress: 30
                    created_at: 1781079478
                Completed:
                  summary: Finished task with video URL
                  value:
                    id: <video_id>
                    model: sora-2
                    object: video
                    status: completed
                    progress: 100
                    video_url: >-
                      https://comet-api-bucket.s3.us-east-1.amazonaws.com/videos/<video_id>.mp4?...
                    created_at: 1781079478
                    completed_at: 1781079550
      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.

````