-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin-api.yaml
679 lines (675 loc) · 22.9 KB
/
admin-api.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
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
openapi: 3.0.0
info:
title: api.video Admin API
description: The Admin API is tool that enables you to directly manage your api.video projects and API keys through a secure API.
version: 1.0.0
servers:
- url: https://admin.api.video
paths:
/projects/count:
get:
tags:
- Projects
summary: Get project count
description: This endpoint enables you to retrieve the overall number of projects you have.
parameters:
- in: query
name: name
schema:
type: string
description: Filter for projects names that contain this value. The API can return partial matches.
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
count:
description: The number of projects.
type: integer
example: 37
security:
- basicAuth: []
/projects:
get:
tags:
- Projects
summary: List projects
description: |
This endpoint enables you to retrieve a paginated list of every project you have. You can filter the list by project name, and sort by name, creation date, and ascending or descending order.
Note that the API response only contains one page of results. To navigate to another page, use the `previous` or `next` path queries provided in the respone's `links` object.
parameters:
- in: query
name: page_size
schema:
type: integer
default: 20
maximum: 100
description: Number of records per page.
- in: query
name: page
schema:
type: integer
default: 1
description: Page number to retrieve.
- in: query
name: name
schema:
type: string
description: Filter for projects names that contain this value.
- in: query
name: sort_by
schema:
type: string
enum:
- created_at
- name
description: 'Select a property to sort by. Allowed values: `created_at`, `name`.'
- in: query
name: sort_order
schema:
type: string
enum:
- asc
- desc
description: 'Select the order to sort by. Allowed values: `asc`, `desc`.'
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/Project'
pagination:
$ref: '#/components/schemas/Pagination'
links:
$ref: '#/components/schemas/Links'
security:
- basicAuth: []
post:
tags:
- Projects
summary: Create project
description: This endpoint enables you to create a new project and select the hosting region for it.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: The name of the Admin API key. Also visible in the dashboard. You may set any value that fits your organization purposes.
region:
type: string
description: The region where your data is hosted.
enum:
- us-east-1
- eu-central-1
required:
- name
- region
responses:
'201':
description: Project created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Project'
security:
- basicAuth: []
/projects/{project_id}/api-keys/count:
get:
tags:
- API keys
summary: Count API keys
description: This endpoint enables you to count the overall number of API keys for a specific project.
parameters:
- in: path
name: project_id
required: true
schema:
type: string
description: The ID of the project you want to count API keys for.
- in: query
name: name
schema:
type: string
description: Filter for API key names that contain this value. The API can return partial matches.
- in: query
name: value
schema:
type: string
description: Filter for the value of a specific API key.
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
count:
description: The number of API keys.
type: integer
example: 16
security:
- basicAuth: []
/projects/{project_id}:
get:
tags:
- Projects
summary: Get project
description: This endpoint enables you to retrieve a specific project based on its `project_id`.
parameters:
- in: path
name: project_id
required: true
schema:
type: string
description: The ID of the project you want to retrieve.
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Project'
security:
- basicAuth: []
patch:
tags:
- Projects
summary: Update project
description: |
This endpoint enables you to update a specific project based on its `project_id`.
You can update the project name and schedule the project for deletion. When you schedule a project for deletion, the project will be deleted on the first day of the next billing cycle. The API sends the exact date-time of deletion in the response.
parameters:
- in: path
name: project_id
required: true
schema:
type: string
description: The ID of the project you want to update.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: The project name that you want to update.
deletes_at:
type: string
enum:
- next_cycle
description: Schedule the project for deletion. The accepted value is `next_cycle`. The project will be deleted on the first day of the next billing cycle. The API sends the exact date-time of deletion in the response.
required:
- name
responses:
'200':
description: Project updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Project'
security:
- basicAuth: []
/projects/{project_id}/delivery-usage:
get:
tags:
- Usage
summary: Get delivery usage
description: This endpoint enables you to retrieve the total amount of minutes delivered for a specific project based on its `project_id`.
parameters:
- in: path
name: project_id
required: true
schema:
type: string
description: The ID of the project you want to retrieve usage data for.
- in: query
name: interval
required: true
schema:
type: string
enum:
- month
- week
description: Set the period of time that you want to retrieve delivery usage for. `month` returns data for the past 30 days, while `week` returns data for the past 7 days.
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/DeliveryUsageResponse'
example:
items:
- collected_on: '2024-08-09'
video_hls_duration_minutes: 10
video_mp4_duration_minutes: 22
live_stream_hls_duration_minutes: 422
- collected_on: '2024-08-10'
video_hls_duration_minutes: 33
video_mp4_duration_minutes: 245
live_stream_hls_duration_minutes: 32
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequest'
example:
constraint: required
detail: An attribute is invalid.
name: interval
title: Bad request.
total_problems: 1
type: 'https://docs.api.video/reference/invalid-attribute'
security:
- basicAuth: []
/projects/{project_id}/hosting-usage:
get:
tags:
- Usage
summary: Get hosting usage
description: This endpoint enables you to retrieve the cumulative amount of video minutes hosted in a specific project based on its `project_id`.
parameters:
- in: path
name: project_id
required: true
schema:
type: string
description: The ID of the project you want to retrieve usage data for.
- in: query
name: interval
required: true
schema:
type: string
enum:
- month
- week
description: Set the period of time that you want to retrieve hosting usage data for. `month` returns data for the past 30 days, while `week` returns data for the past 7 days.
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/HostingUsageResponse'
example:
items:
- collected_on: '2024-08-09'
video_duration_minutes: 235
- collected_on: '2024-08-10'
video_duration_minutes: 454
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequest'
example:
constraint: required
detail: An attribute is invalid.
name: interval
title: Bad request.
total_problems: 1
type: 'https://docs.api.video/reference/invalid-attribute'
security:
- basicAuth: []
/projects/{project_id}/api-keys:
get:
tags:
- API keys
summary: List API keys
description: |
This endpoint enables you to list all API keys in a project.
Note that the API response only contains one page of results. To navigate to another page, use the `previous` or `next` path queries provided in the respone's `links` object.
parameters:
- in: query
name: page_size
schema:
type: integer
minimum: 1
default: 20
maximum: 100
description: Number of records per page.
- in: query
name: page
schema:
type: integer
default: 1
description: Page number to retrieve.
- in: query
name: name
schema:
type: string
description: Filter for API key names that contain this value. The API can return partial matches.
- in: query
name: value
schema:
type: string
description: Filter for the value of a specific API key.
- in: query
name: sort_by
schema:
type: string
enum:
- created_at
- name
- value
description: 'Select a property to sort by. Allowed values: `created_at`, `name`, `value`.'
- in: query
name: sort_order
schema:
type: string
enum:
- asc
- desc
description: 'Select the order to sort by. Allowed values: `asc`, `desc`.'
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/ApiKey'
pagination:
$ref: '#/components/schemas/Pagination'
links:
$ref: '#/components/schemas/Links'
security:
- basicAuth: []
post:
tags:
- API keys
summary: Create API key
description: This endpoint enables you to create a new API key in a specific project.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: The name of the Admin API key. Also visible in the dashboard. You may set any value that fits your organization purposes.
required:
- name
responses:
'201':
description: API key created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/ApiKey'
security:
- basicAuth: []
/projects/{project_id}/api-keys/{api_key_id}:
get:
tags:
- API keys
summary: Get API key
description: This endpoint enables you to retrieve a specific API key from a project.
parameters:
- in: path
name: project_id
required: true
schema:
type: string
description: The ID of the project that the API key belongs to.
- in: path
name: api_key_id
required: true
schema:
type: string
description: The ID of the API key to retrieve.
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ApiKey'
security:
- basicAuth: []
patch:
tags:
- API keys
summary: Update API key
description: This endpoint enables you to update the `name` of a project that is tied to an API key.
parameters:
- in: path
name: project_id
required: true
schema:
type: string
description: The ID of the project that the API key belongs to.
- in: path
name: api_key_id
required: true
schema:
type: string
description: The ID of the API key to update.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: The name of the project you want to update.
example: My project 2
responses:
'200':
description: API key updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/ApiKey'
security:
- basicAuth: []
delete:
tags:
- API keys
summary: Delete API key
description: |
This endpoint enables you to delete an API key from a specific project.
Note that deleting an API key is permanent - there is no way to retrieve an API key after you delete it.
parameters:
- in: path
name: project_id
required: true
schema:
type: string
description: The ID of the project that the API key belongs to.
- in: path
name: api_key_id
required: true
schema:
type: string
description: The ID of the API key you want to delete.
responses:
'204':
description: API key deleted successfully
security:
- basicAuth: []
components:
securitySchemes:
basicAuth:
type: http
scheme: basic
schemas:
Project:
type: object
properties:
project_id:
type: string
description: The unique ID of a project.
example: project_1CCq9NurjJBRehCVCe8XQY
created_at:
type: string
format: date-time
description: 'The date when the project was created. This field uses the ATOM date-time format: `2024-02-05T00:00:00+01:00`'
name:
type: string
description: The name of the project. Also visible in the dashboard. You may set any value that fits your organization purposes.
example: My project
deletes_at:
type: string
format: date-time
nullable: true
description: 'The scheduled date for deletion. The value is generally the first day of the next month. This field uses the ATOM date-time format: `2024-02-05T00:00:00+01:00`'
region:
type: string
description: The region where your data is hosted.
enum:
- us-east-1
- eu-central-1
deleted:
type: boolean
description: When true, the project is currently being deleted. The project will disappear from your projects' list after deletion finishes. You should not use projects that return `true` for `deleted`.
ApiKey:
type: object
properties:
project_id:
type: string
description: The unique ID of the project that the API key belongs to.
example: project_1CCq9NurjJBRehCVCe8XQY
api_key_id:
type: string
description: The unique ID of an API key.
example: api_key_1CCq9NwWhBxwjAgHzpuZx4
created_at:
type: string
format: date-time
description: 'The date when the API key was created. This field uses the ATOM date-time format: `2024-02-05T00:00:00+01:00`'
name:
type: string
description: The name of the API key. Also visible in the dashboard. You may set any value that fits your organization purposes.
example: Development key
value:
type: string
description: The actual value of the API key. Use this value to authenticate your requests to the API.
example: 19Kc5nhC7...ADWwAbTuUer
Pagination:
type: object
properties:
page:
type: integer
description: Returns the number of the currently active page.
page_size:
type: integer
description: Returns the number of items per page.
item_count:
type: integer
description: Returns the total number of items.
Links:
type: array
items:
type: object
properties:
rel:
type: string
description: |
The relationship between the current page and the linked pages. Allowed values:
- `previous`: The link in `href` points to the previous page when the current page is more than 1.
- `self`: The link in `href` points to the current page.
- `next`: The link in `href` points to the next page when there are more pages available. You can use this link to retrieve the next page of items or create an infinite scroll.
enum:
- previous
- self
- next
href:
type: string
format: uri
description: The URL path of the linked page.
example: /projects?page_size=20&name=aaa&sort_by=name&sort_order=desc&page=2
DeliveryUsageResponse:
type: object
properties:
collected_on:
description: A date within the interval you selected, returned in `YYYY-MM-DD` format.
type: string
pattern: '^\d{4}-\d{2}-\d{2}$'
live_stream_hls_duration_minutes:
description: Returns the total value of HLS live stream delivery in minutes. This field only returns delivery data for the date in the `collected_on` field.
type: integer
example: 51
video_hls_duration_minutes:
description: Returns the total value of HLS video delivery in minutes. This field only returns delivery data for the date in the `collected_on` field.
type: integer
example: 100
video_mp4_duration_minutes:
description: Returns the total value of mp4 video delivery in minutes. This field only returns delivery data for the date in the `collected_on` field.
type: integer
example: 33
HostingUsageResponse:
type: object
properties:
collected_on:
description: A date within the interval you selected, returned in `YYYY-MM-DD` format.
type: string
pattern: '^\d{4}-\d{2}-\d{2}$'
video_duration_minutes:
description: Returns the cumulative length of hosted videos in minutes. This field only returns hosting data for the date in the `collected_on` field.
type: integer
example: 345
BadRequest:
type: object
properties:
type:
description: A link to the error documentation.
type: string
title:
description: A description of the error that occurred.
type: string
name:
description: The name of the parameter that caused the error.
type: string
detail:
description: Details about the error that happened.
type: string
total_problems:
description: The number of problems in your request.
type: integer
constraint:
description: The limitation that your request did not meet.
type: string
example:
constraint: required
detail: An attribute is invalid.
name: interval
title: Bad request.
total_problems: 1
type: 'https://docs.api.video/reference/invalid-attribute'