nodejs-insta-private-api-mqtt 1.3.65 → 1.3.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +1420 -36
  2. package/dist/constants/index.js +8 -2
  3. package/dist/core/client.js +34 -0
  4. package/dist/index.js +61 -7
  5. package/dist/repositories/account.repository.js +382 -82
  6. package/dist/repositories/bloks.repository.js +70 -0
  7. package/dist/repositories/captcha.repository.js +44 -0
  8. package/dist/repositories/challenge.repository.js +120 -0
  9. package/dist/repositories/clip.repository.js +165 -0
  10. package/dist/repositories/direct.repository.js +113 -33
  11. package/dist/repositories/explore.repository.js +70 -0
  12. package/dist/repositories/fbsearch.repository.js +140 -0
  13. package/dist/repositories/feed.repository.js +98 -85
  14. package/dist/repositories/friendship.repository.js +146 -30
  15. package/dist/repositories/fundraiser.repository.js +49 -0
  16. package/dist/repositories/insights.repository.js +82 -0
  17. package/dist/repositories/media.repository.js +140 -41
  18. package/dist/repositories/multiple-accounts.repository.js +41 -0
  19. package/dist/repositories/note.repository.js +57 -0
  20. package/dist/repositories/notification.repository.js +79 -0
  21. package/dist/repositories/share.repository.js +35 -0
  22. package/dist/repositories/signup.repository.js +218 -0
  23. package/dist/repositories/story.repository.js +192 -57
  24. package/dist/repositories/timeline.repository.js +60 -0
  25. package/dist/repositories/totp.repository.js +139 -0
  26. package/dist/repositories/track.repository.js +53 -0
  27. package/dist/repositories/upload.repository.js +63 -21
  28. package/dist/repositories/user.repository.js +240 -36
  29. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- Dear users,
2
- I post many versions of the project because Instagram changes the protocol almost daily, if you like this project leave a star on github https://github.com/Kunboruto20/nodejs-insta-private-api.git
1
+ Full featured Java and nodejs Instagram api private with Mqtt full suport and api rest
3
2
 
3
+ Dear users The repository on github is currently unavailable will be available soon
4
4
 
5
5
  If you Like This Project You Can Help Me with Donation revolut , My revolut revtag is @gvny22
6
6
 
@@ -11,40 +11,46 @@ This project implements a complete and production-ready MQTT protocol client for
11
11
 
12
12
  By leveraging MQTT instead of Instagram's REST API, this library achieves sub-500ms message latency, bidirectional real-time communication, and native support for notifications, presence tracking, and thread management. The implementation is reverse-engineered from Instagram's mobile app protocol and tested extensively for reliability and compatibility.
13
13
 
14
- ## Features (v5.61.11 - iOS + Android Full Support)
15
-
16
- - **NEW: FULL iOS SUPPORT** - iPhone 16/15/14/13/12 + iPad Pro/Air device emulation
17
- - **NEW: FULL ANDROID SUPPORT** - Samsung, Huawei, Google Pixel, OnePlus, Xiaomi, OPPO
18
- - **NEW: 33 Preset Devices** - 21 iOS + 12 Android devices ready to use
19
- - **NEW: switchPlatform()** - Switch between iOS and Android with one line
20
- - **NEW: useIOSDevice()** - Emulate any iPhone or iPad
21
- - **NEW: useAndroidDevice()** - Emulate any Android phone
22
- - **NEW: getPlatformInfo()** - Get current platform and device details
23
- - **NEW: downloadContentFromMessage()** - Download media from DM messages (like Baileys for WhatsApp)
24
- - **NEW: View-Once Media Extraction** - Save disappearing photos/videos before they expire
25
- - **NEW: downloadMediaBuffer()** - Get media as Buffer directly
26
- - **NEW: extractMediaUrls()** - Extract CDN URLs from any message type
27
- - **NEW: Custom Device Emulation** - Choose which phone model Instagram sees
28
- - **NEW: setCustomDevice()** - Set any custom Android device with full control
29
- - **NEW: setIOSDevice()** - Set any custom iOS device with full control
30
- - **FIX: IRIS subscription auto-fetch** - Messages now received automatically without manual irisData
31
- - **FIX: startRealTimeListener()** - Fixed to use correct inbox method for IRIS data retrieval
32
- - **NEW: sendPhoto() / sendVideo()** - Upload and send photos/videos directly via MQTT
33
- - **NEW: Clear message display** - Incoming messages shown with Username, ID, Text, Status
34
- - **NEW: All message types decoded** - Photos, videos, voice, reels, stories, links displayed clearly
35
- - Multi-file auth state - Session persistence like Baileys (WhatsApp library)
36
- - Real-time MQTT messaging - Receive and send DMs with <500ms latency
37
- - Bidirectional communication - Send messages back through the same MQTT connection
38
- - Message management - Send, delete, edit, and reply to messages via MQTT
39
- - Notification subscriptions - Follow, mention, and call notifications via MQTT
40
- - Thread management - Add/remove members from groups via MQTT
41
- - Auto-reply bots - Build keyword-triggered or scheduled response bots
42
- - Session persistence - Avoid repeated logins with saved sessions
43
- - Full Instagram API - Stories, media uploads, search, comments, user info
44
- - Group chat support - Automatic detection with thread-based messaging
45
- - IRIS subscription protocol - Reliable message delivery with compression
46
- - Automatic reconnection - Exponential backoff with connection pooling
47
- - Pure JavaScript - No compilation required, works in Node.js 18+
14
+ ## Features (v5.66.0 - Complete REST API + MQTT)
15
+
16
+ ### REST API (32 Repositories)
17
+ - **Account** - Login, 2FA (TOTP + SMS), challenge resolver, edit profile, change password, privacy settings
18
+ - **User** - Info, search, follow/unfollow, block/unblock, mute, get posts/reels/stories with pagination
19
+ - **Media** - Like, comment (pin/unpin/bulk delete/reply), save, archive, download, PK/shortcode conversion
20
+ - **Reels/Clips** - Upload, configure, discover reels, download, music info
21
+ - **Stories** - Upload photo/video stories, react, mark seen, highlights management
22
+ - **Highlights** - Create, edit, delete highlights, add/remove stories, update cover
23
+ - **Direct Messages** - Send text/photo/video/link/media, inbox, pending inbox, group threads
24
+ - **Friendship** - Follow, block, restrict, close friends, favorites, pending requests
25
+ - **Search** - Users, hashtags, places, music, recent/suggested searches
26
+ - **Explore** - Topical explore, report, mark seen
27
+ - **Feed** - Timeline, hashtag/location feeds, saved/liked, carousel upload
28
+ - **Upload** - Photo/video upload with configure to feed, story, or clips
29
+ - **Insights** - Account, media, reel, story analytics (business/creator accounts)
30
+ - **Notes** - Create, delete, view Instagram Notes
31
+ - **Notifications** - Per-type notification settings (likes, comments, follows, etc.)
32
+ - **TOTP** - 2FA setup with authenticator app, SMS 2FA, backup codes
33
+ - **Challenge** - Auto-resolve security checkpoints, verify methods
34
+ - **Signup** - Account creation, email/phone verification, username availability
35
+ - **Music/Tracks** - Search, get info, download audio tracks
36
+ - **Fundraiser** - Create, donate, get fundraiser info
37
+ - **Multiple Accounts** - Account family, switch accounts
38
+ - **Captcha** - reCAPTCHA / hCaptcha handling
39
+ - **Share** - Decode QR/NFC share codes, parse share URLs
40
+ - **Bloks** - Low-level Instagram Bloks engine actions
41
+
42
+ ### MQTT Real-Time
43
+ - **Real-time MQTT messaging** - Receive and send DMs with <500ms latency
44
+ - **FBNS Push Notifications** - Follows, likes, comments, story mentions, live broadcasts
45
+ - **33 Preset Devices** - 21 iOS + 12 Android device emulation
46
+ - **View-Once Media** - Download disappearing photos/videos before they expire
47
+ - **sendPhoto() / sendVideo()** - Upload and send media directly via MQTT
48
+ - **Session persistence** - Multi-file auth state like Baileys (WhatsApp library)
49
+ - **Automatic reconnection** - Smart error classification with type-specific backoff
50
+ - **Session health monitoring** - Auto-relogin, uptime tracking
51
+ - **Persistent logging** - File-based logging with rotation
52
+ - **Message ordering** - Per-thread message queuing
53
+ - **Pure JavaScript** - No compilation required, works in Node.js 18+
48
54
 
49
55
  ## Scope: DM-Focused Implementation
50
56
 
@@ -802,6 +808,1349 @@ const thread = await ig.direct.getThread(threadId);
802
808
  await ig.direct.sendText({ thread_ids: [threadId], text: 'Hello' });
803
809
  ```
804
810
 
811
+ ---
812
+
813
+ ## REST API — Full Reference (v5.66.0)
814
+
815
+ Everything below uses the REST HTTP endpoints, not MQTT. You don't need `RealtimeClient` for any of this — just `IgApiClient` and a valid session.
816
+
817
+ ```javascript
818
+ const { IgApiClient } = require('nodejs-insta-private-api-mqtt');
819
+ const ig = new IgApiClient();
820
+
821
+ ig.state.usePresetDevice('Samsung Galaxy S25 Ultra');
822
+ await ig.login({ username: 'your_username', password: 'your_password' });
823
+ // you're ready to use any of the methods below
824
+ ```
825
+
826
+ ---
827
+
828
+ ### Authentication & Login
829
+
830
+ #### Basic Login
831
+
832
+ ```javascript
833
+ await ig.login({ username: 'your_username', password: 'your_password' });
834
+
835
+ // or the shorter way
836
+ await ig.account.login('your_username', 'your_password');
837
+ ```
838
+
839
+ #### Two-Factor Authentication (2FA)
840
+
841
+ When Instagram asks for a 2FA code, `login()` throws an error that contains the `two_factor_identifier`. Catch it and finish the flow:
842
+
843
+ ```javascript
844
+ try {
845
+ await ig.account.login('username', 'password');
846
+ } catch (err) {
847
+ if (err.response?.body?.two_factor_required) {
848
+ const twoFactorId = err.response.body.two_factor_info.two_factor_identifier;
849
+
850
+ // user enters the code from their authenticator app or SMS
851
+ const code = '123456';
852
+
853
+ await ig.account.twoFactorLogin('username', code, twoFactorId, '1');
854
+ // verificationMethod: '1' = SMS, '3' = TOTP app
855
+ console.log('2FA login successful');
856
+ }
857
+ }
858
+ ```
859
+
860
+ #### TOTP Two-Factor Setup
861
+
862
+ Set up authenticator-app-based 2FA for your account. This generates a seed you can add to Google Authenticator, Authy, etc.
863
+
864
+ ```javascript
865
+ // generate a TOTP seed (this is the secret key for your authenticator app)
866
+ const seed = await ig.totp.generateSeed();
867
+ console.log('Add this to your authenticator app:', seed.totp_seed);
868
+
869
+ // after adding it, verify with a code from the app to confirm
870
+ const code = '123456'; // from authenticator app
871
+ await ig.totp.enable(code);
872
+ console.log('TOTP 2FA is now enabled');
873
+
874
+ // get backup codes in case you lose your authenticator
875
+ const backupCodes = await ig.totp.getBackupCodes();
876
+ console.log('Save these somewhere safe:', backupCodes);
877
+
878
+ // disable TOTP 2FA
879
+ await ig.totp.disable();
880
+ ```
881
+
882
+ #### SMS-Based 2FA
883
+
884
+ ```javascript
885
+ // enable SMS 2FA
886
+ await ig.totp.smsTwoFactorEnable('+1234567890');
887
+
888
+ // confirm with the code you received
889
+ await ig.totp.smsTwoFactorConfirm('123456');
890
+
891
+ // disable it later
892
+ await ig.totp.disableSmsTwoFactor();
893
+ ```
894
+
895
+ #### Challenge Resolver
896
+
897
+ When Instagram triggers a security checkpoint (suspicious login, new location, etc.), you need to resolve the challenge:
898
+
899
+ ```javascript
900
+ try {
901
+ await ig.account.login('username', 'password');
902
+ } catch (err) {
903
+ if (err.response?.body?.challenge) {
904
+ const challengeUrl = err.response.body.challenge.api_path;
905
+
906
+ // option 1: automatic resolution (tries to handle it for you)
907
+ const result = await ig.challenge.auto(challengeUrl);
908
+ console.log('Challenge result:', result);
909
+
910
+ // option 2: manual step-by-step
911
+ // first, see what verification methods are available
912
+ const page = await ig.challenge.getChallengePage(challengeUrl);
913
+
914
+ // choose SMS (0) or email (1)
915
+ await ig.challenge.selectVerifyMethod(challengeUrl, 1);
916
+
917
+ // enter the code you received
918
+ await ig.challenge.sendSecurityCode(challengeUrl, '123456');
919
+ }
920
+ }
921
+ ```
922
+
923
+ ---
924
+
925
+ ### Account Management
926
+
927
+ #### Get Current User Info
928
+
929
+ ```javascript
930
+ const me = await ig.account.currentUser();
931
+ console.log('Username:', me.user.username);
932
+ console.log('Follower count:', me.user.follower_count);
933
+ ```
934
+
935
+ #### Edit Profile
936
+
937
+ ```javascript
938
+ await ig.account.editProfile({
939
+ fullName: 'John Doe',
940
+ biography: 'building cool stuff',
941
+ externalUrl: 'https://example.com',
942
+ email: 'john@example.com',
943
+ phoneNumber: '+1234567890',
944
+ username: 'johndoe_new'
945
+ });
946
+ ```
947
+
948
+ #### Set Biography
949
+
950
+ ```javascript
951
+ await ig.account.setBiography('i like building things that work');
952
+ ```
953
+
954
+ #### Set External URL / Remove Bio Links
955
+
956
+ ```javascript
957
+ await ig.account.setExternalUrl('https://mywebsite.com');
958
+ await ig.account.removeBioLinks();
959
+ ```
960
+
961
+ #### Change Password
962
+
963
+ ```javascript
964
+ await ig.account.changePassword('old_password_here', 'new_password_here');
965
+ ```
966
+
967
+ #### Switch to Private / Public
968
+
969
+ ```javascript
970
+ await ig.account.setPrivate();
971
+ await ig.account.setPublic();
972
+ ```
973
+
974
+ #### Set Gender
975
+
976
+ ```javascript
977
+ // 1 = male, 2 = female, 3 = prefer not to say, 4 = custom
978
+ await ig.account.setGender(1);
979
+ ```
980
+
981
+ #### Profile Picture
982
+
983
+ ```javascript
984
+ // you need an upload_id from a previous photo upload
985
+ await ig.account.profilePictureChange(uploadId);
986
+ await ig.account.profilePictureRemove();
987
+ ```
988
+
989
+ #### Password Encryption Keys
990
+
991
+ ```javascript
992
+ // get the public keys for Instagram's password encryption (needed for some flows)
993
+ const keys = await ig.account.passwordPublicKeys();
994
+ ```
995
+
996
+ #### Account Recovery
997
+
998
+ ```javascript
999
+ // send password recovery via email
1000
+ await ig.account.sendRecoveryFlowEmail('user@example.com');
1001
+
1002
+ // or via SMS
1003
+ await ig.account.sendRecoveryFlowSms('+1234567890');
1004
+ ```
1005
+
1006
+ ---
1007
+
1008
+ ### User Operations
1009
+
1010
+ #### Fetch User Info
1011
+
1012
+ ```javascript
1013
+ // by username
1014
+ const user = await ig.user.infoByUsername('instagram');
1015
+ console.log('User ID:', user.pk);
1016
+ console.log('Followers:', user.follower_count);
1017
+
1018
+ // by user ID
1019
+ const userById = await ig.user.info('25025320');
1020
+ ```
1021
+
1022
+ #### Resolve Username ↔ User ID
1023
+
1024
+ ```javascript
1025
+ const userId = await ig.user.userIdFromUsername('instagram');
1026
+ // returns '25025320'
1027
+
1028
+ const username = await ig.user.usernameFromUserId('25025320');
1029
+ // returns 'instagram'
1030
+ ```
1031
+
1032
+ #### Search Users
1033
+
1034
+ ```javascript
1035
+ const results = await ig.user.search('john', 20);
1036
+ results.users.forEach(u => {
1037
+ console.log(u.username, '-', u.full_name);
1038
+ });
1039
+
1040
+ // exact match
1041
+ const exact = await ig.user.searchExact('johndoe');
1042
+ ```
1043
+
1044
+ #### Follow / Unfollow
1045
+
1046
+ ```javascript
1047
+ await ig.user.follow('25025320');
1048
+ await ig.user.unfollow('25025320');
1049
+ ```
1050
+
1051
+ #### Block / Unblock
1052
+
1053
+ ```javascript
1054
+ await ig.user.block('25025320');
1055
+ await ig.user.unblock('25025320');
1056
+
1057
+ // see all blocked users
1058
+ const blocked = await ig.user.getBlockedUsers();
1059
+ ```
1060
+
1061
+ #### Mute / Unmute
1062
+
1063
+ ```javascript
1064
+ // mute posts, stories, or both
1065
+ await ig.user.mute('25025320', { mutePosts: true, muteStories: true });
1066
+ await ig.user.unmute('25025320', { unmutePosts: true, unmuteStories: true });
1067
+ ```
1068
+
1069
+ #### Get Followers / Following (with pagination)
1070
+
1071
+ ```javascript
1072
+ // get up to 200 followers at a time
1073
+ const followers = await ig.user.getFollowers('25025320', 200);
1074
+ console.log('Got', followers.users.length, 'followers');
1075
+
1076
+ // pagination — pass the maxId from the previous response
1077
+ const moreFollowers = await ig.user.getFollowers('25025320', 200, followers.next_max_id);
1078
+
1079
+ // same for following
1080
+ const following = await ig.user.getFollowing('25025320', 200);
1081
+ ```
1082
+
1083
+ #### Get User's Posts (with pagination)
1084
+
1085
+ ```javascript
1086
+ // grab the latest 50 posts
1087
+ const posts = await ig.user.getUserMedias('25025320', 50);
1088
+ posts.items.forEach(item => {
1089
+ console.log(item.pk, '-', item.caption?.text?.substring(0, 50));
1090
+ });
1091
+
1092
+ // next page
1093
+ const morePosts = await ig.user.getUserMedias('25025320', 50, posts.next_max_id);
1094
+ ```
1095
+
1096
+ #### Get User's Reels / Clips
1097
+
1098
+ ```javascript
1099
+ const reels = await ig.user.getUserReels('25025320', 50);
1100
+ const clips = await ig.user.getUserClips('25025320', 50);
1101
+ ```
1102
+
1103
+ #### Get User's Stories
1104
+
1105
+ ```javascript
1106
+ const stories = await ig.user.getUserStories('25025320');
1107
+ stories.reel?.items.forEach(story => {
1108
+ console.log('Story:', story.pk, 'taken at:', story.taken_at);
1109
+ });
1110
+ ```
1111
+
1112
+ #### Get Tagged Posts
1113
+
1114
+ ```javascript
1115
+ const tagged = await ig.user.getUserTags('25025320');
1116
+ ```
1117
+
1118
+ #### Mutual Followers
1119
+
1120
+ ```javascript
1121
+ const mutual = await ig.user.getMutualFollowers('25025320');
1122
+ ```
1123
+
1124
+ #### Remove a Follower
1125
+
1126
+ ```javascript
1127
+ await ig.user.removeFollower('25025320');
1128
+ ```
1129
+
1130
+ #### Report a User
1131
+
1132
+ ```javascript
1133
+ // reason: 1 = spam, 2 = inappropriate, etc.
1134
+ await ig.user.report('25025320', 1);
1135
+ ```
1136
+
1137
+ #### Get Suggested Users
1138
+
1139
+ ```javascript
1140
+ const suggestions = await ig.user.getSuggested();
1141
+ ```
1142
+
1143
+ #### Friendship Status (Bulk)
1144
+
1145
+ ```javascript
1146
+ // check relationship status with multiple users at once
1147
+ const statuses = await ig.user.getFriendshipStatuses(['12345', '67890', '11111']);
1148
+ ```
1149
+
1150
+ ---
1151
+
1152
+ ### Media Operations
1153
+
1154
+ #### Get Media Info
1155
+
1156
+ ```javascript
1157
+ const info = await ig.media.info('3193593212003331660');
1158
+ console.log('Type:', info.items[0].media_type);
1159
+ console.log('Likes:', info.items[0].like_count);
1160
+ ```
1161
+
1162
+ #### PK / Shortcode Conversion
1163
+
1164
+ These are super useful when you have a post URL and need the numeric ID, or the other way around.
1165
+
1166
+ ```javascript
1167
+ const { MediaRepository } = require('nodejs-insta-private-api-mqtt');
1168
+
1169
+ // convert shortcode to numeric PK
1170
+ const pk = MediaRepository.mediaPkFromCode('CxR7Bsejq5M');
1171
+ // '3193593212003331660'
1172
+
1173
+ // convert PK back to shortcode
1174
+ const code = MediaRepository.mediaCodeFromPk('3193593212003331660');
1175
+ // 'CxR7Bsejq5M'
1176
+
1177
+ // extract PK directly from a full URL
1178
+ const pkFromUrl = MediaRepository.mediaPkFromUrl('https://www.instagram.com/p/CxR7Bsejq5M/');
1179
+ // '3193593212003331660'
1180
+ ```
1181
+
1182
+ #### Like / Unlike
1183
+
1184
+ ```javascript
1185
+ await ig.media.like('3193593212003331660');
1186
+ await ig.media.unlike('3193593212003331660');
1187
+ ```
1188
+
1189
+ #### Comment
1190
+
1191
+ ```javascript
1192
+ const comment = await ig.media.comment('3193593212003331660', 'great shot!');
1193
+ console.log('Comment ID:', comment.comment.pk);
1194
+ ```
1195
+
1196
+ #### Reply to a Comment
1197
+
1198
+ ```javascript
1199
+ await ig.media.replyToComment('3193593212003331660', '17858893269000001', '@user thanks!');
1200
+ ```
1201
+
1202
+ #### Like / Unlike Comments
1203
+
1204
+ ```javascript
1205
+ await ig.media.likeComment('3193593212003331660', '17858893269000001');
1206
+ await ig.media.unlikeComment('3193593212003331660', '17858893269000001');
1207
+ ```
1208
+
1209
+ #### Pin / Unpin Comments
1210
+
1211
+ ```javascript
1212
+ await ig.media.pinComment('3193593212003331660', '17858893269000001');
1213
+ await ig.media.unpinComment('3193593212003331660', '17858893269000001');
1214
+ ```
1215
+
1216
+ #### Delete Comments (Single or Bulk)
1217
+
1218
+ ```javascript
1219
+ // single
1220
+ await ig.media.deleteComment('3193593212003331660', '17858893269000001');
1221
+
1222
+ // bulk delete
1223
+ await ig.media.bulkDeleteComments('3193593212003331660', [
1224
+ '17858893269000001',
1225
+ '17858893269000002',
1226
+ '17858893269000003'
1227
+ ]);
1228
+ ```
1229
+
1230
+ #### Get Comments (Paginated)
1231
+
1232
+ ```javascript
1233
+ const comments = await ig.media.comments('3193593212003331660', null, 20);
1234
+ // next page:
1235
+ const moreComments = await ig.media.comments('3193593212003331660', comments.next_min_id, 20);
1236
+ ```
1237
+
1238
+ #### Get Comment Thread (Replies to a Comment)
1239
+
1240
+ ```javascript
1241
+ const thread = await ig.media.commentThreadComments('3193593212003331660', '17858893269000001');
1242
+ ```
1243
+
1244
+ #### Get Likers
1245
+
1246
+ ```javascript
1247
+ const likers = await ig.media.likers('3193593212003331660');
1248
+ likers.users.forEach(u => console.log(u.username));
1249
+ ```
1250
+
1251
+ #### Save / Unsave
1252
+
1253
+ ```javascript
1254
+ await ig.media.save('3193593212003331660');
1255
+
1256
+ // save to a specific collection
1257
+ await ig.media.save('3193593212003331660', 'collection_id_here');
1258
+
1259
+ await ig.media.unsave('3193593212003331660');
1260
+ ```
1261
+
1262
+ #### Archive / Unarchive
1263
+
1264
+ ```javascript
1265
+ await ig.media.archive('3193593212003331660');
1266
+ await ig.media.unarchive('3193593212003331660');
1267
+ ```
1268
+
1269
+ #### Delete Media
1270
+
1271
+ ```javascript
1272
+ // mediaType: 'PHOTO', 'VIDEO', 'CAROUSEL'
1273
+ await ig.media.delete('3193593212003331660', 'PHOTO');
1274
+ ```
1275
+
1276
+ #### Edit Caption
1277
+
1278
+ ```javascript
1279
+ await ig.media.edit('3193593212003331660', 'new caption goes here', {
1280
+ usertags: { in: [{ user_id: '12345', position: [0.5, 0.5] }] }
1281
+ });
1282
+ ```
1283
+
1284
+ #### Enable / Disable Comments
1285
+
1286
+ ```javascript
1287
+ await ig.media.disableComments('3193593212003331660');
1288
+ await ig.media.enableComments('3193593212003331660');
1289
+ ```
1290
+
1291
+ #### Download Media
1292
+
1293
+ ```javascript
1294
+ // download by URL
1295
+ const buffer = await ig.media.downloadByUrl('https://instagram.cdnurl.com/...');
1296
+
1297
+ // download by PK (photo or video)
1298
+ const photo = await ig.media.downloadPhoto('3193593212003331660');
1299
+ const video = await ig.media.downloadVideo('3193593212003331660');
1300
+ ```
1301
+
1302
+ #### oEmbed
1303
+
1304
+ ```javascript
1305
+ const oembed = await ig.media.oembed('https://www.instagram.com/p/CxR7Bsejq5M/');
1306
+ console.log(oembed.title, '-', oembed.author_name);
1307
+ ```
1308
+
1309
+ #### Get User Who Posted a Media
1310
+
1311
+ ```javascript
1312
+ const user = await ig.media.getUser('3193593212003331660');
1313
+ ```
1314
+
1315
+ ---
1316
+
1317
+ ### Reels / Clips
1318
+
1319
+ Upload and browse Reels through the REST API.
1320
+
1321
+ #### Upload a Reel
1322
+
1323
+ ```javascript
1324
+ const result = await ig.clip.upload({
1325
+ videoBuffer: fs.readFileSync('./reel.mp4'),
1326
+ caption: 'check this out',
1327
+ coverImage: fs.readFileSync('./cover.jpg'), // optional
1328
+ duration: 15,
1329
+ width: 1080,
1330
+ height: 1920,
1331
+ audisMuted: false,
1332
+ });
1333
+ console.log('Reel PK:', result.media?.pk);
1334
+ ```
1335
+
1336
+ #### Configure a Video as Reel (after uploading separately)
1337
+
1338
+ ```javascript
1339
+ const configured = await ig.clip.configure({
1340
+ upload_id: uploadId,
1341
+ caption: 'my reel',
1342
+ duration: 15,
1343
+ width: 1080,
1344
+ height: 1920,
1345
+ });
1346
+ ```
1347
+
1348
+ #### Discover Reels / Connected Reels
1349
+
1350
+ ```javascript
1351
+ // the explore-style reels feed
1352
+ const discover = await ig.clip.discoverReels(10);
1353
+ discover.items.forEach(reel => {
1354
+ console.log(reel.media.code, '-', reel.media.caption?.text?.substring(0, 40));
1355
+ });
1356
+
1357
+ // paginate
1358
+ const more = await ig.clip.discoverReels(10, discover.paging_info?.max_id);
1359
+
1360
+ // connected reels (similar reels after watching one)
1361
+ const connected = await ig.clip.connectedReels(10);
1362
+ ```
1363
+
1364
+ #### Download a Reel
1365
+
1366
+ ```javascript
1367
+ const reelBuffer = await ig.clip.download('3193593212003331660');
1368
+
1369
+ // or from URL
1370
+ const reelFromUrl = await ig.clip.downloadByUrl('https://instagram.cdnurl.com/...');
1371
+ ```
1372
+
1373
+ #### Get Music Info for Reels
1374
+
1375
+ ```javascript
1376
+ const music = await ig.clip.musicInfo({ music_canonical_id: '12345' });
1377
+ ```
1378
+
1379
+ ---
1380
+
1381
+ ### Stories
1382
+
1383
+ #### Get Your Story Feed (Tray)
1384
+
1385
+ ```javascript
1386
+ const tray = await ig.story.getFeed();
1387
+ tray.tray.forEach(reel => {
1388
+ console.log(reel.user.username, '- stories:', reel.media_count);
1389
+ });
1390
+ ```
1391
+
1392
+ #### Get Someone's Stories
1393
+
1394
+ ```javascript
1395
+ const stories = await ig.story.getUserStories('25025320');
1396
+ stories.reel?.items.forEach(item => {
1397
+ console.log('Type:', item.media_type, 'Taken at:', item.taken_at);
1398
+ });
1399
+ ```
1400
+
1401
+ #### Upload a Photo Story
1402
+
1403
+ ```javascript
1404
+ const result = await ig.story.upload({
1405
+ file: fs.readFileSync('./story.jpg'),
1406
+ caption: 'hello world', // optional
1407
+ });
1408
+ console.log('Story ID:', result.media?.pk);
1409
+ ```
1410
+
1411
+ #### Upload a Video Story
1412
+
1413
+ ```javascript
1414
+ const result = await ig.story.uploadVideo({
1415
+ file: fs.readFileSync('./story.mp4'),
1416
+ duration: 10,
1417
+ width: 1080,
1418
+ height: 1920,
1419
+ });
1420
+ ```
1421
+
1422
+ #### Mark Stories as Seen
1423
+
1424
+ ```javascript
1425
+ await ig.story.seen([
1426
+ { id: 'media_id_1', taken_at: 1700000000, user: { pk: '25025320' } }
1427
+ ]);
1428
+ ```
1429
+
1430
+ #### React to a Story
1431
+
1432
+ ```javascript
1433
+ await ig.story.react({
1434
+ mediaId: '3193593212003331660',
1435
+ reelId: '25025320',
1436
+ emoji: '🔥'
1437
+ });
1438
+ ```
1439
+
1440
+ ---
1441
+
1442
+ ### Highlights
1443
+
1444
+ #### Get User's Highlights
1445
+
1446
+ ```javascript
1447
+ const highlights = await ig.highlights.getHighlightsTray('25025320');
1448
+ highlights.tray.forEach(h => {
1449
+ console.log(h.id, '-', h.title);
1450
+ });
1451
+ ```
1452
+
1453
+ #### Get a Specific Highlight
1454
+
1455
+ ```javascript
1456
+ const highlight = await ig.highlights.getHighlight('highlight:12345678');
1457
+ ```
1458
+
1459
+ #### Create a Highlight
1460
+
1461
+ ```javascript
1462
+ await ig.highlights.create('My Trip', ['story_id_1', 'story_id_2'], 'cover_media_id');
1463
+ ```
1464
+
1465
+ #### Edit a Highlight
1466
+
1467
+ ```javascript
1468
+ await ig.highlights.edit('highlight_id', 'Updated Title', ['new_story_id']);
1469
+ ```
1470
+
1471
+ #### Add / Remove Stories from Highlight
1472
+
1473
+ ```javascript
1474
+ await ig.highlights.addStories('highlight_id', ['story_id_3', 'story_id_4']);
1475
+ await ig.highlights.removeStories('highlight_id', ['story_id_1']);
1476
+ ```
1477
+
1478
+ #### Update Highlight Cover
1479
+
1480
+ ```javascript
1481
+ await ig.highlights.updateCover('highlight_id', 'cover_media_id');
1482
+ ```
1483
+
1484
+ #### Delete a Highlight
1485
+
1486
+ ```javascript
1487
+ await ig.highlights.delete('highlight_id');
1488
+ ```
1489
+
1490
+ ---
1491
+
1492
+ ### Upload & Configure Media
1493
+
1494
+ #### Upload a Photo Post
1495
+
1496
+ ```javascript
1497
+ const upload = await ig.upload.photo({
1498
+ file: fs.readFileSync('./photo.jpg'),
1499
+ });
1500
+
1501
+ const post = await ig.upload.configurePhoto({
1502
+ upload_id: upload.upload_id,
1503
+ caption: 'sunset vibes',
1504
+ usertags: {
1505
+ in: [{ user_id: '12345', position: [0.5, 0.5] }]
1506
+ }
1507
+ });
1508
+ console.log('Posted! PK:', post.media?.pk);
1509
+ ```
1510
+
1511
+ #### Upload a Video Post
1512
+
1513
+ ```javascript
1514
+ const upload = await ig.upload.video({
1515
+ file: fs.readFileSync('./video.mp4'),
1516
+ duration: 30,
1517
+ width: 1080,
1518
+ height: 1920,
1519
+ });
1520
+
1521
+ const post = await ig.upload.configureVideo({
1522
+ upload_id: upload.upload_id,
1523
+ caption: 'check this clip',
1524
+ duration: 30,
1525
+ width: 1080,
1526
+ height: 1920,
1527
+ });
1528
+ ```
1529
+
1530
+ #### Configure as Reel (Clips)
1531
+
1532
+ ```javascript
1533
+ const reel = await ig.upload.configureToClips({
1534
+ upload_id: upload.upload_id,
1535
+ caption: 'my first reel',
1536
+ duration: 15,
1537
+ width: 1080,
1538
+ height: 1920,
1539
+ });
1540
+ ```
1541
+
1542
+ #### Configure as Story
1543
+
1544
+ ```javascript
1545
+ const story = await ig.upload.configureToStory({
1546
+ upload_id: upload.upload_id,
1547
+ });
1548
+ ```
1549
+
1550
+ #### Upload a Carousel (Multiple Photos/Videos)
1551
+
1552
+ ```javascript
1553
+ const carousel = await ig.feed.uploadCarousel({
1554
+ caption: 'summer trip highlights',
1555
+ children: [
1556
+ { type: 'photo', file: fs.readFileSync('./pic1.jpg') },
1557
+ { type: 'photo', file: fs.readFileSync('./pic2.jpg') },
1558
+ { type: 'video', file: fs.readFileSync('./vid1.mp4'), duration: 10, width: 1080, height: 1080 },
1559
+ ]
1560
+ });
1561
+ ```
1562
+
1563
+ ---
1564
+
1565
+ ### Feed
1566
+
1567
+ #### Home Timeline
1568
+
1569
+ ```javascript
1570
+ const feed = await ig.timeline.getFeed();
1571
+ feed.feed_items?.forEach(item => {
1572
+ const media = item.media_or_ad;
1573
+ if (media) console.log(media.user.username, '-', media.caption?.text?.substring(0, 40));
1574
+ });
1575
+ ```
1576
+
1577
+ #### Hashtag Feed
1578
+
1579
+ ```javascript
1580
+ const tagFeed = await ig.feed.getTag('photography');
1581
+ ```
1582
+
1583
+ #### Location Feed
1584
+
1585
+ ```javascript
1586
+ const locFeed = await ig.feed.getLocation('213385402');
1587
+ ```
1588
+
1589
+ #### Liked Posts
1590
+
1591
+ ```javascript
1592
+ const liked = await ig.feed.getLiked();
1593
+ ```
1594
+
1595
+ #### Saved Posts
1596
+
1597
+ ```javascript
1598
+ const saved = await ig.feed.getSaved();
1599
+ ```
1600
+
1601
+ #### Reels Tray (Stories of People You Follow)
1602
+
1603
+ ```javascript
1604
+ const tray = await ig.feed.reelsTray();
1605
+ ```
1606
+
1607
+ #### Explore Feed
1608
+
1609
+ ```javascript
1610
+ const explore = await ig.feed.getExploreFeed();
1611
+ ```
1612
+
1613
+ #### Reels Feed
1614
+
1615
+ ```javascript
1616
+ const reels = await ig.feed.getReelsFeed();
1617
+ const userReels = await ig.feed.getUserReelsFeed('25025320');
1618
+ ```
1619
+
1620
+ #### Reels Media (Bulk)
1621
+
1622
+ ```javascript
1623
+ // get stories for multiple users at once
1624
+ const reelsMedia = await ig.feed.reelsMedia(['25025320', '12345678']);
1625
+ ```
1626
+
1627
+ ---
1628
+
1629
+ ### Timeline (Reels)
1630
+
1631
+ ```javascript
1632
+ // get reels from your timeline
1633
+ const reels = await ig.timeline.reels(10);
1634
+
1635
+ // explore reels
1636
+ const exploreReels = await ig.timeline.exploreReels(10);
1637
+ ```
1638
+
1639
+ ---
1640
+
1641
+ ### Direct Messages (REST API)
1642
+
1643
+ The REST-based DM methods. These work without MQTT — they're regular HTTP requests.
1644
+
1645
+ #### Get Inbox
1646
+
1647
+ ```javascript
1648
+ const inbox = await ig.direct.getInbox();
1649
+ inbox.inbox.threads.forEach(t => {
1650
+ console.log(t.thread_title || t.users[0]?.username, '- last:', t.last_permanent_item?.text);
1651
+ });
1652
+
1653
+ // paginate
1654
+ const page2 = await ig.direct.getInbox(inbox.inbox.oldest_cursor, 20);
1655
+ ```
1656
+
1657
+ #### Pending Inbox (Message Requests)
1658
+
1659
+ ```javascript
1660
+ const pending = await ig.direct.getPendingInbox();
1661
+ ```
1662
+
1663
+ #### Get a Thread
1664
+
1665
+ ```javascript
1666
+ const thread = await ig.direct.getThread(threadId);
1667
+ thread.thread.items.forEach(msg => {
1668
+ console.log(msg.user_id, ':', msg.text || `[${msg.item_type}]`);
1669
+ });
1670
+ ```
1671
+
1672
+ #### Send Text / Photo / Video / Link via REST
1673
+
1674
+ ```javascript
1675
+ await ig.direct.sendText({ thread_ids: [threadId], text: 'hey there!' });
1676
+
1677
+ await ig.direct.sendPhoto({
1678
+ thread_ids: [threadId],
1679
+ file: fs.readFileSync('./photo.jpg'),
1680
+ });
1681
+
1682
+ await ig.direct.sendVideo({
1683
+ thread_ids: [threadId],
1684
+ file: fs.readFileSync('./video.mp4'),
1685
+ });
1686
+
1687
+ await ig.direct.sendLink({
1688
+ thread_ids: [threadId],
1689
+ link: 'https://example.com',
1690
+ text: 'check this out'
1691
+ });
1692
+ ```
1693
+
1694
+ #### Share Media / Profile / Hashtag / Location
1695
+
1696
+ ```javascript
1697
+ await ig.direct.sendMediaShare({ thread_ids: [threadId], mediaId: '3193593212003331660' });
1698
+ await ig.direct.sendProfile({ thread_ids: [threadId], userId: '25025320' });
1699
+ await ig.direct.sendHashtag({ thread_ids: [threadId], hashtag: 'photography' });
1700
+ await ig.direct.sendLocation({ thread_ids: [threadId], locationId: '213385402' });
1701
+ ```
1702
+
1703
+ #### Create a Group Thread
1704
+
1705
+ ```javascript
1706
+ const group = await ig.direct.createGroupThread(['user_id_1', 'user_id_2'], 'Project Team');
1707
+ console.log('Thread ID:', group.thread_id);
1708
+ ```
1709
+
1710
+ #### Ranked Recipients (Who to Message)
1711
+
1712
+ ```javascript
1713
+ const recipients = await ig.direct.rankedRecipients('raven', 'john');
1714
+ ```
1715
+
1716
+ #### Get Presence
1717
+
1718
+ ```javascript
1719
+ const presence = await ig.direct.getPresence();
1720
+ ```
1721
+
1722
+ #### Mark as Seen / Hide Thread
1723
+
1724
+ ```javascript
1725
+ await ig.direct.markAsSeen(threadId, itemId);
1726
+ await ig.direct.hideThread(threadId);
1727
+ ```
1728
+
1729
+ ---
1730
+
1731
+ ### Friendship Management
1732
+
1733
+ #### Follow / Unfollow
1734
+
1735
+ ```javascript
1736
+ await ig.friendship.create('25025320'); // follow
1737
+ await ig.friendship.destroy('25025320'); // unfollow
1738
+ ```
1739
+
1740
+ #### Check Friendship Status
1741
+
1742
+ ```javascript
1743
+ const status = await ig.friendship.show('25025320');
1744
+ console.log('Following:', status.following);
1745
+ console.log('Followed by:', status.followed_by);
1746
+ console.log('Blocking:', status.blocking);
1747
+
1748
+ // bulk check
1749
+ const many = await ig.friendship.showMany(['12345', '67890']);
1750
+ ```
1751
+
1752
+ #### Approve / Ignore Follow Requests
1753
+
1754
+ ```javascript
1755
+ await ig.friendship.approve('25025320');
1756
+ await ig.friendship.ignore('25025320');
1757
+
1758
+ // list pending requests
1759
+ const pending = await ig.friendship.getPendingRequests();
1760
+ ```
1761
+
1762
+ #### Block / Unblock
1763
+
1764
+ ```javascript
1765
+ await ig.friendship.block('25025320');
1766
+ await ig.friendship.unblock('25025320');
1767
+
1768
+ const blocked = await ig.friendship.getBlockedUsers();
1769
+ ```
1770
+
1771
+ #### Restrict / Unrestrict
1772
+
1773
+ ```javascript
1774
+ await ig.friendship.restrict('25025320');
1775
+ await ig.friendship.unrestrict('25025320');
1776
+ ```
1777
+
1778
+ #### Mute / Unmute
1779
+
1780
+ ```javascript
1781
+ await ig.friendship.mute('25025320', { muteStories: true, mutePosts: true });
1782
+ await ig.friendship.unmute('25025320', { unmuteStories: true, unmutePosts: true });
1783
+ ```
1784
+
1785
+ #### Close Friends / Besties
1786
+
1787
+ ```javascript
1788
+ // add someone to close friends
1789
+ await ig.friendship.setCloseFriend('25025320', true);
1790
+ // remove
1791
+ await ig.friendship.setCloseFriend('25025320', false);
1792
+
1793
+ // bulk update close friends list
1794
+ await ig.friendship.setBesties(['user1', 'user2'], ['user3']); // add, remove
1795
+ ```
1796
+
1797
+ #### Favorites
1798
+
1799
+ ```javascript
1800
+ await ig.friendship.setFavorite('25025320');
1801
+ await ig.friendship.unsetFavorite('25025320');
1802
+
1803
+ const favorites = await ig.friendship.getFavoriteFriends();
1804
+ ```
1805
+
1806
+ #### Remove Follower
1807
+
1808
+ ```javascript
1809
+ await ig.friendship.removeFollower('25025320');
1810
+ ```
1811
+
1812
+ #### Get Followers / Following
1813
+
1814
+ ```javascript
1815
+ const followers = await ig.friendship.getFollowers('25025320');
1816
+ const following = await ig.friendship.getFollowing('25025320');
1817
+ const mutual = await ig.friendship.getMutuafFollowers('25025320');
1818
+ ```
1819
+
1820
+ ---
1821
+
1822
+ ### Search (FBSearch)
1823
+
1824
+ Instagram's unified search endpoint. Covers users, hashtags, places, and music.
1825
+
1826
+ #### Top Search (All Types)
1827
+
1828
+ ```javascript
1829
+ const results = await ig.fbsearch.topSearch('coffee shop');
1830
+ console.log('Users:', results.users?.length);
1831
+ console.log('Places:', results.places?.length);
1832
+ console.log('Hashtags:', results.hashtags?.length);
1833
+
1834
+ // flat version (simpler output)
1835
+ const flat = await ig.fbsearch.topSearchFlat('coffee', 30);
1836
+ ```
1837
+
1838
+ #### Search by Type
1839
+
1840
+ ```javascript
1841
+ const users = await ig.fbsearch.searchUsers('johndoe', 20);
1842
+ const hashtags = await ig.fbsearch.searchHashtags('photography', 20);
1843
+ const places = await ig.fbsearch.searchPlaces('new york');
1844
+ const music = await ig.fbsearch.searchMusic('trending');
1845
+ ```
1846
+
1847
+ #### Search History
1848
+
1849
+ ```javascript
1850
+ const recent = await ig.fbsearch.getRecentSearches();
1851
+
1852
+ // clear it
1853
+ await ig.fbsearch.clearRecentSearches();
1854
+
1855
+ // manually add something to recent searches
1856
+ await ig.fbsearch.registerRecentSearch('25025320', 'user');
1857
+ ```
1858
+
1859
+ #### Suggested Searches
1860
+
1861
+ ```javascript
1862
+ const suggested = await ig.fbsearch.getSuggestedSearches('users');
1863
+ ```
1864
+
1865
+ #### Null State (Default Explore)
1866
+
1867
+ ```javascript
1868
+ const nullState = await ig.fbsearch.nullStateDynamic();
1869
+ ```
1870
+
1871
+ ---
1872
+
1873
+ ### Explore
1874
+
1875
+ #### Topical Explore
1876
+
1877
+ ```javascript
1878
+ const explore = await ig.explore.topicalExplore({
1879
+ module: 'explore_popular',
1880
+ cluster_id: 'explore_all:0',
1881
+ });
1882
+
1883
+ // basic explore
1884
+ const basic = await ig.explore.explore();
1885
+ // paginate
1886
+ const page2 = await ig.explore.explore(basic.next_max_id);
1887
+ ```
1888
+
1889
+ #### Report Explore Media
1890
+
1891
+ ```javascript
1892
+ await ig.explore.reportExploreMedia('3193593212003331660', 1);
1893
+ ```
1894
+
1895
+ #### Mark Explore as Seen
1896
+
1897
+ ```javascript
1898
+ await ig.explore.markAsSeen();
1899
+ ```
1900
+
1901
+ ---
1902
+
1903
+ ### Notes
1904
+
1905
+ Instagram Notes — the little status messages that show up in the DM tab.
1906
+
1907
+ ```javascript
1908
+ // get all notes from people you follow
1909
+ const notes = await ig.note.getNotes();
1910
+ const followingNotes = await ig.note.getNotesFollowing();
1911
+
1912
+ // create a note (audience: 0 = followers, 1 = close friends)
1913
+ await ig.note.createNote('currently building something cool', 0);
1914
+
1915
+ // delete your note
1916
+ await ig.note.deleteNote('note_id_here');
1917
+
1918
+ // mark notes as seen
1919
+ await ig.note.lastSeenUpdateNote();
1920
+ ```
1921
+
1922
+ ---
1923
+
1924
+ ### Insights (Business/Creator Accounts)
1925
+
1926
+ Requires a business or creator account.
1927
+
1928
+ ```javascript
1929
+ // account-level insights
1930
+ const accountInsights = await ig.insights.account({
1931
+ ig_drop_table: 'is_feed',
1932
+ follower_type: 'followers',
1933
+ timeframe: 'one_week',
1934
+ query_params: JSON.stringify({ access_token: '', id: '' })
1935
+ });
1936
+
1937
+ // insights for a specific post
1938
+ const mediaInsights = await ig.insights.media('3193593212003331660');
1939
+
1940
+ // reel insights
1941
+ const reelInsights = await ig.insights.reelInsights('3193593212003331660');
1942
+
1943
+ // story insights
1944
+ const storyInsights = await ig.insights.storyInsights('3193593212003331660');
1945
+
1946
+ // all media feed insights
1947
+ const allMedia = await ig.insights.mediaFeedAll({ count: 20 });
1948
+ ```
1949
+
1950
+ ---
1951
+
1952
+ ### Notifications
1953
+
1954
+ Fine-grained control over push notification settings.
1955
+
1956
+ ```javascript
1957
+ // mute all notifications for 8 hours
1958
+ await ig.notification.muteAll('8_hour');
1959
+
1960
+ // disable all notifications
1961
+ await ig.notification.disableAll();
1962
+
1963
+ // control individual notification types
1964
+ await ig.notification.likes('off');
1965
+ await ig.notification.comments('off');
1966
+ await ig.notification.newFollower('off');
1967
+ await ig.notification.commentLikes('off');
1968
+ await ig.notification.directShareActivity('off');
1969
+ await ig.notification.login('off');
1970
+ await ig.notification.reminders('off');
1971
+
1972
+ // and many more: userTagged, firstPost, followRequestAccepted,
1973
+ // connection, taggedInBio, pendingDirectShare, directGroupRequests,
1974
+ // fundraiserSupporter, announcements, reportUpdated...
1975
+ ```
1976
+
1977
+ ---
1978
+
1979
+ ### Music / Audio Tracks
1980
+
1981
+ ```javascript
1982
+ // search for music
1983
+ const tracks = await ig.track.search('trending pop');
1984
+
1985
+ // get track info
1986
+ const trackInfo = await ig.track.infoById('track_id_here');
1987
+ const trackByCanonical = await ig.track.infoByCanonicalId('canonical_id');
1988
+
1989
+ // download audio
1990
+ const audioBuffer = await ig.track.downloadByUrl('https://instagram.cdnurl.com/...');
1991
+ ```
1992
+
1993
+ ---
1994
+
1995
+ ### Signup (Account Creation)
1996
+
1997
+ Programmatic account creation flow.
1998
+
1999
+ ```javascript
2000
+ // check if email/username is available
2001
+ const emailCheck = await ig.signup.checkEmail('user@example.com');
2002
+ const usernameCheck = await ig.signup.checkUsername('desired_username');
2003
+
2004
+ // get signup config
2005
+ const config = await ig.signup.getSignupConfig();
2006
+
2007
+ // check age eligibility
2008
+ await ig.signup.checkAgeEligibility(1995, 6, 15);
2009
+
2010
+ // send verification email and confirm
2011
+ await ig.signup.sendVerifyEmail('user@example.com');
2012
+ await ig.signup.checkConfirmationCode('user@example.com', '123456');
2013
+
2014
+ // phone-based signup
2015
+ await ig.signup.sendSignupSmsCode('+1234567890');
2016
+ await ig.signup.validateSignupSmsCode('+1234567890', '123456');
2017
+
2018
+ // get username suggestions
2019
+ const suggestions = await ig.signup.getSuggestedUsernames('John Doe', 'john@example.com');
2020
+
2021
+ // create the account
2022
+ const newAccount = await ig.signup.accountsCreate({
2023
+ username: 'johndoe_2026',
2024
+ password: 'securepassword123',
2025
+ email: 'john@example.com',
2026
+ first_name: 'John',
2027
+ });
2028
+ ```
2029
+
2030
+ ---
2031
+
2032
+ ### Multiple Accounts
2033
+
2034
+ ```javascript
2035
+ const family = await ig.multipleAccounts.getAccountFamily();
2036
+ const featured = await ig.multipleAccounts.getFeaturedAccounts();
2037
+ const info = await ig.multipleAccounts.getAccountInfo();
2038
+
2039
+ // switch to another logged-in account
2040
+ await ig.multipleAccounts.switchAccount('other_user_id');
2041
+ ```
2042
+
2043
+ ---
2044
+
2045
+ ### Fundraiser
2046
+
2047
+ ```javascript
2048
+ // get fundraiser info
2049
+ const info = await ig.fundraiser.standaloneFundraiserInfo('fundraiser_pk');
2050
+
2051
+ // create a charity fundraiser
2052
+ const fundraiser = await ig.fundraiser.createCharityFundraiser({
2053
+ title: 'Help Local School',
2054
+ description: 'Raising funds for supplies',
2055
+ charity_id: 'charity_pk',
2056
+ goal_amount: 5000,
2057
+ });
2058
+
2059
+ // donate
2060
+ await ig.fundraiser.donateFundraiser('fundraiser_pk', 25);
2061
+ ```
2062
+
2063
+ ---
2064
+
2065
+ ### Captcha / Challenge Forms
2066
+
2067
+ ```javascript
2068
+ // get challenge form (when Instagram shows a captcha)
2069
+ const form = await ig.captcha.getChallengeForm('/api/v1/challenge/1234/');
2070
+
2071
+ // submit reCAPTCHA or hCaptcha response
2072
+ await ig.captcha.submitRecaptchaResponse('/api/v1/challenge/1234/', 'recaptcha_token');
2073
+ await ig.captcha.submitHCaptchaResponse('/api/v1/challenge/1234/', 'hcaptcha_token');
2074
+ ```
2075
+
2076
+ ---
2077
+
2078
+ ### Share / URL Parsing
2079
+
2080
+ ```javascript
2081
+ // decode a share code (from QR codes, NFC tags, etc.)
2082
+ const info = ig.share.shareInfo('base64_encoded_code');
2083
+ // returns { type: 'user', pk: '25025320' }
2084
+
2085
+ // parse from URL
2086
+ const fromUrl = ig.share.shareInfoByUrl('https://www.instagram.com/share/abc123');
2087
+
2088
+ // extract share code from URL
2089
+ const code = ig.share.shareCodeFromUrl('https://www.instagram.com/share/abc123');
2090
+ ```
2091
+
2092
+ ---
2093
+
2094
+ ### Bloks (Instagram Bloks Engine)
2095
+
2096
+ Low-level access to Instagram's Bloks framework. Used internally by some flows.
2097
+
2098
+ ```javascript
2099
+ await ig.bloks.action({
2100
+ action_name: 'some.action.name',
2101
+ params: { key: 'value' }
2102
+ });
2103
+
2104
+ const layout = await ig.bloks.getLayoutData({
2105
+ layout_name: 'layout.name',
2106
+ params: {}
2107
+ });
2108
+
2109
+ // bloks-based password change
2110
+ await ig.bloks.changePassword('old_pass', 'new_pass');
2111
+ ```
2112
+
2113
+ ---
2114
+
2115
+ ### Complete REST Repository Reference
2116
+
2117
+ Here's every repository and what it covers at a glance.
2118
+
2119
+ | Repository | Access | What it does |
2120
+ |------------|--------|--------------|
2121
+ | `ig.account` | Account management | Login, 2FA, edit profile, change password, privacy |
2122
+ | `ig.user` | User operations | Info, search, follow, block, mute, get medias/reels/stories |
2123
+ | `ig.media` | Media operations | Like, comment, pin, delete, save, archive, download |
2124
+ | `ig.clip` | Reels / Clips | Upload, discover, download reels |
2125
+ | `ig.story` | Stories | Upload, view, react, highlights |
2126
+ | `ig.highlights` | Highlights | Create, edit, delete, manage cover |
2127
+ | `ig.feed` | Content feeds | Timeline, hashtag, location, saved, liked, explore |
2128
+ | `ig.timeline` | Timeline reels | Reels feed, explore reels |
2129
+ | `ig.upload` | Upload & configure | Photo/video upload, configure to feed/story/clips |
2130
+ | `ig.direct` | Direct messages | Inbox, send text/media/links, group threads |
2131
+ | `ig.friendship` | Relationships | Follow, block, restrict, close friends, favorites |
2132
+ | `ig.fbsearch` | Search | Users, hashtags, places, music, search history |
2133
+ | `ig.explore` | Explore page | Topical explore, report, mark seen |
2134
+ | `ig.insights` | Analytics | Account, media, reel, story insights |
2135
+ | `ig.note` | Notes | Create, delete, view notes |
2136
+ | `ig.notification` | Notification settings | Enable/disable per-type notifications |
2137
+ | `ig.totp` | 2FA management | TOTP setup, SMS 2FA, backup codes |
2138
+ | `ig.challenge` | Challenge resolver | Auto-resolve, verify methods, security codes |
2139
+ | `ig.signup` | Account creation | Email/phone verification, username check, create account |
2140
+ | `ig.track` | Music / Audio | Search tracks, get info, download |
2141
+ | `ig.share` | Share codes | Decode QR/NFC share codes, parse URLs |
2142
+ | `ig.bloks` | Bloks engine | Low-level Instagram UI actions |
2143
+ | `ig.fundraiser` | Fundraisers | Create, donate, get info |
2144
+ | `ig.multipleAccounts` | Multi-account | Switch accounts, account family |
2145
+ | `ig.captcha` | Captcha handling | reCAPTCHA / hCaptcha submission |
2146
+ | `ig.location` | Locations | Location search and info |
2147
+ | `ig.hashtag` | Hashtags | Hashtag info and feed |
2148
+ | `ig.news` | Activity feed | Activity inbox |
2149
+ | `ig.collection` | Collections | Saved collections management |
2150
+ | `ig.closeFriends` | Close friends | Close friends list management |
2151
+
2152
+ ---
2153
+
805
2154
  ### RealtimeClient Events
806
2155
 
807
2156
  | Event | Description |
@@ -1532,6 +2881,41 @@ The result is roughly 10x less keepalive traffic, which means less chance of Ins
1532
2881
 
1533
2882
  ## Changelog
1534
2883
 
2884
+ ### v5.66.0 (February 2026) - Complete REST API Parity with instagrapi
2885
+
2886
+ **32 REST API Repositories — full coverage of every Instagram private endpoint:**
2887
+
2888
+ New repositories added:
2889
+ - `ClipRepository` - Upload, configure, discover, and download Reels/Clips
2890
+ - `TimelineRepository` - Timeline reels feed and explore reels
2891
+ - `InsightsRepository` - Account, media, reel, and story insights for business/creator accounts
2892
+ - `NoteRepository` - Create, delete, and view Instagram Notes
2893
+ - `NotificationRepository` - Fine-grained per-type notification settings
2894
+ - `SignupRepository` - Full account creation flow with email/SMS verification
2895
+ - `TOTPRepository` - TOTP 2FA setup, SMS 2FA, backup codes
2896
+ - `BloksRepository` - Low-level Bloks engine actions
2897
+ - `ChallengeRepository` - Auto-resolve challenges, verify methods, security codes
2898
+ - `ShareRepository` - Decode QR/NFC share codes, parse share URLs
2899
+ - `TrackRepository` - Music/audio search, info, download
2900
+ - `ExploreRepository` - Topical explore, report, mark seen
2901
+ - `FBSearchRepository` - Unified search (users, hashtags, places, music), search history
2902
+ - `FundraiserRepository` - Create, donate, get fundraiser info
2903
+ - `MultipleAccountsRepository` - Account family, switch accounts
2904
+ - `CaptchaRepository` - reCAPTCHA / hCaptcha submission for challenges
2905
+ - `HighlightsRepository` - Create, edit, delete highlights, manage stories and covers
2906
+
2907
+ Enhanced existing repositories:
2908
+ - `AccountRepository` - Added editProfile, setBiography, setExternalUrl, removeBioLinks, setGender, setPrivate/Public, profilePictureChange/Remove, passwordPublicKeys, sendRecoveryFlowEmail/Sms, encryptPassword
2909
+ - `UserRepository` - Added getUserMedias/getUserReels/getUserClips with pagination, userIdFromUsername, usernameFromUserId, block/unblock, mute/unmute, removeFollower, getBlockedUsers, getMutualFollowers
2910
+ - `MediaRepository` - Added pinComment/unpinComment, bulkDeleteComments, replyToComment, likeComment/unlikeComment, save/unsave, archive/unarchive, disableComments/enableComments, commentThreadComments, downloadPhoto/downloadVideo, oembed, static mediaPkFromCode/mediaCodeFromPk/mediaPkFromUrl
2911
+ - `FriendshipRepository` - Added restrict/unrestrict, setCloseFriend, setBesties, getFavoriteFriends, setFavorite/unsetFavorite, getPendingRequests, getMutuafFollowers, getBlockedUsers
2912
+ - `FeedRepository` - Added uploadCarousel, reelsMedia, reelsTray, getReelsFeed, getUserReelsFeed, getExploreFeed
2913
+ - `StoryRepository` - Added createHighlight/editHighlight/deleteHighlight, uploadVideo, configureStoryVideo, react
2914
+ - `DirectRepository` - Added sendPhoto/sendVideo/sendLink/sendMediaShare/sendProfile/sendHashtag/sendLocation, getPendingInbox, createGroupThread, hideThread
2915
+ - `UploadRepository` - Added configureToClips, configurePhoto, configureVideo, configureToStory
2916
+
2917
+ All 32 repositories registered in client.js and exported from index.js.
2918
+
1535
2919
  ### v5.65.0 (February 2026) - Full FBNS Push Notifications
1536
2920
 
1537
2921
  **FbnsClient now fully working out of the box:**