-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreddit.yaml
More file actions
2484 lines (2416 loc) · 71.4 KB
/
reddit.yaml
File metadata and controls
2484 lines (2416 loc) · 71.4 KB
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
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.3
info:
title: Reddit API
description: |
The Reddit API provides programmatic access to Reddit's features including submissions,
comments, subreddits, user profiles, voting, moderation, messaging, and wiki management.
**Key Features:**
- **Submissions**: Create and manage posts, links, and content
- **Comments**: Comment management and threading
- **Subreddits**: Community information and moderation
- **Users**: User profiles, trophies, and account management
- **Voting**: Upvote and downvote functionality
- **Moderation**: Content moderation and community management
- **Messages**: Private messaging system
- **Wiki**: Wiki pages and collaborative editing
- **Search**: Content discovery and search
**Authentication:** OAuth 2.0 with multiple scopes for granular permissions
**Base URL:** https://oauth.reddit.com (for authenticated requests)
**Rate Limiting:** 60 requests per minute for most endpoints
version: "1.0"
contact:
name: Reddit API Documentation
url: https://www.reddit.com/dev/api
license:
name: Reddit API Terms
url: https://www.reddit.com/wiki/api
servers:
- url: https://oauth.reddit.com
description: Reddit OAuth API
- url: https://www.reddit.com
description: Reddit Public API (limited functionality)
paths:
# Submissions (Posts)
/api/submit:
post:
tags: [Submissions]
summary: Submit a post
description: |
Submit a link or text post to a subreddit. Supports various post types including
text posts, link posts, image posts, video posts, and polls.
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
kind:
type: string
enum: [link, self, image, video, videogif, poll]
description: Type of submission
default: self
sr:
type: string
description: Subreddit name (without /r/ prefix)
example: "AskReddit"
title:
type: string
description: Title of the submission
maxLength: 300
example: "What's the best advice you've ever received?"
text:
type: string
description: Body text for self posts (Markdown supported)
url:
type: string
format: uri
description: URL for link posts
nsfw:
type: boolean
description: Mark post as NSFW (Not Safe For Work)
default: false
spoiler:
type: boolean
description: Mark post as containing spoilers
default: false
sendreplies:
type: boolean
description: Send inbox replies for comments
default: true
flair_id:
type: string
description: Flair template ID
flair_text:
type: string
description: Custom flair text
crosspost_fullname:
type: string
description: Fullname of post being crossposted
poll_options:
type: string
description: Poll options (comma-separated for poll posts)
poll_duration:
type: integer
description: Poll duration in days (1-7)
minimum: 1
maximum: 7
g-recaptcha-response:
type: string
description: reCAPTCHA response (if required)
api_type:
type: string
enum: [json]
default: json
description: Response format
required: [sr, title]
responses:
'200':
description: Submission created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SubmissionResponse'
example:
json:
errors: []
data:
url: "https://www.reddit.com/r/AskReddit/comments/abc123/whats_the_best_advice/"
drafts_count: 0
id: "abc123"
name: "t3_abc123"
'400':
description: Bad request - validation errors
'403':
description: Forbidden - insufficient permissions
'429':
description: Rate limit exceeded
security:
- OAuth2: [submit]
# Get Submission Details
/comments/{article}:
get:
tags: [Submissions]
summary: Get submission and comments
description: Get a submission with its comments thread
parameters:
- name: article
in: path
required: true
description: Submission ID (without t3_ prefix)
schema:
type: string
example: "abc123"
- name: comment
in: query
description: Specific comment ID to focus on
schema:
type: string
- name: context
in: query
description: Number of parent comments to show
schema:
type: integer
minimum: 0
maximum: 8
- name: depth
in: query
description: Maximum comment thread depth
schema:
type: integer
minimum: 1
maximum: 10
- name: limit
in: query
description: Maximum number of comments
schema:
type: integer
minimum: 1
maximum: 500
- name: showedits
in: query
description: Show comment edit history
schema:
type: boolean
- name: showmore
in: query
description: Show "more comments" links
schema:
type: boolean
default: true
- name: sort
in: query
description: Comment sort order
schema:
type: string
enum: [confidence, top, new, controversial, old, random, qa, live]
default: confidence
- name: threaded
in: query
description: Show threaded comments
schema:
type: boolean
default: true
- name: truncate
in: query
description: Truncate long comment trees
schema:
type: integer
responses:
'200':
description: Submission and comments retrieved successfully
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Listing'
'404':
description: Submission not found
security:
- OAuth2: [read]
- ApiKeyAuth: []
# Comments
/api/comment:
post:
tags: [Comments]
summary: Add a comment
description: Add a comment to a submission or reply to an existing comment
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
parent:
type: string
description: Fullname of parent (submission or comment)
example: "t3_abc123"
text:
type: string
description: Comment text (Markdown supported)
example: "This is a great post! Thanks for sharing."
api_type:
type: string
enum: [json]
default: json
required: [parent, text]
responses:
'200':
description: Comment added successfully
content:
application/json:
schema:
$ref: '#/components/schemas/CommentResponse'
'400':
description: Bad request
'403':
description: Forbidden
'429':
description: Rate limit exceeded
security:
- OAuth2: [submit]
/api/editusertext:
post:
tags: [Comments]
summary: Edit comment or submission text
description: Edit the text of a comment or self-post
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
thing_id:
type: string
description: Fullname of comment or submission
example: "t1_def456"
text:
type: string
description: New text content (Markdown supported)
api_type:
type: string
enum: [json]
default: json
required: [thing_id, text]
responses:
'200':
description: Text edited successfully
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'403':
description: Cannot edit this item
security:
- OAuth2: [edit]
/api/del:
post:
tags: [Comments]
summary: Delete comment or submission
description: Delete a comment or submission
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
id:
type: string
description: Fullname of item to delete
example: "t1_def456"
api_type:
type: string
enum: [json]
default: json
required: [id]
responses:
'200':
description: Item deleted successfully
'403':
description: Cannot delete this item
security:
- OAuth2: [edit]
# Voting
/api/vote:
post:
tags: [Voting]
summary: Vote on a post or comment
description: Cast an upvote, downvote, or remove vote
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
id:
type: string
description: Fullname of item to vote on
example: "t3_abc123"
dir:
type: integer
enum: [-1, 0, 1]
description: Vote direction (-1=downvote, 0=remove vote, 1=upvote)
rank:
type: integer
description: Vote rank (for contest mode)
required: [id, dir]
responses:
'200':
description: Vote cast successfully
'403':
description: Cannot vote on this item
'429':
description: Rate limit exceeded
security:
- OAuth2: [vote]
/api/info:
get:
tags: [Submissions]
summary: Get information about links/submissions
description: |
Return a listing of links/submissions specified by their fullnames.
This is useful for getting detailed information about specific submissions by their IDs.
parameters:
- name: id
in: query
description: A comma-separated list of link fullnames (e.g., t3_abc123,t3_def456)
schema:
type: string
example: "t3_abc123,t3_def456"
- name: sr_name
in: query
description: Restrict results to a specific subreddit (optional)
schema:
type: string
example: "AskReddit"
- name: url
in: query
description: Return information about the submission with the given URL (optional)
schema:
type: string
format: url
responses:
'200':
description: Link/submission information retrieved successfully
content:
application/json:
schema:
type: object
properties:
kind:
type: string
enum: [Listing]
data:
type: object
properties:
modhash:
type: string
dist:
type: integer
children:
type: array
items:
type: object
properties:
kind:
type: string
enum: [t3]
data:
$ref: '#/components/schemas/Submission'
after:
type: string
nullable: true
before:
type: string
nullable: true
'400':
description: Invalid parameters
'429':
description: Rate limit exceeded
# Subreddit Information
/r/{subreddit}/about:
get:
tags: [Subreddits]
summary: Get subreddit information
description: Get detailed information about a subreddit
parameters:
- name: subreddit
in: path
required: true
description: Subreddit name
schema:
type: string
example: "AskReddit"
responses:
'200':
description: Subreddit information retrieved successfully
content:
application/json:
schema:
type: object
properties:
kind:
type: string
example: "t5"
data:
$ref: '#/components/schemas/Subreddit'
'404':
description: Subreddit not found
security:
- OAuth2: [read]
- ApiKeyAuth: []
# Subreddit Posts
/r/{subreddit}:
get:
tags: [Subreddits]
summary: Get subreddit posts
description: Get posts from a specific subreddit
parameters:
- name: subreddit
in: path
required: true
description: Subreddit name
schema:
type: string
example: "AskReddit"
- name: sort
in: query
description: Sort order for posts
schema:
type: string
enum: [hot, new, rising, top]
default: hot
- name: t
in: query
description: Time period for top sorting
schema:
type: string
enum: [hour, day, week, month, year, all]
default: all
- name: limit
in: query
description: Number of posts to retrieve
schema:
type: integer
minimum: 1
maximum: 100
default: 25
- name: after
in: query
description: Fullname for pagination
schema:
type: string
- name: before
in: query
description: Fullname for pagination
schema:
type: string
- name: count
in: query
description: Number of items already seen
schema:
type: integer
- name: show
in: query
description: Show all posts (including filtered)
schema:
type: string
enum: [all]
responses:
'200':
description: Posts retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Listing'
'404':
description: Subreddit not found
security:
- OAuth2: [read]
- ApiKeyAuth: []
# User Profile
/user/{username}/about:
get:
tags: [Users]
summary: Get user information
description: Get public information about a user
parameters:
- name: username
in: path
required: true
description: Reddit username
schema:
type: string
example: "spez"
responses:
'200':
description: User information retrieved successfully
content:
application/json:
schema:
type: object
properties:
kind:
type: string
example: "t2"
data:
$ref: '#/components/schemas/Account'
'404':
description: User not found
security:
- OAuth2: [read]
- ApiKeyAuth: []
# Current User
/api/v1/me:
get:
tags: [Users]
summary: Get current user info
description: Get information about the authenticated user
responses:
'200':
description: User information retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Account'
'401':
description: Not authenticated
security:
- OAuth2: [identity]
# User Preferences
/api/v1/me/prefs:
get:
tags: [Users]
summary: Get user preferences
description: Get the authenticated user's preferences
responses:
'200':
description: Preferences retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/UserPreferences'
'401':
description: Not authenticated
security:
- OAuth2: [identity]
patch:
tags: [Users]
summary: Update user preferences
description: Update the authenticated user's preferences
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserPreferences'
responses:
'200':
description: Preferences updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/UserPreferences'
'400':
description: Invalid preferences
'401':
description: Not authenticated
security:
- OAuth2: [identity]
# User Trophies
/api/v1/user/{username}/trophies:
get:
tags: [Users]
summary: Get user trophies
description: Get trophies for a specific user
parameters:
- name: username
in: path
required: true
description: Reddit username
schema:
type: string
responses:
'200':
description: Trophies retrieved successfully
content:
application/json:
schema:
type: object
properties:
kind:
type: string
example: "TrophyList"
data:
type: object
properties:
trophies:
type: array
items:
$ref: '#/components/schemas/Trophy'
'404':
description: User not found
security:
- OAuth2: [read]
# Search
/search:
get:
tags: [Search]
summary: Search Reddit content
description: Search for submissions, subreddits, or users
parameters:
- name: q
in: query
required: true
description: Search query
schema:
type: string
example: "python programming"
- name: type
in: query
description: Type of content to search
schema:
type: string
enum: [sr, sr_name, user, link]
default: link
- name: sort
in: query
description: Sort order
schema:
type: string
enum: [relevance, hot, top, new, comments]
default: relevance
- name: t
in: query
description: Time period for sorting
schema:
type: string
enum: [hour, day, week, month, year, all]
default: all
- name: limit
in: query
description: Number of results
schema:
type: integer
minimum: 1
maximum: 100
default: 25
- name: after
in: query
description: Fullname for pagination
schema:
type: string
- name: before
in: query
description: Fullname for pagination
schema:
type: string
- name: restrict_sr
in: query
description: Restrict search to specific subreddit
schema:
type: boolean
- name: include_over_18
in: query
description: Include NSFW results
schema:
type: boolean
responses:
'200':
description: Search results retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Listing'
'400':
description: Invalid search parameters
security:
- OAuth2: [read]
- ApiKeyAuth: []
# Private Messages
/message/inbox:
get:
tags: [Messages]
summary: Get inbox messages
description: Get private messages in the user's inbox
parameters:
- name: mark
in: query
description: Mark messages as read
schema:
type: boolean
default: false
- name: limit
in: query
description: Number of messages
schema:
type: integer
minimum: 1
maximum: 100
default: 25
- name: after
in: query
description: Fullname for pagination
schema:
type: string
- name: before
in: query
description: Fullname for pagination
schema:
type: string
responses:
'200':
description: Messages retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Listing'
'401':
description: Not authenticated
security:
- OAuth2: [privatemessages]
/api/compose:
post:
tags: [Messages]
summary: Send private message
description: Send a private message to another user
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
to:
type: string
description: Username of recipient
example: "spez"
subject:
type: string
description: Message subject
maxLength: 100
text:
type: string
description: Message body (Markdown supported)
from_sr:
type: string
description: Subreddit to send from (for moderator mail)
api_type:
type: string
enum: [json]
default: json
required: [to, subject, text]
responses:
'200':
description: Message sent successfully
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'400':
description: Invalid message parameters
'403':
description: Cannot send message to this user
security:
- OAuth2: [privatemessages]
# Moderation
/api/approve:
post:
tags: [Moderation]
summary: Approve content
description: Approve a submission or comment
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
id:
type: string
description: Fullname of item to approve
example: "t3_abc123"
api_type:
type: string
enum: [json]
default: json
required: [id]
responses:
'200':
description: Content approved successfully
'403':
description: Insufficient moderation privileges
security:
- OAuth2: [modposts]
/api/remove:
post:
tags: [Moderation]
summary: Remove content
description: Remove a submission or comment
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
id:
type: string
description: Fullname of item to remove
example: "t3_abc123"
spam:
type: boolean
description: Mark as spam
default: false
api_type:
type: string
enum: [json]
default: json
required: [id]
responses:
'200':
description: Content removed successfully
'403':
description: Insufficient moderation privileges
security:
- OAuth2: [modposts]
/api/distinguish:
post:
tags: [Moderation]
summary: Distinguish content
description: Distinguish a comment or submission as moderator/admin
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
id:
type: string
description: Fullname of item to distinguish
example: "t1_def456"
how:
type: string
enum: [yes, no, admin, special]
description: How to distinguish the item
sticky:
type: boolean
description: Sticky the comment (moderator comments only)
default: false
api_type:
type: string
enum: [json]
default: json
required: [id, how]
responses:
'200':
description: Content distinguished successfully
'403':
description: Insufficient privileges
security:
- OAuth2: [modposts]
# Wiki
/r/{subreddit}/wiki/{page}:
get:
tags: [Wiki]
summary: Get wiki page
description: Get the content of a wiki page
parameters:
- name: subreddit
in: path
required: true
description: Subreddit name
schema:
type: string
- name: page
in: path
required: true
description: Wiki page name
schema:
type: string
example: "index"
- name: v
in: query
description: Specific revision ID
schema:
type: string
responses:
'200':
description: Wiki page retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/WikiPage'
'403':
description: Page is private or restricted
'404':
description: Page not found
security:
- OAuth2: [wikiread]
- ApiKeyAuth: []
/r/{subreddit}/api/wiki/edit:
post:
tags: [Wiki]
summary: Edit wiki page
description: Create or edit a wiki page
parameters:
- name: subreddit
in: path
required: true
description: Subreddit name
schema:
type: string
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
page:
type: string
description: Wiki page name
example: "index"
content:
type: string
description: Page content (Markdown supported)
reason:
type: string
description: Edit reason/summary
maxLength: 256
previous:
type: string
description: Previous revision ID (for conflict detection)
api_type:
type: string
enum: [json]
default: json
required: [page, content]
responses:
'200':