summaryrefslogtreecommitdiff
path: root/doc/api/openapi/openapi.yaml
blob: 9ee2b8119be55772ac3d39d2882b69b2b74714c7 (plain)
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
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
openapi: 3.0.0
tags:
  - name: metadata
    description: Metadata of the GitLab instance
  - name: version
    description: Version
  - name: access_requests
    description: Access requests for projects and groups
  - name: access_tokens
    description: Access tokens for projects
info:
  description: |
    An OpenAPI definition for the GitLab REST API.
    Few API resources or endpoints are currently included.
    The intent is to expand this to match the entire Markdown documentation of the API:
    <https://docs.gitlab.com/ee/api/>. Contributions are welcome.

    When viewing this on gitlab.com, you can test API calls directly from the browser
    against the `gitlab.com` instance, if you are logged in.
    The feature uses the current [GitLab session cookie](https://docs.gitlab.com/ee/api/index.html#session-cookie),
    so each request is made using your account.

    Instructions for using this tool can be found in [Interactive API Documentation](openapi_interactive.md).

  version: v4
  title: GitLab API
  termsOfService: 'https://about.gitlab.com/terms/'
  license:
    name: CC BY-SA 4.0
    url: 'https://gitlab.com/gitlab-org/gitlab/-/blob/master/LICENSE'
servers:
  - url: 'https://gitlab.com/api/'
security:
  - ApiKeyAuth: []

components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Private-Token

paths:
  # METADATA
  /v4/metadata:
    $ref: '#/metadata'

  # VERSION
  /v4/version:
    $ref: '#/version'

  # ACCESS REQUESTS (PROJECTS)
  /v4/projects/{id}/access_requests:
    $ref: '#/accessRequestsProjects'

  /v4/projects/{id}/access_requests/{user_id}/approve:
    $ref: '#/accessRequestsProjectsApprove'

  /v4/projects/{id}/access_requests/{user_id}:
    $ref: '#/accessRequestsProjectsDeny'

  # ACCESS REQUESTS (GROUPS)
  /v4/groups/{id}/access_requests:
    $ref: '#/accessRequestsGroups'

  /v4/groups/{id}/access_requests/{user_id}/approve:
    $ref: '#/accessRequestsGroupsApprove'

  /v4/groups/{id}/access_requests/{user_id}:
    $ref: '#/accessRequestsGroupsDeny'

  # ACCESS REQUESTS (PROJECTS)
  /v4/projects/{id}/access_tokens:
    $ref: '#/accessTokens'

  /v4/projects/{id}/access_tokens/{token_id}:
    $ref: '#/accessTokensRevoke'

metadata:
  get:
    tags:
      - metadata
    summary: 'Retrieve metadata information for this GitLab instance.'
    operationId: 'getMetadata'
    responses:
      '401':
        description: 'unauthorized operation'
      '200':
        description: 'successful operation'
        content:
          'application/json':
            schema:
              title: 'MetadataResponse'
              type: 'object'
              properties:
                version:
                  type: 'string'
                revision:
                  type: 'string'
                kas:
                  type: 'object'
                  properties:
                    enabled:
                      type: 'boolean'
                    externalUrl:
                      type: 'string'
                      nullable: true
                    version:
                      type: 'string'
                      nullable: true
            examples:
              Example:
                value:
                  version: '15.0-pre'
                  revision: 'c401a659d0c'
                  kas:
                    enabled: true
                    externalUrl: 'grpc://gitlab.example.com:8150'
                    version: '15.0.0'

version:
  get:
    tags:
      - version
    summary: 'Retrieve version information for this GitLab instance.'
    operationId: 'getVersion'
    responses:
      '401':
        description: 'unauthorized operation'
      '200':
        description: 'successful operation'
        content:
          'application/json':
            schema:
              title: 'VersionResponse'
              type: 'object'
              properties:
                version:
                  type: 'string'
                revision:
                  type: 'string'
            examples:
              Example:
                value:
                  version: '13.3.0-pre'
                  revision: 'f2b05afebb0'

#/v4/projects/{id}/access_requests
accessRequestsProjects:
  get:
    description: Lists access requests for a project
    summary: List access requests for a project
    operationId: accessRequestsProjects_get
    tags:
      - access_requests
    parameters:
      - name: id
        in: path
        description: The ID or URL-encoded path of the project owned by the authenticated user.
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
    responses:
      '401':
        description: Unauthorized operation
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              title: ProjectAccessResponse
              type: object
              properties:
                id:
                  type: integer
                usename:
                  type: string
                name:
                  type: string
                state:
                  type: string
                created_at:
                  type: string
                requested_at:
                  type: string
            example:
              - 'id': 1
                'username': 'raymond_smith'
                'name': 'Raymond Smith'
                'state': 'active'
                'created_at': '2012-10-22T14:13:35Z'
                'requested_at': '2012-10-22T14:13:35Z'
              - 'id': 2
                'username': 'john_doe'
                'name': 'John Doe'
                'state': 'active'
                'created_at': '2012-10-22T14:13:35Z'
                'requested_at': '2012-10-22T14:13:35Z'
  post:
    description: Requests access for the authenticated user to a project
    summary: Requests access for the authenticated user to a project
    operationId: accessRequestsProjects_post
    tags:
      - access_requests
    parameters:
      - name: id
        in: path
        description: The ID or URL-encoded path of the project owned by the authenticated user.
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
    responses:
      '401':
        description: Unauthorized operation
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              title: ProjectAccessRequest
              type: object
              properties:
                id:
                  type: integer
                usename:
                  type: string
                name:
                  type: string
                state:
                  type: string
                created_at:
                  type: string
                requested_at:
                  type: string
            example:
              'id': 1
              'username': 'raymond_smith'
              'name': 'Raymond Smith'
              'state': 'active'
              'created_at': '2012-10-22T14:13:35Z'
              'requested_at': '2012-10-22T14:13:35Z'

#/v4/projects/{id}/access_requests/{user_id}/approve
accessRequestsProjectsApprove:
  put:
    description: Approves access for the authenticated user to a project
    summary: Approves access for the authenticated user to a project
    operationId: accessRequestsProjectsApprove_put
    tags:
      - access_requests
    parameters:
      - name: id
        in: path
        description: The ID or URL-encoded path of the project owned by the authenticated user.
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
      - name: user_id
        in: path
        description: The userID of the access requester
        required: true
        schema:
          type: integer
      - name: access_level
        in: query
        description: A valid project access level.  0 = no access , 10 = guest, 20 = reporter, 30 = developer, 40 = Maintainer.  Default is 30.'
        required: false
        schema:
          enum: [0, 10, 20, 30, 40]
          default: 30
          type: integer
    responses:
      '401':
        description: Unauthorized operation
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              title: ProjectAccessApprove
              type: object
              properties:
                id:
                  type: integer
                usename:
                  type: string
                name:
                  type: string
                state:
                  type: string
                created_at:
                  type: string
                access_level:
                  type: integer
            example:
              'id': 1
              'username': 'raymond_smith'
              'name': 'Raymond Smith'
              'state': 'active'
              'created_at': '2012-10-22T14:13:35Z'
              'access_level': 20

#/v4/projects/{id}/access_requests/{user_id}
accessRequestsProjectsDeny:
  delete:
    description: Denies a project access request for the given user
    summary: Denies a project access request for the given user
    operationId: accessRequestProjectsDeny_delete
    tags:
      - access_requests
    parameters:
      - name: id
        in: path
        description: The ID or URL-encoded path of the project owned by the authenticated user.
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
      - name: user_id
        in: path
        description: The user ID of the access requester
        required: true
        schema:
          type: integer
    responses: # Does anything go here?  Markdown doc does not list a response.
      '401':
        description: Unauthorized operation
      '200':
        description: Successful operation

#/v4/groups/{id}/access_requests
accessRequestsGroups:
  get:
    description: List access requests for a group
    summary: List access requests for a group
    operationId: accessRequestsGroups_get
    tags:
      - access_requests
    parameters:
      - name: id
        in: path
        description: The ID or URL-encoded path of the group owned by the authenticated user.
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
    responses:
      '401':
        description: Unauthorized operation
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              title: GroupAccessResponse
              type: object
              properties:
                id:
                  type: integer
                usename:
                  type: string
                name:
                  type: string
                state:
                  type: string
                created_at:
                  type: string
                requested_at:
                  type: string
            example:
              - 'id': 1
                'username': 'raymond_smith'
                'name': 'Raymond Smith'
                'state': 'active'
                'created_at': '2012-10-22T14:13:35Z'
                'requested_at': '2012-10-22T14:13:35Z'
              - 'id': 2
                'username': 'john_doe'
                'name': 'John Doe'
                'state': 'active'
                'created_at': '2012-10-22T14:13:35Z'
                'requested_at': '2012-10-22T14:13:35Z'
  post:
    description: Requests access for the authenticated user to a group
    summary: Requests access for the authenticated user to a group
    operationId: accessRequestsGroups_post
    tags:
      - access_requests
    parameters:
      - name: id
        in: path
        description: The ID or URL-encoded path of the group owned by the authenticated user.
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
    responses:
      '401':
        description: Unauthorized operation
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              title: GroupAccessRequest
              type: object
              properties:
                id:
                  type: integer
                usename:
                  type: string
                name:
                  type: string
                state:
                  type: string
                created_at:
                  type: string
                requested_at:
                  type: string
            example:
              'id': 1
              'username': 'raymond_smith'
              'name': 'Raymond Smith'
              'state': 'active'
              'created_at': '2012-10-22T14:13:35Z'
              'requested_at': '2012-10-22T14:13:35Z'

#/v4/groups/{id}/access_requests/{user_id}/approve
accessRequestsGroupsApprove:
  put:
    description: Approves access for the authenticated user to a group
    summary: Approves access for the authenticated user to a group
    operationId: accessRequestsGroupsApprove_put
    tags:
      - access_requests
    parameters:
      - name: id
        in: path
        description: The ID or URL-encoded path of the group owned by the authenticated user.
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
      - name: user_id
        in: path
        description: The userID of the access requester
        required: true
        schema:
          type: integer
      - name: access_level
        in: query
        description: A valid group access level.  0 = no access , 10 = Guest, 20 = Reporter, 30 = Developer, 40 = Maintainer, 50 = Owner.  Default is 30.
        required: false
        schema:
          enum: [0, 10, 20, 30, 40, 50]
          default: 30
          type: integer
    responses:
      '401':
        description: Unauthorized operation
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              title: GroupAccessApprove
              type: object
              properties:
                id:
                  type: integer
                usename:
                  type: string
                name:
                  type: string
                state:
                  type: string
                created_at:
                  type: string
                access_level:
                  type: integer
            example:
              'id': 1
              'username': 'raymond_smith'
              'name': 'Raymond Smith'
              'state': 'active'
              'created_at': '2012-10-22T14:13:35Z'
              'access_level': 20

#/v4/groups/{id}/access_requests/{user_id}
accessRequestsGroupsDeny:
  delete:
    description: Denies a group access request for the given user
    summary: Denies a group access request for the given user
    operationId: accessRequestsGroupsDeny_delete
    tags:
      - access_requests
    parameters:
      - name: id
        in: path
        description: The ID or URL-encoded path of the group owned by the authenticated user.
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
      - name: user_id
        in: path
        description: The userID of the access requester
        required: true
        schema:
          type: integer
    responses: # Does anything go here?  Markdown doc does not list a response.
      '401':
        description: Unauthorized operation
      '200':
        description: Successful operation
#/v4/projects/{id}/access_tokens
accessTokens:
  get:
    description: Lists access tokens for a project
    summary: List access tokens for a project
    operationId: accessTokens_get
    tags:
      - access_tokens
    parameters:
      - name: id
        in: path
        description: The ID or URL-encoded path of the project
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
    responses:
      '404':
        description: Not Found
      '401':
        description: Unauthorized operation
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              title: AccessTokenList
              type: object
              properties:
                user_id:
                  type: integer
                scopes:
                  type: array
                name:
                  type: string
                expires_at:
                  type: date
                id:
                  type: integer
                active:
                  type: boolean
                created_at:
                  type: date
                revoked:
                  type: boolean
            example:
              'user_id': 141
              'scopes': ['api']
              'name': 'token'
              'expires_at': '2022-01-31'
              'id': 42
              'active': true
              'created_at': '2021-01-20T14:13:35Z'
              'revoked': false
  post:
    description: Creates an access token for a project
    summary: Creates an access token for a project
    operationId: accessTokens_post
    tags:
      - access_tokens
    parameters:
      - name: id
        in: path
        description: The ID or URL-encoded path of the project
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
      - name: name
        in: query
        description: The name of the project access token
        required: true
        schema:
          type: string
      - name: scopes
        in: query
        description: Defines read and write permissions for the token
        required: true
        schema:
          type: array
          items:
            type: string
            enum:
              [
                'api',
                'read_api',
                'read_registry',
                'write_registry',
                'read_repository',
                'write_repository',
              ]
      - name: expires_at
        in: query
        description: Date when the token expires. Time of day is Midnight UTC of that date.
        required: false
        schema:
          type: date
    responses:
      '404':
        description: Not Found
      '401':
        description: Unauthorized operation
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              title: AccessTokenList
              type: object
              properties:
                user_id:
                  type: integer
                scopes:
                  type: array
                name:
                  type: string
                expires_at:
                  type: date
                id:
                  type: integer
                active:
                  type: boolean
                created_at:
                  type: date
                revoked:
                  type: boolean
                token:
                  type: string
            example:
              'user_id': 166
              'scopes': ['api', 'read_repository']
              'name': 'test'
              'expires_at': '2022-01-31'
              'id': 58
              'active': true
              'created_at': '2021-01-20T14:13:35Z'
              'revoked': false
              'token': 'D4y...Wzr'

#/v4/projects/{id}/access_tokens/{token_id}
accessTokensRevoke:
  delete:
    description: Revokes an access token
    summary: Revokes an access token
    operationId: accessTokens_delete
    tags:
      - access_tokens
    parameters:
      - name: id
        in: path
        description: The ID or URL-encoded path of the project
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
      - name: token_id
        in: path
        description: The ID of the project access token
        required: true
        schema:
          oneOf:
            - type: integer
            - type: string
    responses:
      '400':
        description: Bad Request
      '404':
        description: Not Found
      '204':
        description: No content if successfully revoked