-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yaml
523 lines (515 loc) · 16.8 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
openapi: "3.0.2"
info:
title: Upscayl Cloud API
description: |
API for Upscayl Cloud - An AI-powered image upscaling service.
Use this API to upscale images, check processing status, and manage uploads.
version: 1.0.0
contact:
name: Upscayl Support
url: mailto:[email protected]
servers:
- url: https://api.upscayl.org
description: Upscayl Server
paths:
/complete-multipart-upload:
post:
summary: Complete Multipart Upload
description: |
This endpoint marks a multipart upload as complete.
It requires the upload ID, a key, and a list of parts with their ETags. This endpoint is used after uploading parts to the multipart URLs generated by the [get-upload-url](/get-upload-url) endpoint.
operationId: completeMultipartUpload
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
uploadId:
type: string
description: The ID of the multipart upload.
key:
type: string
description: The S3 key where the file is stored.
parts:
type: array
items:
type: object
properties:
PartNumber:
type: integer
description: The part number.
ETag:
type: string
description: The ETag of the uploaded part.
description: A list of parts with their ETags.
required:
- uploadId
- key
- parts
responses:
"200":
description: Multipart upload completed successfully
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
data:
type: object
properties:
status:
type: string
example: success
"400":
description: Bad Request
content:
application/json:
schema:
type: object
example: "Bad Request: Missing required parameters"
"500":
description: Internal Server Error
content:
application/json:
schema:
type: object
example: "Internal Server Error: Failed to complete upload"
security:
- ApiKeyAuth: []
/get-upload-url:
post:
summary: Get Multipart Upload URLs
description: |
This endpoint generates a URLs for uploading a file to upscayl servers in multipart format. This is useful for large files or slow connections.
operationId: getUploadUrl
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
fileSize:
type: integer
description: The size of the file in bytes.
fileType:
type: string
description: The MIME type of the file.
originalFileName:
type: string
description: The original name of the file.
required:
- fileSize
- fileType
- originalFileName
responses:
"200":
description: Presigned URLs generated successfully
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
data:
type: object
properties:
uploadId:
type: string
description: The ID of the multipart upload.
partUrls:
type: array
items:
type: object
properties:
partNumber:
type: integer
description: The part number for the upload.
signedUrl:
type: string
description: The presigned URL for uploading the part.
partSize:
type: integer
description: The size of each part in bytes.
fileName:
type: string
description: The generated file name.
fileType:
type: string
description: The MIME type of the file.
fileSize:
type: integer
description: The size of the file in bytes.
originalFileName:
type: string
description: The original name of the file.
path:
description: The path of the file to send to [start-task](/start-task).
createdAt:
type: integer
description: Timestamp of URL generation.
expiresAt:
type: integer
description: Timestamp of URL expiration.
"400":
description: Bad Request
content:
application/json:
schema:
type: object
example: "Bad Request: Missing User ID"
"402":
description: Payment Required
content:
application/json:
schema:
type: object
example: Insufficient credits
"500":
description: Internal Server Error
content:
application/json:
schema:
type: object
example: Internal Server Error
security:
- ApiKeyAuth: []
/get-task-status:
post:
summary: Get Task Status
description: |
This endpoint retrieves the status of a task, including whether it has been processed, credits deducted, and file download links.
It also handles credit deduction if the task is processed and credits have not been deducted yet.
operationId: getTaskStatus
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
taskId:
type: string
description: The ID of the task to retrieve the status for.
responses:
"200":
description: Task status retrieved successfully
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
data:
type: object
properties:
status:
$ref: "#/components/schemas/Status"
progress:
type: string
example: "100"
files:
type: array
items:
$ref: "#/components/schemas/FileData"
deductedCredits:
type: integer
example: 10
creditsDeducted:
type: boolean
example: true
model:
$ref: "#/components/schemas/Model"
scale:
$ref: "#/components/schemas/Scale"
saveImageAs:
type: string
example: "png"
compression:
type: integer
example: 80
batchMode:
type: boolean
example: false
"400":
description: Bad Request
content:
application/json:
schema:
type: object
example: "Bad Request: Missing User ID"
"500":
description: Internal Server Error
content:
application/json:
schema:
type: object
example: Error getting data
security:
- ApiKeyAuth: []
/start-task:
post:
summary: Start Upscaling Task
description: |
This endpoint processes an upscaling task request, including file uploads.
operationId: getTaskStatus
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required:
- enhanceFace
- model
- scale
- saveImageAs
properties:
file:
type: string
format: binary
description: "The image file to be processed (mutually exclusive with 'files'). Supported formats: JPG, PNG, WEBP."
files:
type: array
items:
$ref: "#/components/schemas/FileData"
description: The files to be processed (mutually exclusive with 'file'). **This is to be only used with 'Get Upload URL' endpoint.**
model:
$ref: "#/components/schemas/Model"
scale:
$ref: "#/components/schemas/Scale"
saveImageAs:
$ref: "#/components/schemas/SaveImageAs"
enhanceFace:
type: boolean
description: Whether to enhance faces in the image.
oneOf:
- required: ["file"]
- required: ["files"]
responses:
"200":
description: Task request sent successfully
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: success
data:
type: object
properties:
message:
type: string
description: The message returned.
example: Task request sent successfully
taskId:
type: string
description: The ID of the task that you can use to check the status.
example: "123e4567-e89b-12d3-a456-426614174000"
creditsToDeduct:
type: integer
description: The number of credits to deduct for the task.
example: 10
headers:
x-task-cost:
schema:
type: integer
description: The number of credits deducted for the task.
"400":
description: Bad Request
content:
application/json:
schema:
type: string
example: "Bad Request: Missing User"
"402":
description: Payment Required
content:
application/json:
schema:
type: string
example: Insufficient credits
"404":
description: Not Found
content:
application/json:
schema:
type: object
example: User not found
"500":
description: Internal Server Error
content:
application/json:
schema:
type: object
example: Error processing request
security:
- ApiKeyAuth: []
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
description: |
API key required to access the API. You can obtain an API key at [https://upscayl.org/account/api-keys](https://upscayl.org/account/api-keys)
schemas:
Model:
type: string
enum:
- upscayl-standard-4x
- upscayl-lite-4x
- clear-boost-4x
- crystal-plus-4x
- digital-art-4x
- digital-art-plus-4x
- natural-max-4x
- natural-plus-4x
- nature-boost-4x
- pure-boost-4x
- quick-clear-4x
- texture-boost-4x
description: The available AI models for upscaling
SaveImageAs:
type: string
enum:
- jpg
- png
- webp
description: The available image formats for saving
Status:
type: string
enum:
- ENHANCING
- PROCESSING
- PROCESSED
- PROCESSING_FAILED
description: The status of the task
Scale:
type: integer
enum:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
description: The scaling factor for the task
example: 4
FileData:
type: object
properties:
fileName:
type: string
description: The name of the file.
example: "1k2jj2b3c-cnb1234ij.jpg"
fileType:
type: string
description: The MIME type of the file.
example: "image/jpeg"
fileSize:
type: integer
description: The size of the file in bytes.
example: 123456
originalFileName:
type: string
description: The original name of the file.
example: "image.jpg"
path:
type: string
description: The path where the file is stored.
example: "users/1412v4124v/1k2jj2b3c-cnb1234ij.jpg"
createdAt:
type: integer
description: Timestamp of file creation.
example: 1640995200
expiresAt:
type: integer
description: Timestamp of file expiration.
example: 1640995200
dimensions:
type: object
properties:
width:
type: integer
description: The width of the image.
height:
type: integer
description: The height of the image.
TaskDocument:
type: object
properties:
userId:
type: string
description: The ID of the user submitting the task.
email:
type: string
description: The email of the user.
files:
type: array
items:
$ref: "#/components/schemas/FileData"
id:
type: string
description: The unique ID of the task.
enhanceFace:
type: boolean
description: Whether to enhance faces in the image.
model:
$ref: "#/components/schemas/Model"
scale:
$ref: "#/components/schemas/Scale"
saveImageAs:
$ref: "#/components/schemas/SaveImageAs"
compression:
type: integer
description: The compression level for the output image.
createdAt:
type: integer
description: Timestamp of task creation.
# creditsDeducted:
# type: boolean
# description: Whether credits have been deducted for the task.
filesCount:
type: integer
description: The number of files in the task.
status:
$ref: "#/components/schemas/Status"
batchMode:
type: boolean
description: Whether the task is in batch mode.
progress:
type: string
description: The progress of the task.
creditsToDeduct:
type: integer
description: The number of credits to deduct for the task.
example: 10
currentCredits:
type: integer
description: The current credits of the user.
currentExtraCredits:
type: integer
description: The current extra credits of the user.