Skip to content

igflare ​

Classes ​

ClassDescription
AccountSuspendedErrorThe account is suspended. Retrying does not help.
BadPasswordErrorThe password is wrong.
CaaTwoFactorRequiredErrorA CAA/Bloks login that stopped at the two-factor step. Besides the raw response (in payload.raw) it carries the account access context the login obtained, which the code submission must echo back, so resolving it needs nothing else.
ChallengeRequiredErrorInstagram wants a verification (a code or a check in the app) before it goes on.
ClientForbiddenErrorA 403 that is not an expired session: the account may not do this.
ClientJsonErrorThe response body could not be parsed as JSON.
ClientSchemaErrorA response parsed as JSON but did not match the endpoint's schema. Carries the raw decoded body so a caller can inspect what drifted, instead of leaking a raw zod error.
FakeTransportA transport driven by a handler. Records every request for assertions.
FeedbackRequiredErrorInstagram blocked this action for now ("try again later"), often after doing it too often.
FetchTransportA transport backed by the runtime's global fetch. Fetch adds the browser sec-fetch-* headers, which the private API rejects, so Instagram calls go through HttpsTransport. This one is kept for generic use and testing.
FileSessionStorePersists the session as a JSON file on disk.
HttpsTransportThe default transport, over Node's http/https. Unlike global fetch it does not inject browser sec-fetch-* headers, which the private API rejects. Sends exactly the headers it is given and decompresses gzip/deflate/br responses.
IgApiErrorA failed private-API call, carrying the status and the parsed error payload.
IgErrorBase error for everything this SDK throws. Never throw raw strings.
IgFlareThe ergonomic entry point. Wraps the low-level engine and groups the endpoints by domain (ig.user.*, ig.friendship.*, ig.feed.*, ig.media.*). Persistence is pluggable: pass any SessionStore (memory, file, or a provider adapter) as store. The transport retries transient failures by default.
IgResponseErrorThrown when the API answers with a non-success status.
InvalidVerificationCodeErrorThe one-time code submitted at a login challenge or two-factor step was not accepted.
LoginRequiredErrorThe session expired or was logged out (login_required). Log in again.
MemorySessionStoreKeeps the session in memory. Useful for tests and short-lived processes.
PleaseWaitError"Please wait a few minutes before you try again": too many attempts in a row.
PrivateClientTies the three seams together: build a request, send it, update the session.
RateLimitErrorToo many requests in a short time. Slow down before the next one.
RetryTransportAn HttpTransport decorator that retries transient failures with exponential backoff and full jitter. It retries on connection errors, HTTP 429/502/503/504, and the "please wait" rate-limit body, honoring a Retry-After header when present. It does not retry 500 (ambiguous) or other 4xx (client errors). The retry set is method-agnostic: the SDK's mutations are idempotent (follow/like) or carry an idempotence token (comment), and every retryable signal means the request was rejected rather than applied.
SentryBlockErrorThe request was flagged as automated.
TwoFactorRequiredErrorA login stopped at the two-factor step.

Interfaces ​

InterfaceDescription
AccountApiThe logged-in account itself.
ActivityThe activity feed as the app shows it: what is new, what was already seen.
AlbumUploadOptionsOptions for a carousel post.
ApiErrorPayloadWhat a typed API error carries from the response.
AuthStateAuth material gained after login. Everything here is optional before login.
BaseHeadersInputWhat the headers sent on every request are built from.
BloksActionOptionsOverrides for one Bloks action call.
CaaLoginCredentialsThe username and password for a login.
CaaLoginOptionsOptions for a login.
ChallengeAn open challenge: where to answer it and what the server sent.
CollectionApiThe account's saved-posts collections and the posts it has liked.
CollectionPageOptionsPaging for a collection.
CommentListOptionsPaging for a list of comments or posts.
CommentOptionsOptions for a comment.
ContentInsightsOptionsThe dates an account report covers. It ends now and starts 30 days earlier by default.
CreateHighlightOptionsOptions for a new highlight.
CreateNoteOptionsOptions for a note.
CreateSessionOptionsParts of a new session to set instead of the defaults.
CursorOptionsPaging for a list.
DeviceProfileThe hardware/system/app profile the client presents as. Stable per install.
DeviceStateThe random per-install identifiers. Persist these to keep one logical device.
DirectApiDirect messages: the inbox, a thread's messages, and sending.
EditHighlightOptionsWhat to change in a highlight. Leave a field out to keep it.
EditMediaOptionsWhat to change in a post. Leave a field out to keep it.
EncryptPasswordOptionsInputs for encrypting a password the way the app does before login.
EndpointDefinitionOne REST endpoint of the private API. A path may hold {placeholders} for ids.
ExploreApiThe Explore tab.
ExploreOptionsPaging for the Explore feed.
FeedApiMedia feeds.
FeedOptionsPaging for a feed.
FollowListOptionsPaging for a follower, following or request list.
FriendshipApiThe follow graph: relationship actions and the follower/following lists.
GenerateUsdidOptionsInputs for creating the device identity (USDID) the login flow registers.
HashtagApiWhat a hashtag's own page shows.
HideThreadOptionsOptions for declining a message request.
HighlightApiStory highlights on a profile. Reading is open to anyone who may see the profile.
HttpRequestOne HTTP request as a transport sends it.
HttpResponseOne HTTP response with the body decoded to text.
HttpsTransportOptionsHow the default transport connects.
HttpTransportThe HTTP seam. Everything that talks to the network goes through this port so the request and response layers can be tested without touching the network.
IgFlareOptionsConstruction options for IgFlare.
ImageSizeThe pixel size of an image.
InsightsApiInsights of a professional (business or creator) account's own media.
InsightsRangeThe dates an account report covers. It ends now and starts 30 days earlier by default.
LocationApiPlaces: a location's own page, and the places near a coordinate.
LocationStateSent on every request and kept stable per account.
LoginCredentialsThe credentials for the older login endpoint.
MediaApiSingle media reads and actions.
MuteOptionsWhich of a user's content to mute; omit both to mute posts and stories.
NotesApiNotes: the short text over a profile picture in the inbox.
PageThe shape every paginated list endpoint returns: one page of items plus the cursor for the next page. nextCursor is absent on the last page. This is the low-level primitive. Callers that want to walk the whole list opt into the paginate iterator rather than looping the cursor by hand.
PasswordPublicKeyThe server key the password is encrypted for, as login hands it out.
PhotoUploadOptionsOptions for a photo post.
PrivateClientOptionsHow a PrivateClient is built: transport, session store and session-expiry hook.
PrivateRequestInputEverything a private-API request is built from, the session included.
PrivateResponseJsonA parsed private-API answer. The fields named here are the ones the error mapping reads.
ReactionOptionsOptions for a reaction.
ReelsApiReels: what a user posted, and the feeds of the Reels tab.
ReelsPageOptionsPaging for a reels feed.
ReelUploadOptionsOptions for a reel.
RegistrationTokenOptionsInputs for the token that registers a USDID identity.
ReplyListOptionsPaging for the replies to a comment.
RetryOptionsTuning for RetryTransport. All fields have conservative defaults.
SaveOptionsWhere to save a post.
SearchApiDiscovery search across users, hashtags and places.
SessionDataEverything needed to resume one logical account without logging in again.
SessionStoreLoads and persists a session. One of the three swappable seams.
ShareMediaOptionsOptions for sharing a post.
SignerBuilds the signed payload the private API expects. Isolated on purpose: this is the layer most likely to change, so everything that signs goes through this port and is pinned by golden vectors.
StoryApiStories.
TotpOptionsCode length, step and time for a TOTP code. The defaults match authenticator apps.
TwoFactorOptionsWhat a two-factor login on the older endpoint takes.
UploadApiPublishing media.
UsdidHeaderOptionsInputs for the signed USDID header sent on requests.
UsdidIdentityThe local P-256 signing identity behind the X-Meta-Usdid header and the USDID registration token the current Android app presents during CAA login. The private key never leaves the client. Only signatures and the public key are sent. Persist these fields to keep one stable identity across logins.
UserApiReads about any user.
UserReelsOptionsPaging for a user's reels.
UserTagWhere on the photo a person is tagged, as fractions of its width and height.
VideoMetaWhat an upload needs to know about an MP4: duration and frame size.
VideoUploadOptionsOptions for a video post.
VoiceOptionsOptions for a voice message.

Type Aliases ​

Type AliasDescription
AccountInsightsThe account overview, as parsed by accountInsightsSchema.
ActivityItemOne entry of the activity feed.
AlbumItemOne picture of an album: a photo, or a video with its cover.
AudienceInsightsThe audience report, as parsed by audienceInsightsSchema.
BioLinkOne link of the profile.
BodyEncodingHow the request body is encoded. signed is the default private-API body (signed_body=SIGNATURE.<json>). form url-encodes the payload as plain form fields, which the Bloks endpoints expect (they are sent unsigned).
CollectionA saved-posts collection.
CommentA comment, as parsed by commentSchema.
ContentInsightOne item of the content list, as parsed by contentInsightSchema.
DirectMessageOne message of a direct thread.
DirectSendResultWhere a sent message landed: its thread, item id and time.
EndpointNameThe name of every endpoint in the manifest.
FakeHandlerAnswers each request a FakeTransport receives.
FriendshipStatusHow the account relates to a user, as parsed by friendshipStatusSchema.
HashtagA hashtag, as parsed by hashtagSchema.
HighlightA story highlight, as parsed by highlightSchema.
HttpMethodThe HTTP methods the private API uses.
IgFlareLoginWhat login takes: the account credentials and, optionally, the second-factor source.
InsightMetricOne insights figure, as parsed by insightMetricSchema.
InsightsContentTypeThe kind of media the content list holds. Leave it out for all of them.
InsightsTimeA moment as a Date or as Unix seconds.
LocationA place, as parsed by locationSchema.
LocationInfoA place with its details, as parsed by locationInfoSchema.
MediaA post, reel or story, as parsed by mediaSchema.
MediaInsightsThe insights of a post or reel, as parsed by mediaInsightsSchema.
NoteA note, as parsed by noteSchema.
NoteAudienceWho may see a note.
PrivateRequestOptionsOne request to the private API, without the session, which the client adds.
RecipientSearchModeWhich recipients to search: everyone the account can message (universal) or the ones for disappearing photos (raven).
ReelA user's active stories, as parsed by reelSchema.
SendTargetWhere a direct message is sent: an existing thread, or one or more user ids.
ThreadA direct thread, as parsed by threadSchema.
TwoFactorSourceWhere the one-time code comes from: a literal code, a base32 TOTP secret the SDK turns into the current authenticator code, or a function that asks the caller (for example, prompting a person for an SMS or email code).
UserA user profile, as parsed by userSchema.

Variables ​

VariableDescription
accountInsightsSchemaThe account's overview for a date range: views, interactions, reach and visits.
activityItemSchemaOne entry of the activity feed (a like, a comment, a new follower, a mention, ...). story_type says which kind it is. The app has dozens and adds them often, so the kind stays a number and everything else passes through untouched.
API_DOMAINThe host of the private API.
ATTESTATION_KEYSTORE_ERRORThe error code the app reports when the hardware keystore attestation is unavailable. The CAA login flow accepts this degraded state, so the client presents it instead of a real hardware-backed attestation.
audienceInsightsSchemaWho follows the account: how many, their ages, places and when they are online.
bioLinkSchemaOne link in a profile's link list. link_id is normalized to a string id.
CAA_API_DOMAINThe domain the CAA/Bloks login flow talks to.
CHALLENGE_EMAILThe challenge method that sends the code by email.
CHALLENGE_SMSVerification channels for the common challenge flow.
collectionSchemaA saved-posts collection. Besides the ones a person makes, the app lists automatic ones (all saved posts, products). collection_type tells them apart.
commentSchemaA comment as the create endpoint returns it. Lean and lenient: only the exposed fields are typed, the rest pass through, and each is optional because the API's shape varies by context. The author is the shared User model.
contentInsightSchemaOne post, reel or story in the content list, with the figures the list was sorted by.
contentPageSchemaOne page of the content list.
DEFAULT_DEVICE_PROFILEThe Android device and app build this client presents itself as.
DEFAULT_LOCATIONThe locale, country and time zone a new session reports.
directMessageSchemaOne item in a direct thread. Lean and lenient: item_type distinguishes the payload (text, media, like, link, ...), so most fields are optional. Timestamps arrive as microsecond strings and are kept as strings.
directSendResultSchemaThe result of sending a direct message.
endpointsEvery endpoint the SDK calls, by name.
friendshipStatusSchemaThe relationship between the logged-in account and another user, as the private API reports it on the friendships endpoints. Only the fields the SDK exposes are typed. The rest pass through, and each is optional because the API includes a different subset per endpoint and context.
hashtagSchemaA hashtag as search and tag feeds return it. Lean and lenient.
highlightSchemaA story highlight. id is the app's form, highlight:123. The functions that take a highlight accept that or the bare 123. A highlight read on its own also carries its stories under items. One listed on a profile does not.
insightMetricSchemaOne figure of an insights screen, with the text the app shows next to it. value is null when the figure does not apply yet, and the text is then "--". The server sends the value under 1fvalue. The endpoints strip that marker before parsing.
locationInfoSchemaWhat a single location's own page knows: contact details, category and post count.
locationSchemaA place/location as search and location feeds return it. Lean and lenient.
mediaInsightsSchemaWhat the account's own insights say about one post or reel. The counts are for the whole life of the media. Reels add the watch figures (avg_watch_time, performance_factors). Only professional accounts have these, and only for their own media.
mediaSchemaA media post as the feed endpoints return it. A lean first cut: only the fields the SDK exposes are typed, the rest pass through, and each is optional/nullable because the API's shape varies by media type (photo/video/carousel) and context. media_type is 1 = photo, 2 = video, 8 = carousel. The author is the shared User model.
noteSchemaA note: the short text that sits over a profile picture in the inbox for a day. audience is 0 for mutual followers and 1 for close friends. The times are Unix seconds.
reelSchemaA story reel: a user's current story and its media items. Lean and lenient, reusing the User and Media models. The reels tray returns one per user with an active story. The user story endpoint returns a single reel.
threadSchemaA direct thread. The inbox returns threads with a last_permanent_item. The thread endpoint fills items. The author list is the shared User model.
USDID_TOKEN_TTLThe token time-to-live the app uses for USDID material, in seconds.
userSchemaA user as the private API returns it. Only the fields the SDK exposes are typed. Everything else passes through untouched so an upstream addition does not break callers. The API omits or nulls fields depending on privacy and context, so the types say so rather than overpromising. pk arrives as a number or a string and is normalized to a string id.

Functions ​

FunctionDescription
addCloseFriendAdds a user to the close friends list.
addThreadUsersAdds users to a group thread.
applyResponseToSessionPulls refreshed auth material out of response headers into the session.
approveRequestApproves a pending follow request from a user.
approveThreadApproves a pending thread (a message request), moving it to the main inbox.
archiveMediaArchives a post: it leaves the profile and moves to the archive.
base64urlURL-safe base64 with the padding stripped, as the app encodes these values.
blockUserBlocks a user.
bloksAsyncActionPerforms a Bloks async action: posts the form-encoded Bloks payload to bloks/async_action/<action>/ and returns the parsed response. Bloks requests are sent unsigned, so the body is plain form fields.
buildAttestationParamsBuilds the X-IG-Attest-Params value sent during CAA login: a single keystore attestation entry in the accepted "unavailable" state, carrying the server-issued challenge nonce. Returns an empty string when no nonce is known (the server has not been asked for one yet).
buildBaseHeadersThe stable X-IG-* headers derived from the device and profile. Live, time or session-based headers (pigeon timestamp, zero-rating, region hints) are added by the request layer once auth lands.
buildPrivateRequestBuilds a signed private-API request from the session. Pure: no network.
buildSignedBodyThe signed_body=SIGNATURE.<json> form body the app sends.
buildUsdidHeaderBuilds the three-part signed X-Meta-Usdid value: <usdid>.<expiresAt>.<sig>, where the signature covers <usdid>.<expiresAt>.
buildUsdidRegistrationTokenBuilds the ES256 registration token the app sends to register its USDID public key: a JWS-shaped envelope, itself base64url-encoded.
buildUserAgentThe User-Agent the app sends for a device profile.
caaLoginLogs in through Instagram's current Android CAA/Bloks flow, which replaced the retired accounts/login/ endpoint. Registers the device's USDID key, runs the CAA preflight (account access context + keystore attestation), then sends the encrypted password. On success the session carries the user id and the authorization token. When the account needs a two-factor code, the login resolves it itself if options.twoFactor says where the code comes from; otherwise a CaaTwoFactorRequiredError is thrown, to be resolved with resolveCaaTwoFactor.
commentMediaPosts a comment (or a reply, with repliedToCommentId) and returns the created comment.
createCollectionCreates a collection, optionally holding some posts from the start.
createDeviceStateGenerates a fresh device state. Pass saved ids in overrides to restore one.
createGroupThreadCreates a group thread and returns its id. Instagram needs at least two other participants for a group. With one, send to that user instead.
createHighlightCreates a highlight from some of the account's own stories (still on, or archived).
createNotePosts a note (a short text, up to 60 characters) and returns it.
createSessionA new session with a fresh device and nothing logged in.
createSignerThe default signer, which builds the signed body.
deleteCollectionDeletes a collection. The posts in it stay saved.
deleteCommentDeletes a comment from a media by the comment's id.
deleteCommentsDeletes several comments of a media in one request.
deleteHighlightDeletes a highlight. The stories in it are not deleted.
deleteMediaDeletes one of the logged-in account's own media by its id.
deleteMessageDeletes one of the account's messages from a thread (unsends it).
deleteNoteDeletes a note by its id (the note_id of a note the account posted).
denyRequestDenies (ignores) a pending follow request from a user.
editHighlightChanges a highlight: its title, its stories or its cover.
editMediaEdits the caption of one of the account's posts, and optionally tags or untags people. Returns the updated media. Tags are only sent when asked for, so a caption edit never changes them.
encryptPasswordEncrypts a password the way the app does: an RSA-wrapped AES-256-GCM session key over the password, packed as #PWD_INSTAGRAM:4:<ts>:<base64>. The public key comes from the launcher/sync response headers.
fetchPasswordPublicKeyFetches the current password encryption key from the launcher/sync headers.
findThreadByParticipantsThe existing thread with exactly these participants, or undefined when there is none.
followUserFollows a user by id. Returns the resulting friendship status.
generateAndroidDeviceIdA new Android device id (android- and 16 hex digits).
generateTotpGenerates the current RFC 6238 time-based one-time password (HMAC-SHA1) for a base32 secret, the same code an authenticator app shows. Uses node:crypto only.
generateUsdidIdentityGenerates (or restores, via overrides) a USDID identity.
generateUuidA new random UUID.
getAccountInsightsThe account overview for a date range: views, interactions, reach, profile visits.
getActivityReads the activity feed (likes, comments, new followers, mentions): what is new and what was already seen, first page. It never marks anything as seen.
getAudienceInsightsThe account's audience for a date range: followers, ages, places and active times.
getBioLinksThe links listed on the logged-in profile (empty when there are none).
getCollectionMediasOne page of the posts in a collection. Pass cursor to continue.
getCommentRepliesOne page of the replies to a comment. Pass cursor from a previous page to continue.
getCommentsOne page of a media's comments. Pass cursor from a previous page to continue.
getContentInsightsOne page of the account's posts, reels or stories ranked by a figure. Pass cursor to continue.
getCurrentUserFetches the logged-in account's own profile. Requires a logged-in session. It is the simplest way to confirm the captured authorization is accepted.
getExploreFeedOne page of the Explore feed. Pass cursor to continue.
getExploreReelsOne page of the reels Instagram suggests (the explore reels).
getFollowersOne page of a user's followers. Pass cursor from a previous page to continue.
getFollowingOne page of the accounts a user follows. Pass cursor to continue.
getFriendshipStatusReads the relationship with a user by id. friendships/show/ returns the status fields at the top level, so the whole response is validated.
getFriendsReelsOne page of the reels friends interacted with.
getHashtagFeedOne page of the posts listed for a hashtag, ranked by relevance (there is no chronological view). Posts come in the light form the search grid uses. See getHashtagSerpPage. Pass cursor to continue.
getHashtagInfoWhat a hashtag's page shows: its name and how many posts use it. Following a hashtag is not offered: Instagram retired it, and the old calls only answer ok without effect.
getHighlightOne highlight with its stories.
getInboxOne page of the direct inbox (threads). Pass cursor to continue.
getLikedMediasOne page of the posts the account has liked. Pass cursor to continue.
getLikersThe users who liked a media (the ranked first page).
getLocationFeedOne page of a location's recent media. Pass cursor to continue.
getLocationInfoA location's own page: contact details, category and how many posts are tagged there.
getMediaInfoFetches one media by its full id (the pk_userid composite the feed returns). media/{id}/info/ wraps the media in a one-element items array. The single item is validated into the Media model. A missing item or a shape mismatch surfaces as a typed error.
getNotesThe notes in the inbox tray: the account's own and those of followed accounts.
getPendingInboxOne page of the pending inbox (message requests). Pass cursor to continue.
getPendingRequestsOne page of incoming follow requests. Pass cursor to continue.
getPostInsightsInsights of one of the account's own posts: views, reach, interactions, where views came from.
getReelInsightsInsights of one of the account's own reels: the post figures plus watch time and rates.
getReelsFeedOne page of the Reels tab feed.
getReelsTrayThe story tray: one reel per account the session follows that has an active story.
getSavedPostsOne page of the account's saved posts. Pass cursor (a max_id) to continue.
getSpamInboxOne page of the spam inbox (hidden requests). Pass cursor to continue.
getThreadOne page of a thread's messages (newest first). Pass cursor to continue.
getTimelineFeedOne page of the home timeline. Pass cursor from a previous page to continue.
getUserFeedOne page of a user's own posts. Pass cursor from a previous page to continue.
getUserInfoFetches a user's profile by id. Returns the validated User model. A missing user or a response that does not match the schema surfaces as a typed error.
getUserInfoByUsernameFetches a user's profile by username. Returns the same validated User model.
getUserReelsOne page of a user's reels. Pass cursor to continue.
getUserStoriesA user's current story media, newest last. Returns an empty array when the user has no active story (the reel is null).
hideThreadHides (deletes from the inbox) a thread.
jazoestThe login anti-automation parameter: 2 followed by the sum of char codes.
likeCommentLikes a comment by its id.
likeMediaLikes a media by its full id. Resolves on success; throws a typed error otherwise.
listCollectionsLists the account's collections, the automatic ones included.
listHighlightsThe highlights on a profile (without their stories; read one for those).
loginLogs in with username and password. On success the session carries the user id and the authorization token, and is persisted if the client has a store. Two-factor, challenge and bad-password responses surface as typed errors.
markMessageSeenMarks a message, and the thread up to it, as seen.
markStoriesSeenMarks stories as seen, so the account appears among the owner's viewers. Takes the full story ids (pk_userid), the id of each story media.
muteThreadMutes a thread's notifications.
muteUserMutes a user's posts and/or stories (both by default).
paginateWalks every page of a cursor-paginated endpoint, yielding items one by one. fetchPage takes the cursor (undefined for the first page) and returns a Page. Iteration stops when a page has no nextCursor.
paginateCollectionMediasWalks the posts of a collection, one at a time across pages.
paginateCommentRepliesWalks every reply to a comment, yielding one at a time across pages.
paginateCommentsWalks a media's comments, yielding one at a time across pages.
paginateContentInsightsWalks the whole content list, one item at a time across pages.
paginateExploreFeedWalks the Explore feed, one post at a time across pages.
paginateExploreReelsWalks the explore reels, one at a time across pages.
paginateFollowersWalks every follower of a user, yielding one at a time across pages.
paginateFollowingWalks every account a user follows, yielding one at a time across pages.
paginateHashtagFeedWalks a hashtag's media, yielding one at a time across pages.
paginateInboxWalks every thread in the inbox, yielding one at a time across pages.
paginateLikedMediasWalks the posts the account has liked, one at a time across pages.
paginateLocationFeedWalks a location's media, yielding one at a time across pages.
paginatePendingInboxWalks every pending thread (message requests), one at a time across pages.
paginatePendingRequestsWalks every incoming follow request, yielding one at a time across pages.
paginateReelsFeedWalks the Reels tab feed, one reel at a time across pages.
paginateSavedPostsWalks the account's saved posts, yielding one at a time across pages.
paginateSpamInboxWalks every spam thread (hidden requests), one at a time across pages.
paginateThreadWalks every message in a thread, yielding one at a time across pages.
paginateTimelineWalks the home timeline, yielding one media at a time across pages.
paginateUserFeedWalks every post of a user, yielding one at a time across pages.
paginateUserReelsWalks a user's reels, one at a time across pages.
parseJpegSizeReads a JPEG's pixel dimensions from its start-of-frame marker. Pure and dependency-free: it walks the segment markers without decoding the image.
parseMp4MetaReads a video's duration and pixel dimensions from an MP4's moov metadata, without decoding the stream. Best-effort and dependency-free. Throws when the boxes are not found so the caller can supply the values instead.
parsePrivateResponseParses a private-API response, throwing a typed error on failure.
parseSessionDataParses untrusted JSON (a stored file) into a SessionData, or throws.
pinCommentPins a comment to the top of one of the account's own posts.
pinMediaPins a post to the top of the profile grid.
quotePlusMatches Python's urllib.parse.quote_plus: unreserved kept, space as +.
reactToMessageAdds, or removes, an emoji reaction on a message of a thread.
removeBioLinksRemoves profile links by id (the link_id of each entry in getBioLinks).
removeCloseFriendRemoves a user from the close friends list.
removeFollowerRemoves a user from the account's followers (they stop following it, without a block).
removeProfilePictureRemoves the profile picture (back to the default avatar) and returns the updated profile.
resolveCaaTwoFactorCompletes a CAA login that stopped at the two-factor step by driving the Bloks code-entry screens and submitting the code. On success the session carries the user id and the authorization, exactly as after a login with no second factor. Pass the error caaLogin threw and the code to submit, or a source for it. A source is asked only after the code-entry screen has opened: when the code is delivered out of band (an email or SMS), opening that screen is what makes the server send it, so it cannot be known earlier.
resolveTwoFactorCodeResolves a TwoFactorSource to the code string to submit.
saveMediaSaves a media to the account's saved posts, or to one of its collections.
searchHashtagsSearches hashtags by a free-text query, returning the ranked matches.
searchNearbyThe places near a coordinate, nearest first as the server ranks them.
searchPlacesSearches places by a free-text query, returning the matched locations.
searchRecipientsSearches the people the account can message, ranked, for a free-text query.
searchUsersSearches users by a free-text query, returning the ranked matches.
selectChallengeMethodChooses a verification channel (CHALLENGE_SMS or CHALLENGE_EMAIL); sends the code.
sendLinkSends a message whose text contains a link, so it renders as a link preview.
sendPhotoSends a JPEG photo into a thread (or the existing thread with the given users).
sendTextSends a text message to a thread or to users, returning the send result.
sendVideoSends an MP4 video (H.264 video, AAC audio) into a thread, or into the existing thread with the given users.
sendVoiceSends a voice message (an .m4a AAC clip) into a thread or the thread with the users.
setBiographySets the logged-in account's biography and returns the updated profile.
setBioLinkSets the profile link and returns the list as the profile now holds it. The profile keeps a list. This adds an external link to it. accounts/edit_profile/ ignores external_url, which is why this goes through its own endpoint.
setNameChanges the display name of the logged-in account and returns the updated profile. Instagram allows only a couple of name changes per 14 days. A refused change throws the server's own message.
setProfilePictureReplaces the profile picture with a JPEG and returns the updated profile.
setThreadTitleRenames a group thread.
shareMediaShares a post (by its full media id) into a thread or to users.
shareProfileShares a profile (by user id) into a thread or to users.
shareStoryShares a story (by its full id, pk_ownerPk) into a thread or to users. Only stories visible to the account can be shared.
signUsdidSigns a message with the identity key: ECDSA over SHA-256, DER-encoded.
startChallengeOpens the challenge referenced by a ChallengeRequiredError. Covers the common select-method / submit-code flow. Bloks and contact-form variants are not handled here. Their details are in the response data, for the caller to drive.
submitChallengeCodeSubmits the verification code. On success the session is finalized and persisted.
twoFactorLoginCompletes a login that returned TwoFactorRequired by submitting the code. On success the session carries the user id and authorization, and is persisted.
unarchiveMediaBrings an archived post back to the profile.
unblockUserUnblocks a user.
unfollowUserUnfollows a user by id. Returns the resulting friendship status.
unlikeCommentRemoves a like from a comment.
unlikeMediaRemoves a like from a media by its full id.
unmuteThreadUnmutes a thread's notifications.
unmuteUserUnmutes a user's posts and/or stories (both by default).
unpinCommentUnpins a pinned comment.
unpinMediaUnpins a post from the top of the profile grid.
unsaveMediaRemoves a media from the account's saved posts, or from one of its collections.
uploadAlbumPublishes 2 to 10 photos and videos as one carousel post. Every item is uploaded first, then one configure call publishes them together. That call is retried while a video is still being transcoded.
uploadPhotoPublishes a JPEG as a feed photo: uploads the bytes, then configures the post. The dimensions are read from the JPEG, so the caller passes only bytes and an optional caption.
uploadReelPublishes an MP4 as a reel. The caller supplies the cover JPEG (frame extraction needs a decoder, which the SDK does not bundle). Duration and size are read from the MP4 unless given. The steps are the app's: the upload settings, the video, the cover, then the configure call, retried while the server is still transcoding.
uploadStoryPhotoPublishes a JPEG as a story. Dimensions are read from the JPEG.
uploadVideoPublishes an MP4 as a feed video. The caller supplies a cover JPEG (frame extraction needs a decoder, which the SDK does not bundle). Duration and dimensions are read from the MP4 unless given in options. Configure is retried while the server is still transcoding.
usdidPublicKeyDerThe DER SubjectPublicKeyInfo for the identity's public key.

MIT License. Not affiliated with, endorsed or sponsored by Meta or Instagram.