Skip to main content
Skip table of contents

Public Instagram API Reference

The public API procedures may call the internal procedures which should not be used directly as they can be changed without any explicit notification in the newer versions of the connector. Internal procedures can be recognized by the prefix internal_ in their names. Public API procedures do not have such prefix in their names.

MyPages

Pages accessible for current account
Parameter
<target_table> (optional): Table name to save the data to
<preview> (optional): Preview only, don't write into table

Attribute

Type

id

long

name

string

category_id

long

category_name

string

category

string

permissions

string

access_token

string

Example

SQL
CREATE VIEW instagram_examples.example_MyPages AS
	SELECT * FROM instagram.MyPages (
		preview => TRUE
	)

PagesBusinessAccountID

Allows Users with a role on this Page to get the ID of its connected Instagram Business Account
Parameter
<pageId> (required): Page ID

Attribute

Type

Description

businessAccountID

long

Instagram Business Account ID

Example

SQL
Create View instagram_examples.example_PagesBusinessAccountID As
	Select * From instagram.PagesBusinessAccountID (pageId => 1993793344190867)

BusinessDiscovery

Information about other Instagram Business Accounts
Parameter
<businessAccountID> (required): Your Business Account ID
<businessUsername> (required): Username of the Business Account you want to target

Attribute

Type

Description

id

long

Business Account ID of the target Business Account

biography

string

Biography

followers_count

integer

Number of followers

media_count

integer

Number of media items

website

string

Website

Example

SQL
CREATE VIEW instagram_examples.example_BusinessDiscovery AS
	SELECT * FROM instagram.BusinessDiscovery (
		businessAccountID => 17841403396409607,
		businessUsername => 'cnn'
	)

Media

Media objects on an Instagram Business Account
Parameter
<businessAccountID> (required): Business Account ID
<target_table> (optional): Table name to save the data to
<preview> (optional): Preview only, don't write into table

Attribute

Type

Description

id

long

Media ID

parent_id

long

Parent media ID for carousel children items

ig_id

long

IG ID

caption

string

Caption (excludes carousel children)

comments_count

integer

Number of comments (excludes carousel children)

is_comment_enabled

boolean

If true, the comments are enabled (excludes carousel children)

like_count

integer

Number of likes (excludes carousel children)

media_type

string

Media type

media_url

string

Media direct URL

owner_id

long

Owner (only returned if the User making the query also owns the media object)

permalink

string

Permanent link

shortcode

string

Short code

thumbnail_url

string

Thumbnail URL (only available on videos)

timestamp

timestamp

Timestamp

username

string

Username

engagement

integer

Total number of likes and comments on the media object

impressions

integer

Total number of times the media object has been seen

reach

integer

Total number of unique accounts that have seen the media object

saved

integer

Total number of unique accounts that have saved the media object

video_views

integer

Total number of times the video has been seen

Example

SQL
CREATE VIEW instagram_examples.example_Media AS
	SELECT * FROM instagram.Media (
		businessAccountID => 17841403396409607,
		preview => TRUE
	)

MediaComments

Media Comments
Parameter
<media_id> (required): Media ID
<comment_id> (optional): Comment ID
<skipReplies> (optional): Skip comment replies
<target_table> (optional): Table name to save the data to
<preview> (optional): Preview only, don't write into table

Attribute

Type

id

long

parent_id

long

hidden

boolean

like_count

integer

media_id

long

text

string

timestamp

timestamp

user_id

long

username

string

Example

SQL
CREATE VIEW instagram_examples.example_MediaComments AS
	SELECT * FROM instagram.MediaComments(
	    media_id => 17933073463113309,
	    comment_id => null,
	    preview => TRUE
	)

Stories

Stories on an Instagram Business Account
Parameter
<businessAccountID> (required): Business Account ID
<target_table> (optional): Table name to save the data to
<preview> (optional): Preview only, don't write into table

Attribute

Type

Description

id

long

Media ID

ig_id

long

IG ID

comments_count

integer

Number of comments (excludes carousel children)

is_comment_enabled

boolean

If true, the comments are enabled (excludes carousel children)

like_count

integer

Number of likes (excludes carousel children)

media_type

string

Media type

media_url

string

Media direct URL

owner_id

long

Owner (only returned if the User making the query also owns the media object)

permalink

string

Permanent link

shortcode

string

Short code

thumbnail_url

string

Thumbnail URL (only available on videos)

timestamp

timestamp

Timestamp

username

string

Username

exits

integer

Number of times someone exited the carousel

impressions

integer

Total number of times the media object has been seen

reach

integer

Total number of unique accounts that have seen the media object

replies

integer

Total number of replies to the carousel

taps_forward

integer

Total number of taps to see this story's next photo or video

taps_back

integer

Total number of taps to see this story's previous photo or video

Example

SQL
CREATE VIEW instagram_examples.example_Stories AS
	SELECT * FROM instagram.Stories (
		businessAccountID => 17841403396409607,
		preview => TRUE
	)

UserMedia

Media of a specified Instagram Business Account
Parameter
<businessAccountID> (required): Business Account ID
<businessUsername> (required): Username of the Business Account you want to target
<target_table> (optional): Table name to save the data to
<preview> (optional): Preview only, don't write into table

Attribute

Type

Description

id

long

Media ID

parent_id

long

Parent media ID for carousel children items

caption

string

Caption (excludes carousel children)

comments_count

integer

Number of comments (excludes carousel children)

like_count

integer

Number of likes (excludes carousel children)

media_type

string

Media type

media_url

string

Media direct URL

owner_id

long

Owner

timestamp

timestamp

Timestamp

username

string

Username

Example

SQL
CREATE VIEW instagram_examples.example_UserMedia AS
	SELECT * FROM instagram.UserMedia (
		businessAccountID => 17841403396409607,
		businessUsername => 'cnn',
		preview => TRUE		
	)

UserComments

User Media Comments
Parameter
<businessAccountID> (required): Business Account ID
<skipReplies> (optional): Skip comment replies
<media_table> (required): Fully-qualified name of the table, containing user media
<target_table> (optional): Table name to save the data to
<preview> (optional): Preview only, don't write into table

Attribute

Type

id

long

parent_id

long

hidden

boolean

like_count

integer

media_id

long

text

string

timestamp

timestamp

user_id

long

username

string

UserDailyInsights

Daily insights for the Instagram Business Account
Parameter
<businessAccountID> (required): Business Account ID
<startDate> (required): Initial date for the insights
<target_table> (optional): Table name to save the data to
<preview> (optional): Preview only, don't write into table

Attribute

Type

Description

businessAccountID

long

Business Account ID

end_time

timestamp

Insights date

email_contacts

integer

Total number of taps on the email link in this profile

follower_count

integer

Total number of unique accounts following this profile

get_directions_clicks

integer

Total number of taps on the directions link in this profile

impressions

integer

Total number of times this profile has been seen

phone_call_clicks

integer

Total number of taps on the call link in this profile

profile_views

integer

Total number of unique accounts that have viewed this profile within the specified period

reach

integer

Total number of unique accounts that have seen this profile

text_message_clicks

integer

Text Message Clicks

website_clicks

integer

Total number of taps on the website link in this profile

Example

SQL
CREATE VIEW instagram_examples.example_UserDailyInsights AS
	SELECT * FROM instagram.UserDailyInsights(
	    businessAccountID => 17841403396409607,
	    startDate => TimestampAdd(SQL_TSI_MONTH, -1, CurDate()),
	    preview => TRUE
	)

UserOnlineFollowers

Total number of this profile's followers that were online during the specified period
Parameter
<businessAccountID> (required): Business Account ID
<startDate> (required): Initial date for the insights
<target_table> (optional): Table name to save the data to
<preview> (optional): Preview only, don't write into table

Attribute

Type

Description

businessAccountID

long

Business Account ID

end_time

timestamp

Insights date

0

integer

Number of online followers 0:00-1:00

1

integer

Number of online followers 1:00-2:00

2

integer

Number of online followers 2:00-3:00

3

integer

Number of online followers 3:00-4:00

4

integer

Number of online followers 4:00-5:00

5

integer

Number of online followers 5:00-6:00

6

integer

Number of online followers 6:00-7:00

7

integer

Number of online followers 7:00-8:00

8

integer

Number of online followers 8:00-9:00

9

integer

Number of online followers 9:00-10:00

10

integer

Number of online followers 10:00-11:00

11

integer

Number of online followers 11:00-12:00

12

integer

Number of online followers 12:00-13:00

13

integer

Number of online followers 13:00-14:00

14

integer

Number of online followers 14:00-15:00

15

integer

Number of online followers 15:00-16:00

16

integer

Number of online followers 16:00-17:00

17

integer

Number of online followers 17:00-18:00

18

integer

Number of online followers 18:00-19:00

19

integer

Number of online followers 19:00-20:00

20

integer

Number of online followers 20:00-21:00

21

integer

Number of online followers 21:00-22:00

22

integer

Number of online followers 22:00-23:00

23

integer

Number of online followers 23:00-24:00

Example

SQL
CREATE VIEW instagram_examples.example_UserOnlineFollowers AS
	SELECT * FROM instagram.UserOnlineFollowers( 
		businessAccountID => 17841403396409607,
		startDate => TimestampAdd (SQL_TSI_DAY, -30, CurDate()),
		preview => TRUE
	)

CreateProcedure_UserLifetimeInsights

Creates procedure UserLifetimeInsights by adjusting it's output to the the returned metrics
Parameter
<businessAccountID> (required): Business Account ID
<procedureLabel> (optional): Label to add to the procedure
<returnCodeOnly> (optional):

Attribute

Type

procedureCode

clob

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.