Instagram Private API icon

Instagram Private API

Interact with Instagram using the private API

Overview

The Instagram Private API node for n8n allows you to interact with Instagram using its private API. Specifically, the Get User Info operation retrieves detailed information about a user based on their User ID. This is useful in scenarios where you need to fetch profile data for analytics, enrichment, or automation tasks involving Instagram users.

Practical examples:

  • Enriching CRM records with Instagram profile details.
  • Verifying the existence and status of an Instagram account before outreach.
  • Collecting user metadata for reporting or monitoring purposes.

Properties

Display Name Type Meaning
User ID String The unique identifier of the Instagram user whose information you want to retrieve.

Output

The output is a JSON object with the following structure:

{
  "success": true,
  "userId": "<provided User ID>",
  "sessionData": { /* session info, opaque */ },
  "userInfo": { /* Instagram user profile data as returned by the API */ }
}
  • success: Boolean indicating if the operation was successful.
  • userId: The User ID that was queried.
  • sessionData: Session information (opaque; used for maintaining authentication state).
  • userInfo: An object containing the user's profile information as returned by Instagram's private API. The exact fields depend on Instagram's response but typically include username, full name, profile picture URL, follower/following counts, etc.

If an error occurs and "Continue On Fail" is enabled, the output will instead be:

{
  "success": false,
  "error": "<error message>"
}

Dependencies

  • External Service: Instagram account credentials are required.
  • API Key/Credentials: You must provide valid Instagram login credentials and optionally session data via n8n credentials named instagramPrivateApi.
  • Node.js Modules: Uses instagram-private-api, fs, path, and os modules.
  • n8n Configuration: No special configuration beyond providing credentials, but persistent storage is used for session management (~/.n8n/instagram-sessions/).

Troubleshooting

Common Issues:

  • Invalid Credentials: If your Instagram username or password is incorrect, authentication will fail.
  • Session Expiry: If the session data is outdated or invalid, the node will attempt to re-authenticate.
  • Missing User ID: If the "User ID" property is empty, the node will throw an error: "User ID is required".
  • Account Verification Required: If Instagram requires additional verification (checkpoint), you may see: "Checkpoint required. Please verify your account."
  • Login Required: If the session is not valid, you may see: "Login required. Please authenticate with Instagram first."
  • User Not Found: If the provided User ID does not exist, you may see: "User ID is required" or an error indicating the user was not found.

How to resolve:

  • Double-check your Instagram credentials and session data.
  • Ensure the User ID is correct and exists.
  • If prompted for checkpoint or login, follow Instagram's instructions to verify your account.
  • If errors persist, try regenerating session data using the "Manage Session" operation.

Links and References

Discussion