java/resources/videos/methods/retrieve/index.md +0 −178 deleted
File Deleted View Diff
1## Retrieve video
2
3`Video videos().retrieve(VideoRetrieveParamsparams = VideoRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
4
5**get** `/videos/{video_id}`
6
7Fetch the latest metadata for a generated video.
8
9### Parameters
10
11- `VideoRetrieveParams params`
12
13 - `Optional<String> videoId`
14
15### Returns
16
17- `class Video:`
18
19 Structured information describing a generated video job.
20
21 - `String id`
22
23 Unique identifier for the video job.
24
25 - `Optional<Long> completedAt`
26
27 Unix timestamp (seconds) for when the job completed, if finished.
28
29 - `long createdAt`
30
31 Unix timestamp (seconds) for when the job was created.
32
33 - `Optional<VideoCreateError> error`
34
35 Error payload that explains why generation failed, if applicable.
36
37 - `String code`
38
39 A machine-readable error code that was returned.
40
41 - `String message`
42
43 A human-readable description of the error that was returned.
44
45 - `Optional<Long> expiresAt`
46
47 Unix timestamp (seconds) for when the downloadable assets expire, if set.
48
49 - `VideoModel model`
50
51 The video generation model that produced the job.
52
53 - `SORA_2("sora-2")`
54
55 - `SORA_2_PRO("sora-2-pro")`
56
57 - `SORA_2_2025_10_06("sora-2-2025-10-06")`
58
59 - `SORA_2_PRO_2025_10_06("sora-2-pro-2025-10-06")`
60
61 - `SORA_2_2025_12_08("sora-2-2025-12-08")`
62
63 - `JsonValue; object_ "video"constant`
64
65 The object type, which is always `video`.
66
67 - `VIDEO("video")`
68
69 - `long progress`
70
71 Approximate completion percentage for the generation task.
72
73 - `Optional<String> prompt`
74
75 The prompt that was used to generate the video.
76
77 - `Optional<String> remixedFromVideoId`
78
79 Identifier of the source video if this video is a remix.
80
81 - `VideoSeconds seconds`
82
83 Duration of the generated clip in seconds. For extensions, this is the stitched total duration.
84
85 - `_4("4")`
86
87 - `_8("8")`
88
89 - `_12("12")`
90
91 - `VideoSize size`
92
93 The resolution of the generated video.
94
95 - `_720X1280("720x1280")`
96
97 - `_1280X720("1280x720")`
98
99 - `_1024X1792("1024x1792")`
100
101 - `_1792X1024("1792x1024")`
102
103 - `Status status`
104
105 Current lifecycle status of the video job.
106
107 - `QUEUED("queued")`
108
109 - `IN_PROGRESS("in_progress")`
110
111 - `COMPLETED("completed")`
112
113 - `FAILED("failed")`
114
115### Example
116
117```java
118package com.openai.example;
119
120import com.openai.client.OpenAIClient;
121import com.openai.client.okhttp.OpenAIOkHttpClient;
122import com.openai.models.videos.Video;
123import com.openai.models.videos.VideoRetrieveParams;
124
125public final class Main {
126 private Main() {}
127
128 public static void main(String[] args) {
129 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
130
131 Video video = client.videos().retrieve("video_123");
132 }
133}
134```
135
136#### Response
137
138```json
139{
140 "id": "id",
141 "completed_at": 0,
142 "created_at": 0,
143 "error": {
144 "code": "code",
145 "message": "message"
146 },
147 "expires_at": 0,
148 "model": "string",
149 "object": "video",
150 "progress": 0,
151 "prompt": "prompt",
152 "remixed_from_video_id": "remixed_from_video_id",
153 "seconds": "string",
154 "size": "720x1280",
155 "status": "queued"
156}
157```
158
159### Example
160
161```java
162package com.openai.example;
163
164import com.openai.client.OpenAIClient;
165import com.openai.client.okhttp.OpenAIOkHttpClient;
166import com.openai.models.videos.Video;
167import com.openai.models.videos.VideoRetrieveParams;
168
169public final class Main {
170 private Main() {}
171
172 public static void main(String[] args) {
173 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
174
175 Video video = client.videos().retrieve("video_123");
176 }
177}
178```