-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtiktok.yaml
More file actions
1410 lines (1374 loc) · 43.6 KB
/
tiktok.yaml
File metadata and controls
1410 lines (1374 loc) · 43.6 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: TikTok Business APIs
description: TikTok Business API endpoints used by Zernio for content publishing, creator management, and analytics
version: 2.0.0
contact:
name: Zernio Support
url: https://zernio.com
servers:
- url: https://open.tiktokapis.com/v2
description: TikTok Open API
- url: https://www.tiktok.com/v2
description: TikTok OAuth
components:
securitySchemes:
AccessToken:
type: http
scheme: bearer
bearerFormat: access_token
schemas:
UserInfo:
type: object
properties:
open_id:
type: string
description: TikTok user ID
union_id:
type: string
description: Unique user identifier
avatar_url:
type: string
format: uri
description: User's profile picture
display_name:
type: string
description: User's display name
follower_count:
type: integer
description: Number of followers (requires user.info.stats scope)
CreatorInfo:
type: object
properties:
creator_nickname:
type: string
description: Creator's display name
creator_username:
type: string
description: Creator's @username
creator_avatar_url:
type: string
format: uri
privacy_level_options:
type: array
items:
type: string
enum: [PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR, SELF_ONLY]
description: Available privacy settings for this creator
max_video_post_duration_sec:
type: integer
description: Maximum allowed video duration in seconds
is_verified_user:
type: boolean
description: Whether creator has verification badge
can_post_more:
type: boolean
description: Whether creator can make more posts at this time
comment_disabled:
type: boolean
description: Comments disabled in app settings
duet_disabled:
type: boolean
description: Duets disabled in app settings
stitch_disabled:
type: boolean
description: Stitches disabled in app settings
PostInfo:
type: object
properties:
title:
type: string
description: Post caption/title (optional for videos, truncated to 90 chars for photos)
description:
type: string
description: Full description text (photos only, max 4000 characters)
privacy_level:
type: string
enum: [PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR, SELF_ONLY]
description: Post privacy level (must be manually selected from creator options)
disable_comment:
type: boolean
default: true
description: Whether comments are disabled (defaults to true per UX guidelines)
disable_duet:
type: boolean
default: true
description: Whether duets are disabled (videos only)
disable_stitch:
type: boolean
default: true
description: Whether stitches are disabled (videos only)
video_cover_timestamp_ms:
type: integer
default: 1000
description: Video thumbnail timestamp in milliseconds
auto_add_music:
type: boolean
default: false
description: Whether TikTok can add background music
brand_content_toggle:
type: boolean
description: Mark as branded content (paid partnership)
brand_organic_toggle:
type: boolean
description: Mark as brand organic content
is_aigc:
type: boolean
description: Mark as AI-generated content
content_preview_confirmed:
type: boolean
description: User confirmed content preview (UX requirement)
express_consent_given:
type: boolean
description: User gave express consent (UX requirement)
music_usage_confirmed:
type: boolean
description: Music usage terms confirmed (videos only)
user_interaction_confirmed:
type: boolean
description: User interaction settings confirmed (videos only)
SourceInfo:
oneOf:
- type: object
title: PullFromURL
properties:
source:
type: string
enum: [PULL_FROM_URL]
video_url:
type: string
format: uri
description: Public URL to video file (videos only)
photo_images:
type: array
items:
type: string
format: uri
description: Array of image URLs (photos only)
photo_cover_index:
type: integer
default: 0
description: Index of cover image for photo carousel
- type: object
title: FileUpload
properties:
source:
type: string
enum: [FILE_UPLOAD]
video_size:
type: integer
description: Total video file size in bytes
chunk_size:
type: integer
description: Chunk size for upload (5MB-64MB)
total_chunk_count:
type: integer
description: Total number of chunks to upload
PublishResponse:
type: object
properties:
publish_id:
type: string
description: TikTok internal publish ID
upload_url:
type: string
format: uri
description: URL for FILE_UPLOAD method (returned when source is FILE_UPLOAD)
PublishStatus:
type: object
properties:
status:
type: string
enum: [PROCESSING_DOWNLOAD, PROCESSING_UPLOAD, PUBLISH_COMPLETE, FAILED, SEND_TO_USER_INBOX]
description: Current publishing status
fail_reason:
type: string
enum: [
auth_removed,
file_format_check_failed,
duration_check_failed,
frame_rate_check_failed,
picture_size_check_failed,
video_pull_failed,
photo_pull_failed,
spam_risk_too_many_posts,
spam_risk_user_banned_from_posting,
spam_risk_text,
spam_risk,
internal,
publish_cancelled
]
description: Failure reason if status is FAILED
publicly_available_post_id:
type: array
items:
type: string
description: Public post IDs (available when status is PUBLISH_COMPLETE)
share_url:
type: string
format: uri
description: Public URL to the published post
Video:
type: object
properties:
id:
type: string
description: TikTok video ID
title:
type: string
description: Video title/caption
video_description:
type: string
description: Video description
create_time:
type: integer
description: Creation timestamp (Unix seconds)
cover_image_url:
type: string
format: uri
description: Video thumbnail URL
share_url:
type: string
format: uri
description: Public video URL
duration:
type: integer
description: Video duration in seconds (0 for photo posts)
height:
type: integer
width:
type: integer
like_count:
type: integer
comment_count:
type: integer
share_count:
type: integer
view_count:
type: integer
TokenResponse:
type: object
properties:
access_token:
type: string
token_type:
type: string
default: bearer
expires_in:
type: integer
description: Token lifetime in seconds
refresh_token:
type: string
refresh_expires_in:
type: integer
description: Refresh token lifetime in seconds
scope:
type: string
description: Granted scopes
open_id:
type: string
description: User's open ID
ErrorResponse:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
log_id:
type: string
paths:
# OAuth Authorization
/auth/authorize:
get:
servers:
- url: https://www.tiktok.com/v2
summary: Get TikTok authorization URL
description: Redirect user to TikTok authorization page
parameters:
- name: client_key
in: query
required: true
schema:
type: string
description: TikTok App ID
- name: redirect_uri
in: query
required: true
schema:
type: string
format: uri
description: Redirect URI registered with app
- name: scope
in: query
required: true
schema:
type: string
example: "user.info.basic,user.info.profile,user.info.stats,video.publish,video.upload,video.list"
description: Comma-separated list of permissions
- name: response_type
in: query
required: true
schema:
type: string
enum: [code]
- name: disable_auto_auth
in: query
schema:
type: string
enum: ["1"]
description: Disable automatic authorization
- name: state
in: query
schema:
type: string
description: CSRF protection state parameter
responses:
'302':
description: Redirect to authorization page
# OAuth Token Exchange
/oauth/token/:
post:
summary: Exchange authorization code for access token or refresh token
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
client_key:
type: string
description: TikTok App ID
client_secret:
type: string
description: TikTok App Secret
code:
type: string
description: Authorization code (for initial exchange)
redirect_uri:
type: string
format: uri
description: Redirect URI (for initial exchange)
grant_type:
type: string
enum: [authorization_code, refresh_token]
refresh_token:
type: string
description: Refresh token (for token refresh)
required:
- client_key
- client_secret
- grant_type
responses:
'200':
description: Token response
content:
application/json:
schema:
$ref: '#/components/schemas/TokenResponse'
'400':
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
# User Information (v2 API - Current)
/v2/user/info/:
get:
summary: Get user profile information
description: |
Returns basic information for a given TikTok user. This is the v2 API endpoint (current).
Requires relevant scopes to be authorized by the TikTok user.
security:
- AccessToken: []
parameters:
- name: fields
in: query
required: true
schema:
type: string
example: "open_id,union_id,avatar_url,display_name,follower_count"
description: |
Comma-separated list of user fields to request. Available fields:
- open_id, union_id, avatar_url, avatar_url_100, avatar_large_url (user.info.basic)
- display_name, bio_description, profile_deep_link, is_verified, username (user.info.profile)
- follower_count, following_count, likes_count, video_count (user.info.stats)
responses:
'200':
description: User information
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
user:
$ref: '#/components/schemas/UserInfo'
error:
$ref: '#/components/schemas/ErrorResponse'
'400':
description: Invalid request or missing scopes
# User Information (v1 API - Deprecated)
/user/info/:
post:
summary: Get user profile information (v1 - Deprecated)
description: |
**DEPRECATED**: Use GET /v2/user/info/ instead.
This is the legacy v1 API endpoint. TikTok recommends migrating to v2.
deprecated: true
security:
- AccessToken: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
access_token:
type: string
description: The access token
open_id:
type: string
description: The user's open_id
fields:
type: array
items:
type: string
description: List of fields to return
responses:
'200':
description: User information
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
user:
$ref: '#/components/schemas/UserInfo'
'400':
description: Invalid request or missing scopes
# Creator Information (UX Requirements)
/post/publish/creator_info/query/:
post:
summary: Get creator information for UX compliance
description: Required before showing TikTok posting interface to ensure UX compliance
security:
- AccessToken: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties: {}
responses:
'200':
description: Creator information with UX requirements
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/CreatorInfo'
'403':
description: Creator not eligible or insufficient permissions
# Direct Post - Video
/post/publish/video/init/:
post:
summary: Initialize video post (Direct Post or Creator Inbox)
description: Publish video directly or send to Creator Inbox based on post_mode
security:
- AccessToken: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- post_info
- source_info
properties:
media_type:
type: string
enum: [VIDEO]
post_mode:
type: string
enum: [DIRECT_POST, MEDIA_UPLOAD]
description: DIRECT_POST for immediate publishing, MEDIA_UPLOAD for Creator Inbox
post_info:
$ref: '#/components/schemas/PostInfo'
source_info:
$ref: '#/components/schemas/SourceInfo'
responses:
'200':
description: Video post initialization successful
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/PublishResponse'
'400':
description: Invalid request or UX validation failed
'403':
description: Insufficient permissions or audit requirements not met
# Direct Post - Photo/Carousel
/post/publish/content/init/:
post:
summary: Initialize photo/carousel post (Direct Post or Creator Inbox)
description: Publish photos directly or send to Creator Inbox based on post_mode
security:
- AccessToken: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- post_info
- source_info
- media_type
properties:
media_type:
type: string
enum: [PHOTO]
post_mode:
type: string
enum: [DIRECT_POST, MEDIA_UPLOAD]
description: DIRECT_POST for immediate publishing, MEDIA_UPLOAD for Creator Inbox
post_info:
$ref: '#/components/schemas/PostInfo'
source_info:
type: object
properties:
source:
type: string
enum: [PULL_FROM_URL]
photo_images:
type: array
items:
type: string
format: uri
description: Array of image URLs (up to 35 images)
photo_cover_index:
type: integer
default: 0
description: Index of cover image
responses:
'200':
description: Photo post initialization successful
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/PublishResponse'
# Creator Inbox - Video Only
/post/publish/inbox/video/init/:
post:
summary: Send video to Creator Inbox as draft
description: Upload video to Creator Inbox for later publishing (draft mode)
security:
- AccessToken: []
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- type: object
title: PullFromURL
properties:
source_info:
type: object
properties:
source:
type: string
enum: [PULL_FROM_URL]
video_url:
type: string
format: uri
- type: object
title: FileUpload
properties:
post_info:
$ref: '#/components/schemas/PostInfo'
source_info:
type: object
properties:
source:
type: string
enum: [FILE_UPLOAD]
video_size:
type: integer
chunk_size:
type: integer
total_chunk_count:
type: integer
post_mode:
type: string
enum: [MEDIA_UPLOAD]
responses:
'200':
description: Video sent to Creator Inbox
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
publish_id:
type: string
upload_url:
type: string
format: uri
post_id:
type: string
# Publish Status Check
/post/publish/status/fetch/:
post:
summary: Check publishing status
description: Poll the status of a video/photo upload
security:
- AccessToken: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- publish_id
properties:
publish_id:
type: string
description: Publish ID from init response
responses:
'200':
description: Status information
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/PublishStatus'
# Video List (Account Posts)
/video/list/:
post:
summary: Get user's published videos
security:
- AccessToken: []
parameters:
- name: fields
in: query
required: true
schema:
type: string
example: "id,title,create_time,cover_image_url,share_url,video_description,duration,height,width,like_count,comment_count,share_count,view_count"
- name: max_count
in: query
schema:
type: integer
minimum: 1
maximum: 20
default: 10
- name: cursor
in: query
schema:
type: integer
description: Pagination cursor
requestBody:
required: true
content:
application/json:
schema:
type: object
properties: {}
responses:
'200':
description: List of user videos
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
videos:
type: array
items:
$ref: '#/components/schemas/Video'
cursor:
type: integer
has_more:
type: boolean
# Video Analytics
/video/query/:
post:
summary: Get video analytics
security:
- AccessToken: []
parameters:
- name: fields
in: query
required: true
schema:
type: string
example: "like_count,comment_count,share_count,view_count"
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- filters
properties:
filters:
type: object
properties:
video_ids:
type: array
items:
type: string
description: List of video IDs to query
responses:
'200':
description: Video analytics data
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
videos:
type: array
items:
$ref: '#/components/schemas/Video'
# Comments - Post Comment
/comment/publish/:
post:
summary: Post comment or reply to comment
description: TikTok comments API is write-only (cannot read existing comments)
security:
- AccessToken: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- video_id
- text
properties:
video_id:
type: string
description: TikTok video ID
text:
type: string
description: Comment text
reply_to_comment_id:
type: string
description: Parent comment ID (for replies)
responses:
'200':
description: Comment posted successfully
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
comment_id:
type: string
error:
type: object
properties:
code:
type: string
message:
type: string
# Comments - Delete Comment
/comment/delete/:
post:
summary: Delete comment
security:
- AccessToken: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- video_id
- comment_id
properties:
video_id:
type: string
comment_id:
type: string
responses:
'200':
description: Comment deleted successfully
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
# Research API - Video Query
/research/video/query/:
post:
summary: Query TikTok public content data (Research API)
description: Query videos with conditions like region, keywords, hashtags, etc.
security:
- AccessToken: []
parameters:
- name: fields
in: query
required: true
schema:
type: string
example: "id,like_count,comment_count,share_count,view_count,create_time,username"
description: Comma-separated list of video fields to return
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- query
- start_date
- end_date
properties:
query:
type: object
description: Query conditions with AND, OR, NOT operators
properties:
and:
type: array
items:
type: object
properties:
operation:
type: string
enum: [EQ, IN, GT, GTE, LT, LTE]
field_name:
type: string
enum: [keyword, create_date, username, region_code, video_id, hashtag_name, music_id, effect_id, video_length]
field_values:
type: array
items:
type: string
or:
type: array
items:
type: object
properties:
operation:
type: string
enum: [EQ, IN, GT, GTE, LT, LTE]
field_name:
type: string
enum: [keyword, create_date, username, region_code, video_id, hashtag_name, music_id, effect_id, video_length]
field_values:
type: array
items:
type: string
not:
type: array
items:
type: object
properties:
operation:
type: string
enum: [EQ, IN, GT, GTE, LT, LTE]
field_name:
type: string
enum: [keyword, create_date, username, region_code, video_id, hashtag_name, music_id, effect_id, video_length]
field_values:
type: array
items:
type: string
max_count:
type: integer
minimum: 1
maximum: 100
default: 10
cursor:
type: integer
default: 0
start_date:
type: string
pattern: '^[0-9]{8}$'
example: "20220615"
description: Start date in YYYYMMDD format
end_date:
type: string
pattern: '^[0-9]{8}$'
example: "20220628"
description: End date in YYYYMMDD format
is_random:
type: boolean
default: false
search_id:
type: string
description: Search ID for pagination (returned in previous response)
responses:
'200':
description: Video research data
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
videos:
type: array
items:
$ref: '#/components/schemas/Video'
cursor:
type: integer
has_more:
type: boolean
search_id:
type: string
error:
$ref: '#/components/schemas/ErrorResponse'
# Research API - User Info
/research/user/info/:
post:
summary: Get public TikTok account information (Research API)