Sprout API

Sprout API Overview

The Sprout API provides an externally accessible API for you to access your owned social profile data so you can use that data to power dashboards and automate your reporting.

By developing or accessing these endpoints, you are acknowledging that you have read and agreed to the developer terms. If you are interested in being a tech partner with Sprout, please fill out this form so we can get in touch.

Available Data Overview

✅  The Sprout API includes:

  • ✅  Owned Profile Data - This matches the data available in Sprout’s Profile Performance, X Profiles, Facebook Pages, Instagram Business Profiles, LinkedIn Pages, Pinterest Profiles, TikTok Profiles and YouTube Videos Report.
  • ✅  Post Data - This matches the data available in Sprout’s Post Performance Report.
  • ✅  Owned demographic data - View the data available in Sprout’s Facebook Pages, Instagram Business Profiles, LinkedIn Pages, and TikTok Profiles Report
  • ✅  Message Data - Get detailed information, including metadata, about your messages. This includes messages received by and replied to from your profiles.
  • ✅  Publishing Posts - Create Publishing Posts within Sprout.
  • ✅  Media Upload - Upload Media for use with Publishing Posts.
  • ✅  Direct Tableau Connector - Easily analyze Sprout API data directly in Tableau. For more details reference the Tableau Connector section of this doc.
  • ✅  Listening Topics - Retrieve earned media related metrics and messages found within your Listening Topics. For more details reference sections regarding Topics within this doc.

For specific data and metrics, reference the Metrics and Fields sections of this doc.

🚫  The Sprout API does not currently include:

  • 🚫  Paid (Ad Account) data
  • 🚫  Listening data from X

Terminology

  • Post: A post refers to a message that was published by an owned profile. A Publishing Post exists in Sprout and is intended to be published at a future time.
  • Message: A message refers to any message that was published by or received by an owned profile or Topic. All posts are messages, but not all messages are posts.
  • Profile: A profile refers to an account, page, handle, etc. on a native social network, like X or Instagram.

Access Requirements & Authentication

Before accessing the API, your account must be provisioned for API use by your Sprout account representative. Once your account is provisioned, you must do one of the following to authenticate API requests:

  1. Create an account-scoped access token
  2. (New) Create an OAuth access token using our OAuth 2.0 provider

Creating an Account-Scoped Access Token

An account's owner can create new account-scoped access tokens via the API Tokens settings page. They can also view or invalidate existing tokens (i.e. prevent the tokens from being used for client requests).

  1. Log in to Sprout and navigate to the API Tokens settings page.

  1. Accept Sprout’s Analytics API Terms of Service if you haven’t already.
  2. Click Create API Token in the upper right corner of the Token Management section.

  1. Enter a name for your token.

  1. Copy the token for use. Be sure to store this securely.

Creating an OAuth Access Token Using our OAuth 2.0 Provider

Sprout's OAuth provider follows OpenId Connect (OIDC) and OAuth 2.0 industry standard specifications to federate identity & authentication and grant short-lived user credentials (i.e. OAuth access tokens) that can be used to access the API.

Obtaining a Client ID and Secret

To interact with Sprout's OAuth provider, you must obtain a Client ID and Secret using the API Tokens settings page. An account's owner can create or manage a client via the API Tokens settings page.

  1. Log in to Sprout and navigate to the API Tokens settings page.

  1. Accept Sprout’s Analytics API Terms of Service if you haven’t already.
  2. Click Generate configuration in the upper right corner of the OAuth Client Management section.

  1. Enter a name for your client, a description, and a list of allowed redirect URIs.

  1. Copy the Client ID and Secret for use. Be sure to store these securely.

Obtaining an OAuth Access Token

Now that you have a Client ID and Secret, you can use the Sprout OAuth provider to obtain an OAuth access token, which you will use to interact with the API.

Your client is setup to use the Authorization Code Grant flow to obtain access tokens. You may use the OAuth/OIDC specifications to learn how to do this.

X Data: X Content End User License Agreement

Note: X has additional review and compliance requirements around exposing data through the API. You’re required to undergo a brief review and approval process before you can access X's data through the Sprout API.

Contact your Sprout Social account representative to initiate the review process with X. After X approves your use case, the Account Owner needs to accept the Analytics API X Content End User License Agreement. This appears at the top of the API Tokens settings page.

Sprout API Details

API URL

https://api.sproutsocial.com

Endpoints Overview

Sprout API endpoints are grouped into three collections:

  1. Customer Metadata Endpoints - Use these endpoints to obtain high-level information about your Sprout customer account and profiles you have access to; many of these endpoints provide data needed to make requests to other Sprout API endpoints.
  2. Analytics Endpoints - These endpoints provide information about your Sprout profiles, and posts.
  3. Listening Endpoints - These endpoints provide metrics and messages related to your Listening Topics.
  4. Messages Endpoint - This endpoint provides detailed data and metadata about your Sprout messages.
  5. Publishing Post Endpoints - These endpoints allow for creation and management of posts that will be published at a future time.
  6. Media Endpoints - These endpoints are used to upload media for use within the API.
Customer Metadata Endpoints Description
GET /v1/metadata/client Customer ID
GET /v1/<customer ID>/metadata/customer Customer Profiles
GET /v1/<customer ID>/metadata/customer/tags Customer Tags
GET /v1/<customer ID>/metadata/customer/groups Customer Groups
GET /v1/<customer ID>/metadata/customer/users Customer Users
GET /v1/<customer ID>/metadata/customer/topics Customer Topics
Analytics Endpoints Description
POST /v1/<customer ID>/analytics/profiles Owned Profile Analytics
POST /v1/<customer ID>/analytics/posts Post Analytics
Listening Endpoints Description
POST /v1/<customer ID>/listening/topics/<topic id>/messages Topic Messages
POST /v1/<customer ID>/listening/topics/<topic id>/metrics Topic Metrics
Messages Endpoint Description
POST /v1/<customer ID>/messages Inbox Messages
Publishing Post Endpoints Description
POST /v1/<customer ID>/publishing/posts Create Publishing Post
GET /v1/<customer ID>/publishing/posts/<publishing_post_id> Retrieve Publishing Post
Media Upload Endpoints Description
POST /v1/<customer ID>/media/ Upload Media in a single request < 50MB
POST /v1/<customer ID>/media/submission Start multipart media upload
POST /v1/<customer ID>/media/submission/<submission_id>/part/<part_number> Continue multipart media upload
GET /v1/<customer ID>/media/submission/<submission_id> Complete multipart media upload

General API Structure

All endpoints use the following naming structure:

/<version>/<customer ID>/<endpoint path>

Where:

  • version is the API major version number
  • customer ID is your Sprout customer ID

Versioning

The Sprout API is versioned using a MAJOR.MINOR version format.

You can specify only the major number in requests, but the full version is included in responses.

A major version represents a breaking change to the API, including updates to the syntax and semantics for making requests of the APIs and the syntax and semantics of the response of the API.

A minor version represents a backwards compatible change to the API, such as adding new metrics, new endpoints, metric updates, etc. Minor versions are reflected in documentation, but not the API URL itself. Due to the backwards compatibility of minor versions, you only need to specify the major version in the URL path.

Rate Limits

You’re limited to the following number of requests:

  • 60 requests per minute
  • 250,000 requests per month

Endpoints

Requests

All requests have the following format:

Request Headers

Type Value
Authorization Bearer <API access token>
Accept application/json
Content-Type application/json

Note that the Authorization header accepts both account-scoped and OAuth access tokens.

Request Body

The content body for all requests are JSON objects. Details of the structure of that JSON object depend on the endpoint.

Responses

HTTP Status Codes

The following HTTP status codes returned with the response have the following meanings:

Code Meaning Corrective Action
200 OK Request was processed successfully. None. You should be able to access the result of the request in the response body.
202 Ready Request was processed successfully but not ready for a proper answer. Retry the request. If this code persists, contact support.
400 Bad Request The request is malformed and does not conform with the request bodies specified in this document. Update the request body.
401 Unauthorized The request does not contain a valid access token or that access token has expired. Reauthenticate and obtain a fresh token.
403 Forbidden The request is accessing customer or profile data that the client is not allowed access to. Update the request body.
404 Not Found The client is requesting an endpoint that does not exist. Check your endpoint, and use an existing endpoint.
405 Method Not Allowed The client is using an HTTP verb that is not appropriate. Use the HTTP verb listed for the API endpoint you’re using, typically POST or GET. See the specific endpoint documentation for details.
415 Unsupported Media Type The client has submitted a request body that is not JSON or is requesting a response that is not JSON Correct the Accept and Content-Type headers to use JSON.
429 Too Many Requests The client is making requests too quickly or has exhausted the allowed requests in a month. Slow down your requests.
500 Internal Server Error The server had an issue processing the request. Retry the request. If this code persists, contact support.
503 Service Unavailable The server is overloaded and cannot process the request. Retry the request. If this code persists, contact support.
504 Gateway Timeout The server was unable to produce a result in time. Retry the request. If this code persists, contact support or decrease the scope of the request (smaller date ranges, less profiles, etc.).

Response Headers

The following headers are returned with each response:

Header Description Sample Value
X-Sprout-Request-ID Randomly generated UUID to trace a client request and response. Returned to you for debugging. bedc387d-9b99-42ae-9887-cc15f9885d47
X-Sprout-API-Version Major and minor version of the response 1.1
X-Sprout-Server-Version Server version, including the major, minor, and build number. The major and minor version reflect the latest available version of the API. 1.1.3018

Response Body

Responses from the data API are JSON objects with the following format:

Key Value
data JSON array containing the results of the API request (JSON objects for each message, dimensioned data, etc.)
paging Optional JSON object describing the status of paging the data returned in the response.
error Optional JSON string containing an error message in the event there is an issue with the request.

Customer Metadata Endpoints

Customer Metadata endpoints are all HTTP GET endpoints. Use these to obtain information about the customer and profiles you have access to.

Client (Customer ID) Endpoint

GET /v1/metadata/client

This endpoint is used to obtain the customer ID you have access to.

Request Body - Client (Customer ID) Endpoint

No request body is necessary for this request.

Response Data - Client (Customer ID) Endpoint

The data array contains JSON objects of customer IDs you have access to. For example:

{
  "data": [
    {"customer_id": 687751}
  ]
}

Customer Profiles Endpoint

GET /v1/<customer ID>/metadata/customer

This endpoint is used to obtain the list of customer profile IDs you have access to.

Request Body - Customer Profiles Endpoint

No request body is necessary for this request.

Response Data - Customer Profiles Endpoint

The data array contains an array of JSON objects describing the social network profiles that are available to that client. The JSON object contains:

Key Description Example Value
customer_profile_id The customer profile ID used by Sprout to identify this social network profile. 492
network_type The type of social network (X, Facebook, Instagram, etc.) twitter
name The human-facing name of the social network profile Sprout Social
native_name The user name, screen name, page URL, etc. the social network uses to identify a unique profile. sproutsocial
native_id The ID used by the social network to identify a unique profile. 42793960
groups An array of group IDs this profile belongs to. [23598, 65245]

An example response:

{
  "data": [
      {
        "customer_profile_id": 492,
        "network_type": "twitter",
        "name": "Sprout Social",
        "native_name": "sproutsocial",
        "native_id": "42793960"
      },
      ...
  ]
}

Customer Tags Endpoint

GET /v1/<customer ID>/metadata/customer/tags

This endpoint is used to obtain the list of message tags you created in Sprout. The response includes all active and archived tags, regardless of when the tag was created. Previously deleted tags are permanently removed from Sprout and are not included.

Request Body - Customer Tags Endpoint

No request body is necessary for this request.

Response Data - Customer Tags Endpoint

The data array contains an array of JSON objects describing the tags that are available. This includes all tags in a single response. There is no limit or pagination in the response. The JSON object contains:

Key Description Example Value
tag_id The ID used by Sprout to identify this message tag 321
any_group Whether or not this tag is available in any customer group false
active Whether this tag is active (or archived) in Sprout Social true
text The text of the tag "Social Support"
type The type of the tag (LABEL or CAMPAIGN) "LABEL"
groups An array of the IDs of the groups this tag is available in [206063]

An example response:

{
  "data": [
      {
        "tag_id": 321,
        "any_group": false,
        "active": true,
        "text": "Social Support",
        "type": "LABEL",
        "groups": [206063]
      },
      ...
  ]
}

Customer Groups Endpoint

GET /v1/<customer ID>/metadata/customer/groups

This endpoint is used to obtain the list of groups you created in Sprout.

Request Body - Customer Groups Endpoint

No request body is necessary for this request.

Response Data - Customer Groups Endpoint

The data array contains an array of JSON objects describing the groups that are available to you. The JSON object contains:

Key Description Example Value
group_id The ID used by Sprout to identify this group 1234
name The name of the group "Sprout Social Team"

An example response:

{
  "data": [
      {
        "group_id": 1234,
        "name": "Sprout Social Team"
      },
      ...
  ]
}

Customer Users Endpoint

GET /v1/<customer ID>/metadata/customer/users

This endpoint is used to obtain the list of users that are active for your customer.

Request Body - Customer Groups Endpoint

No request body is necessary for this request.

Response Data - Customer Groups Endpoint

The data array contains an array of JSON objects describing the active users for your customer. The JSON object contains:

Key Description Example Value
id The ID used by Sprout to identify this user 1234
name The name of the user "John Doe"

An example response:

{
  "data": [
      {
        "id": 1234,
        "name": "John Doe"
      },
      ...
  ]
}

Customer Topics Endpoint

GET /v1/<customer ID>/metadata/customer/topics

Utilize this endpoint to find all Topics associated with your customer id. Each Topic includes associated metadata such as themes and available date ranges.

Request Body - Customer Topics Endpoint

No request body is necessary for this request.

Response Data - Customer Topics Endpoint

The data array contains an array of JSON objects describing the Topics that are available to the client. The JSON object contains:

Key Description Example Value
id An identifier for the Topic used to make calls for Topic data 81391723128379
name The name of the Topic Sprout Social Brand
topic_type The Topic category BRAND_HEALTH
description A description given by the user when creating the Topic A Topic for the brand.
group_id The group the Topic belongs to 123456789
theme_groups The list of themes belonging to the Topic. Themes are always grouped even when they may not appear that way in app. [{"name":"Complaints","themes":[{"id":"018085b6-1dc3-43eb-ab28-3c430c0d2412","name":"SlowLogin"}]}]
theme_groups.name The name of the theme group Complaints
theme_groups.themes The themes that belong to the group [{"id":"018085b6-1dc3-43eb-ab28-3c430c0d2412","name":"SlowLogin"}]
theme_groups.themes.id The unique ID of the theme 018085b6-1dc3-43eb-ab28-3c430c0d2412
theme_groups.themes.name The name for the theme SlowLogin
availability_time A date representing how far back data is available for the Topic 2020-11-17T09:32:00Z

An example response:

[
 {
   "id": "81391723128379",
   "description": "",
   "group_id": 1330748,
   "theme_groups": [
     {
       "name": "Complaints",
       "themes": [ 
        {
         "id": "018085b6-1dc3-43eb-ab28-3c430c0d2412",
         "name": "Login Errors"
        }
       ],
     }
   ],
   "availability_time": 1600895454244,
   "topic_type": "INDUSTRY_INSIGHTS",
   "name": "Sprout Social Brand"
 }
]

Analytics Endpoints

Analytics endpoints are all HTTP POST endpoints. They provide access to your owned profile and post analytics data, including:

  • Profile Analytics - profile activity broken down by day
  • Post Analytics - message content, metadata and lifetime activity metrics

Overview

All requests to and responses from Analytics API endpoints have a similar structure.

Requests - Analytics Endpoints

The request body for an analytics API request is a JSON object with the following name/values pairs:

Key Description Example Value
filters Detailed filters used to filter the results by customer_profile_id, reporting_period (for Profile metrics) and message created_time (for Posts endpoint). Profile Endpoint: ["customer_profile_id.eq(1234, 5678)", "reporting_period.in(2018-01-01...2018-02-01)"]

Posts Endpoint: ["customer_profile_id.eq(1234, 5678)", "created_time.in(2018-01-01...2018-02-01)"]
metrics List of metrics to return in results; refer to the metrics section for post and profile metrics available for each social network type ["impressions", "likes"]
page
(optional)
In paginated results, which 1-indexed page to return in the response.
Pagination is based on default limits of 1000 results for the Profiles endpoint and 50 results for the Posts endpoint
3
limit
(optional)
Specifies the max number of results per page in the response.
Defaults to 1000 results for the Profiles endpoint and 50 results for the Posts endpoint.
100
sort
(optional)
(Posts endpoint only)
Sets the sort order for results, specified as a list of fields and directions (asc or desc) in the format <field>:<direction>.
["created_time:asc"]
timezone
(optional)
(Posts endpoint only)
Time zone—from the ICANN time zone database. Timezone arguments only impact date/time-related filters, responses are not impacted and are always in UTC for posts.
"America/Chicago"
fields
(optional)
(Posts endpoint only)
List of fields to return in results; if omitted, only the guid field is returned. Refer to the Message Fields section for full list of valid fields
["content_category", "created_time", "from.name"]

Responses - Analytics Endpoints

Responses follow the standard data API response format:

data

This array contains the analytics data requested. See specific endpoints for additional details.

paging

This object specifies the state of paging for this response:

Key Description Example Value
current_page 1-indexed page number of the response 3
total_pages Total number of pages for the request 20

A paging object is always returned, including when the response contains all data in one page. You can rely on checking for current_page = total_pages in order to know when you are at the end of the paging sequence.

Requesting a page greater than total_pages will return a HTTP 400 Bad Request response with a message describing the error.

Limitations

Note the maximum response size is capped at 10,000 results. For example, if a request with 50 responses per page is made, you will get at most 200 total_pages back. Anything beyond this 10,000 limit will be truncated as a performance guardrail.

To request data for responses with more than 10,000 results, use a cursor-based pagination approach following these steps:

1.) Prepare the API URL for the specific endpoint you want to retrieve data from.

2.) Define the request body by specifying the necessary parameters like limit, timezone, filters, fields, and metrics criteria.

3.) Set the appropriate headers, including any required authentication or session information.

4.) Set the "sort" field to organize the response data by "guid" in ascending order

5.) Send an initial request to the API endpoint to retrieve a batch of data, specifying a limit on the number of items to be returned per request (e.g. 100 items per request).

6.) Process the sorted response data and extract the last "guid" value from the response. This "guid" will be used as the cursor for the next request.

7.) Send a subsequent request to the API endpoint. We’ll filter for posts with a guid greater than the guid we saw in the previous step to fetch the next batch of data. This request should also specify the limit and any other necessary parameters. See below for an example request to see how this is done.

8.) Repeat steps 2-7 until there are no more GUID's left in the response. Each time you receive a response, extract the last "guid" value, and use it to filter posts with greater guids for the following requests.

9.) As you receive the paginated responses, you can store or process the data as needed.

Initial Request:

{                                                                            
    "filters": [
        "customer_profile_id.eq(123, 4567, 890)"
    ],
    "fields": [
        "guid"
    ],
    "sort": [
        "guid:asc"
    ],
    "limit": 2 
}

Initial Response:

{
    "data": [
        {
            "guid": "101"
        }, 
        {
            "guid": "102"
        }
    ]
}

Subsequent Request:

{                                                                           
    "filters": [
        "guid.gt(102)",                                       
        "customer_profile_id.eq(123, 4567, 890)"
    ],
    "fields": [
        "guid"
    ],
    "sort": [
        "guid:asc"
    ],
    "limit": 2 
}

Note that the last guid from the initial response (102) was used as a filter for the subsequent response ( "guid.gt(102)"). Each request thereafter should continue to filter on the last guid from the previous response until no more guids are returned.

Owned Profile Analytics Endpoint

POST /v1/<customer ID>/analytics/profiles

The profiles endpoint is used to query profile-level metrics for a given set of profiles.

Request Body - Owned Profile Analytics Endpoint

An example request:

{
  "filters": [
    "customer_profile_id.eq(1234, 5678, 9012)",
    "reporting_period.in(2018-08-01...2018-10-01)"
  ],
  "metrics": [
    "impressions",
    "reactions"
  ],
  "page": 1
}

Response Data - Owned Profile Analytics Endpoint

An example response:

{
  "data" : [
      {
        "dimensions": {
          "reporting_period.by(day)": "2018-08-01",
          "customer_profile_id": 1234
        },
        "metrics": {
          "impressions": 3400,
          "reactions": 12
        }
      },
      {
        "dimensions": {
          "reporting_period.by(day)": "2018-08-01",
          "customer_profile_id": 5678
        },
        "metrics": {
          "impressions": 23423,
          "reactions": 29
        }
      },
      ...
  ],
  "paging": {
    "current_page": 2,
    "total_pages": 3
  }
}

Profile Request Limits & Pagination

  • customer_profile_id (filters): maximum of 100 profiles per request
  • reporting_period (filters): maximum of 1 year per request
  • Pagination of response: pagination is based on 1000 results per response

Profile Time Zone

Profile daily activity uses the time zone of the native network. These time zones are the same that are used by native networks when grouping profile level activity.

Network Timezone
X UTC
Facebook PST/PDT
Instagram PST/PDT
LinkedIn UTC
YouTube PST/PDT
Pinterest UTC
Tiktok UTC

Post Analytics Endpoint

POST /v1/<customer ID>/analytics/posts

The posts content endpoint queries for individual sent posts based on a filter criteria.

Request Body - Post Analytics Endpoint

An example request:

{
  "fields": [
    "created_time",
    "perma_link",
    "text",
    "internal.tags.id",
    "internal.sent_by.id",
    "internal.sent_by.email",
    "internal.sent_by.first_name",
    "internal.sent_by.last_name"
  ],
  "filters": [
    "customer_profile_id.eq(1234, 5678, 9012)",
    "created_time.in(2020-04-06T00:00:00..2020-04-19T23:59:59)"
  ],
  "metrics": [
    "lifetime.impressions",
    "lifetime.reactions"
  ],
  "timezone": "America/Chicago",
  "page": 1
}

Response Data - Post Analytics Endpoint

An example response:

{
  "data": [
      {
        "text": "Come by for a cold brew!",
        "perma_link": "https://www.instagram.com/p/B-pIo1GFqyl/",
        "metrics": {
          "lifetime.impressions": 15,
          "lifetime.reactions": 0
        },
        "created_time": "2020-04-06T14:27:03Z",
        "internal": {
          "tags": [
            {"id": 111111},
            {"id": 111112},
            {"id": 111113}
        ],
        "sent_by": {
          "id": 1155555,
          "email": "sprout.user@sproutsocial.com",
          "first_name": "Sprout",
          "last_name": "User"
        }
      },
      ...
  ],
  "paging": {
    "current_page": 1,
    "total_pages": 3
  }
}

Post Request Limits & Pagination

  • customer_profile_id (filters): maximum of 100 profiles per request
  • Pagination of response: pagination is based on 50 messages per response

Messages Endpoint

POST /v1/<customer ID>/messages

The messages endpoint provides detailed data and metadata about your Sprout messages.

Requests - Messages Endpoint

The request body for a Messages request is a JSON object with the following name/values pairs:

Key Description Example
filters Refer to the Request Filters section below for details ["group_id.eq(78910)", "customer_profile_id.eq(1234, 5678)", "created_time.in(2022-01-01..2022-02-01)"]
fields
(optional)
List of fields to return in results. If omitted, only the guid field is returned. Refer to the Message Fields section for full list of valid fields ["post_type", "created_time", "from.name", "text"]
limit
(optional)
Specifies the max number of results per page in the response
Default: 50, Max: 100
10
timezone
(optional)
Time zone — from the ICANN time zone database — used for period values "America/Chicago"
page_cursor
(optional)
In paginated results, specifies the next page of data to return. Pagination for the messages endpoint only supports fetching the 'next' page of data. See Messages Request Limits & Pagination section for details "page_cursor": "abc123=="
sort
(optional)
Return results sorted by message created_time
Default: descending
["created_time:asc"]

Request Filters - Messages Endpoint

All requests to the Messages Endpoint require a filter parameter; the following table details the available filter options, which includes both required and optional filters:

Filter Name Description Example Values
group_id Exactly one Group Id to retrieve messages for "group_id.eq(78910)"
customer_profile_id One or more Profile ids to retrieve messages for; these profiles must all belong to the requested group_id "customer_profile_id.eq(1234, 5678)"
created_time Only return messages having a created_time within the provided date range; accepts either dates or datetimes. Dates without timestamps are interpreted as midnight of that date, i.e. 2022-06-09 is treated as 2022-06-09T00:00:00 "created_time.in(2022-01-01...2022-02-01)"
action_last_update_time
(optional)
Only return messages which have a Sprout action (Reply, Tag, Like or Complete) having an action_time within the provided date range; accepts either dates or datetimes. Dates without timestamps are interpreted as midnight of that date, i.e. 2022-06-09 is treated as 2022-06-09T00:00:00. This range cannot be chronologically before the created_time range "action_last_update_time.in(2022-01-01...2022-02-01)"
post_type
(optional)
If provided, only messages of this type will be returned; defaults to all message types if omitted. Refer to the Post Types table for full list of valid post_types available for filtering "post_type.eq(TWITTER_DIRECT_MESSAGE, INSTAGRAM_MEDIA)"
tag_id
(optional)
If provided, only return messages with the specified tag_ids "tag_id.eq(123, 456, 789)"
language_code
(optional)
If provided, only return messages with the specified language_codes "language_code.eq(en, es, fr)"

Request Body - Messages Endpoint

Example request:

{
  "filters": [
    "group_id.eq(12345)",
    "customer_profile_id.eq(1234, 5678, 9012)",
    "created_time.in(2020-04-06T00:00:00..2020-04-19T23:59:59)",
    "action_last_update_time.in(2020-08-06T00:00:00..2021-02-28T23:59:59)",
    "post_type.eq(TWEET,FACEBOOK_POST,INSTAGRAM_DIRECT_MESSAGE)"
  ],
  "fields": [
    "network",
    "activity_metadata.first_like.time_elapsed",
    "created_time",
    "post_category",
    "post_type",
    "perma_link",
    "text",
    "from",
    "profile_guid",
    "internal.tags.id",
    "internal.sent_by.id",
    "internal.sent_by.email"
  ],
  "sort": ["created_time:desc"],
  "limit": 50,
  "timezone": "America/Chicago",
  "page_cursor": "123abc=="
}

Responses - Messages Endpoint

Responses follow the standard Sprout API response format:

data

This array contains the message's data requested in JSON format.

paging (optional)

This object, if present, indicates there are still more pages of data to be fetched, and provides a cursor pointing to the next page of data:

Key Description Example Value
next_cursor String of alphanumeric characters representing the next page of data, sorted by message created_time "abcd1234=="

Messages Request Limits & Pagination

  • Pagination of response is based on the following request params:

    • limit - number of messages returned per response (max: 100, default: 50)
    • sort - sort order of messages in response; sorted by message created_time (default: desc)
  • To paginate results: continuously fetch the "next" page of data, by updating the page_cursor parameter, until a response without a paging object is returned

  • Note: Unlike some other Sprout API Endpoints, index-based paging (e.g. page: 4) is not supported by the Messages Endpoint. While you can specify the sort direction, you can only ever get the "next" page of data — you can't fetch the "previous" page

  • A Request containing an invalid page_cursor will return a HTTP 400 Bad Request response with a message describing the error

Response Data - Messages Endpoint

Example response:

{
  "data": [
    {
      "post_category": "POST",
      "post_type": "INSTAGRAM_MEDIA",
      "profile_guid": "placeholder",
      "text": "placeholder",
      "perma_link": "link here",
      "network": "INSTAGRAM",
      "internal": {
        "tags": [
          {
            "id": 1234
          },
          {
            "id": 5678
          }
        ],
        "sent_by": {
          "id": 2066696,
          "email": "___@sproutsocial.com",
          "first_name": "placeholder",
          "last_name": "placeholder"
        }
      },
      "created_time": "2022-06-09T22:10:54Z"
    },
    ...
  ],
  "paging": {
    "next_cursor": "456def=="
  }
}  

Listening Endpoints

Listening endpoints are all HTTP POST endpoints. They provide access to your Listening Topic data, including:

  • Messages - Enables you to query for messages within a given Topic.
  • Metrics - Aggregates data across the Topic.

Overview

All requests to and responses from Listening API endpoints have a similar structure.

Requests - Listening Endpoints

The request body for a Listening API request is a JSON object with the following name/values pairs:

Key Description Example Value
filters Detailed filters used to filter the results by message created_time and network. To learn more about advanced filters for Topics see the Filters section. ["created_time.in(2018-01-01...2018-02-01)"]
metrics List of metrics to return in results; refer to the metrics ["impressions", "likes"]
fields List of fields to return in results; at least one field is required for Listening messages endpoint. Refer to the Listening Message Fields section for full list of valid fields ["content_category", "created_time", "from.name"]
page
(optional)
In paginated results, which 1-indexed page to return in the response.
Pagination is based on default limits of 50 results
3
limit
(optional)
Specifies the max number of results per page in the response. Defaults to 50 results for the Listening endpoints. 100
sort
(optional)
Sets the sort order for results, specified as a list of fields and directions (asc or desc) in the format <field>:<direction>. ["created_time:asc"]
timezone
(optional)
Time zone—from the ICANN time zone database. Timezone arguments only impact date/time-related filters, responses are not impacted and are always in UTC for posts. "America/Chicago"
dimensions
(optional)
(Topic Metrics endpoints only)
Breaks down metrics into discrete buckets. See Dimensions section to learn what fields work with dimensions.
["created_time.by(day)", "sentiment"]
Filters - Listening Endpoints

Filtering is a powerful query mechanism that allows you to isolate data within your Topics. You can combine most fields or metrics with the operators below to produce filter to specific data sets using the Topic Messages or Topic Metric endpoints.

Operator Description Example Value
gt Greater than likes.gt(10)
gte Greater than or equal to engagement_total.gte(5)
lt Less than replies.lt(5)
lte Less than or equal to impressions.lte(1000)
in Specifies a range. A helper that circumvents needed to use a filter with both gt and lt. Using .. is inclusive of the end value while ... is not. Dates and timestamps are accepted. Dates without timestamps are interpreted as midnight of that date, i.e. 2022-06-09 is treated as 2022-06-09T00:00:00. created_time.in(2023-05-01…2023-06-01T23:59:59)
eq Equals a particular value. Can contain multiple comma separated values. If multiple values are provided, the filter returns data containing at least one value. network.eq(TWITTER,INSTAGRAM)
neq The opposite of eq. network.neq(FACEBOOK)
exists Either true or false. Filter finds (or not) messages that meet the criteria of having a value (or not). visual_media.exists(true)
match Performs a text search query on a specified field. Multiple comma terms can be provided using spaces, wrap phrases or multiple words in quotes. Messages must match all provided terms. If you want a message that matches any single term, place an OR between terms (e.g. blue OR red). text.match(blue OR red)
text.match(“the blue car”)
text.match(blue red green)

You can apply multiple filters where data must meet all requirements by adding filters to the filters array. An example request using multiple filters:

{
  "filters": [
   "created_time.in(2022-11-28..2022-12-29T23:59:59)",
   "text.match(blue car)",
   "network.eq(INSTAGRAM,YOUTUBE,LINKEDIN,REDDIT,TUMBLR,WWW)"
 ]
}

Responses - Listening Endpoints

Responses follow the standard data API response format:

data

This array contains the Listening data requested. See specific endpoints for additional details.

paging

This object specifies the state of paging for this response:

Key Description Example Value
current_page 1-indexed page number of the response 3
total_pages Total number of pages for the request 20

A paging object is always returned, including when the response contains all data in one page. You can rely on checking for current_page = total_pages in order to know when you are at the end of the paging sequence.

Requesting a page greater than total_pages will return a HTTP 400 Bad Request response with a message describing the error.

Dimensions - Listening Endpoints

Dimensions are a powerful tool that allow you to slice and bucket Topic metrics. The most common uses for dimensions would be generating metrics over time (e.g. a trend chart) or breaking down metrics by metadata such as sentiment score. The following Topic fields can be used as a dimension.

  • created_time.by(day)
  • created_time.by(month)
  • visual_media.media_type
  • distribution_type
  • network
  • sentiment
  • language
  • explicit_label
  • location.city
  • location.province
  • location.country

Here is an example of multiple dimensions being used to create a trend chart of sentiment data over time:

{
  "filters": [
  "created_time.in(2022-11-28..2022-11-30)",
  "network.eq(INSTAGRAM,YOUTUBE,LINKEDIN,REDDIT,TUMBLR,WWW)"
  ],
  "metrics": [
    "replies",
    "shares_count",
    "likes"
  ],
  "dimensions": [
    "created_time.by(day)",
    "sentiment"
  ],
  "timezone": "America/Chicago"
}

Here is a sample output of this query:

{
    "data": [
        {
            "dimensions": {
                "created_time": "2022-11-30T00:00:00-06:00",
                "sentiment": "positive"
            },
            "metrics": {
                "replies": 29.0,
                "shares_count": 5.0,
                "likes": 557.0
            }
        },
        {
            "dimensions": {
                "created_time": "2022-11-30T00:00:00-06:00",
                "sentiment": "neutral"
            },
            "metrics": {
                "replies": 17.0,
                "shares_count": 5.0,
                "likes": 354.0
            }
        },
        {
            "dimensions": {
                "created_time": "2022-11-30T00:00:00-06:00",
                "sentiment": "negative"
            },
            "metrics": {
                "replies": 49.0,
                "shares_count": 20.0,
                "likes": 4725.0
            }
        }
    ],
    "paging": {}
}

Topic Messages Endpoint

POST /v1/<customer ID>/listening/topics/<topic id>/messages

The Topic messages endpoint enables you to query for messages within a given Topic. The returning data set is an array of matching messages and the requested metrics or fields for each. This endpoint is best used to extract raw messages for further processing or providing sample messages within dashboards.

Request Body - Topic Messages Endpoint

An example request:

{
  "filters": [
    "created_time.in(2022-11-28..2022-12-29T23:59:59)",
    "explicit_label.exists(false), explicit_label.eq(false)",
    "network.eq(INSTAGRAM,YOUTUBE,LINKEDIN,REDDIT,TUMBLR,WWW)"
  ],
  "fields": [
    "content_category",
    "created_time",
    "hashtags",
    "language",
    "location.city"
  ],
  "metrics": [
    "engagements",
    "from.followers_count",
    "likes",
    "replies",
    "shares_count",
    "authors_count",
    "positive_sentiments_count",
    "neutral_sentiments_count",
    "negative_sentiments_count"
  ],
  "sort": [
    "created_time:desc"
  ],
  "timezone": "America/Chicago",
  "limit": 50,
  "page": 1
}

Response Data - Topic Messages Endpoint

An example response:

{
    "data": [
        {
            "content_category": "PHOTO",
            "guid": "17920699361640551",
            "text": "Late post from Seattle trip \nColder than a blizzard in Alaska\n#seattle #seattlewashington #stevenspass #mtbakersnoqualmienationalforest #mtbaker #snoqualmiepass #snoqualmienationalforest #pikeplacemarket #pikeplace #seattlespaceneedle",
            "perma_link": "https://www.instagram.com/p/CmxucH6L7T1/",
            "network": "INSTAGRAM",
            "visual_media": [
                {
                    "media_url": "https://scontent-iad3-1.cdninstagram.com/v/t51.29350-15/323197452_926427338517295_6369335809654161527_n.jpg?_nc_cat=104&ccb=1-7&_nc_sid=8ae9d6&_nc_ohc=y4k7DO4QBHAAX8M7OZ1&_nc_ht=scontent-iad3-1.cdninstagram.com&edm=APCawUEEAAAA&oh=00_AfCps_5bFDmdZE-YVPDwVn5WF3XFWK4PWhd4-uRNTU2iCg&oe=643BF019",
                    "media_type": "PHOTO"
                },
                {
                    "media_url": "https://scontent-iad3-1.cdninstagram.com/v/t51.29350-15/322406676_8455452681195785_5328220517853332026_n.jpg?_nc_cat=101&ccb=1-7&_nc_sid=8ae9d6&_nc_ohc=VpBu3GAXQqoAX_K5LU3&_nc_ht=scontent-iad3-1.cdninstagram.com&edm=APCawUEEAAAA&oh=00_AfD4SCutTw_J7hPbzUJNpAEyaoXd6kBmzHJM-MINZapJmg&oe=643CCB3C",
                    "media_type": "PHOTO"
                },
                {
                    "media_url": "https://scontent-iad3-1.cdninstagram.com/v/t51.29350-15/322520040_494039015961334_6394396172311331958_n.jpg?_nc_cat=101&ccb=1-7&_nc_sid=8ae9d6&_nc_ohc=t6xksNZv91kAX9rE5mL&_nc_ht=scontent-iad3-1.cdninstagram.com&edm=APCawUEEAAAA&oh=00_AfBgn_HEqLsn269mk4oAFXQmbSrbRbxzpbrfwXZLg2F2YQ&oe=643BA80B",
                    "media_type": "PHOTO"
                },
                {
                    "media_url": "https://scontent-iad3-2.cdninstagram.com/v/t51.29350-15/322386857_955848772063194_984682163981872244_n.jpg?_nc_cat=105&ccb=1-7&_nc_sid=8ae9d6&_nc_ohc=zIh0QFX3T50AX95k8wg&_nc_ht=scontent-iad3-2.cdninstagram.com&edm=APCawUEEAAAA&oh=00_AfB7_8ChB-7nq4MXdOaIatp0sCw4ZXqEOoikh-cCoEUIGA&oe=643BE125",
                    "media_type": "PHOTO"
                },
                {
                    "media_url": "https://scontent-iad3-1.cdninstagram.com/v/t51.29350-15/322393885_1262531494303623_5396853589364944362_n.jpg?_nc_cat=102&ccb=1-7&_nc_sid=8ae9d6&_nc_ohc=uzwo3FqbohgAX_wtdqq&_nc_ht=scontent-iad3-1.cdninstagram.com&edm=APCawUEEAAAA&oh=00_AfAZmRdk8Va92UX3FmnjMJo_wf2rxwP5E_5ExT4-TWSSpA&oe=643BD1F1",
                    "media_type": "PHOTO"
                },
                {
                    "media_url": "https://scontent-iad3-1.cdninstagram.com/v/t51.29350-15/322830314_217584514039146_7428674933900498885_n.jpg?_nc_cat=110&ccb=1-7&_nc_sid=8ae9d6&_nc_ohc=m2PtitrP1A0AX8f6gso&_nc_ht=scontent-iad3-1.cdninstagram.com&edm=APCawUEEAAAA&oh=00_AfD6KYXBQVk_BNNQ0FUM8NihyH08v7QF_t61BY3mFdu7sA&oe=643B60F6",
                    "media_type": "PHOTO"
                },
                {
                    "media_url": "https://scontent-iad3-2.cdninstagram.com/v/t51.29350-15/322294142_738549953871939_8482926741552785486_n.jpg?_nc_cat=111&ccb=1-7&_nc_sid=8ae9d6&_nc_ohc=k8lcfSt9dhMAX_FZEyt&_nc_ht=scontent-iad3-2.cdninstagram.com&edm=APCawUEEAAAA&oh=00_AfAQYi1Lx_i-c-SRkWt6tfuhptuuvFx2PlBN1b6fb7kFGA&oe=643CA58A",
                    "media_type": "PHOTO"
                },
                {
                    "media_url": "https://scontent-iad3-1.cdninstagram.com/v/t51.29350-15/322601354_1215109445751814_6654433182308805760_n.jpg?_nc_cat=107&ccb=1-7&_nc_sid=8ae9d6&_nc_ohc=XsbPztVyu-4AX8vsyjC&_nc_ht=scontent-iad3-1.cdninstagram.com&edm=APCawUEEAAAA&oh=00_AfBdQ9GECTdbNtQ-06ruuXQVsN5qPrwKnGsghbaj8uPjig&oe=643B6CDE",
                    "media_type": "PHOTO"
                }
            ],
            "hashtags": [
                "seattlespaceneedle",
                "snoqualmienationalforest",
                "seattle",
                "stevenspass",
                "pikeplace",
                "seattlewashington",
                "mtbakersnoqualmienationalforest",
                "mtbaker",
                "pikeplacemarket",
                "snoqualmiepass"
            ],
            "created_time": "2022-12-30T03:27:02Z",
            "listening_metadata": {
                "sentiment": "neutral",
                "explicit_label": false,
                "language": "en"
            }
        }
    ],
    "paging": {
        "current_page": 1
    }
}

Listening Messages Request Limits and Pagination

  • Pagination of response is based on the following request params:
    • limit - number of messages returned per response (max: 100, default: 50)
    • sort - sort order of messages in response; sorted by message created_time (default: desc)

Topic Metrics Endpoint

POST /v1/<customer ID>/listening/topics/<topic id>/metrics

The Topic metrics endpoint aggregates data across the Topic. Use this endpoint when you need answers related to key metrics such as total Topic volume, engagement, etc. or trends over time. This endpoint is best for quick insights or building complex dashboards.

Request Body - Topic Metrics Endpoint

An example request:

{
  "filters": [
    "created_time.in(2022-11-28..2022-12-29T23:59:59)",    
    "network.eq(INSTAGRAM,YOUTUBE,LINKEDIN,REDDIT,TUMBLR,WWW)",
    "sentiment.eq(positive,negative,neutral,unclassified)"
  ],
  "metrics": [
    "replies",
    "shares_count",
    "likes"
  ],
  "dimensions": [
    "sentiment"
  ],
  "timezone": "America/Chicago"
}

Response Data - Topic Metrics Endpoint

An example response:

{
 "data": [
   {
     "dimensions": {
       "sentiment": "POSITIVE"
     },
     "metrics": {
       "replies": 178563.0,
       "shares_count": 55535.0,
       "likes": 7221913.0
     }
   },
   {
     "dimensions": {
       "sentiment": "NEGATIVE"
     },
     "metrics": {
       "replies": 38758.0,
       "shares_count": 43396.0,
       "likes": 468540.0
     }
   },
   {
     "dimensions": {
       "sentiment": "NEUTRAL"
     },
     "metrics": {
       "replies": 14252.0,
       "shares_count": 25529.0,
       "likes": 807694.0
     }
   },
   {
     "dimensions": {
       "sentiment": "UNCLASSIFIED"
     },
     "metrics": {
       "replies": 31900.0,
       "shares_count": 17977.0,
       "likes": 1074959.0
     }
   }
 ]
}

Listening Metrics Request Limits and Pagination

  • Pagination of response is based on the following request params:
    • limit - number of messages returned per response (max: 100, default: 50)
    • sort - sort order of messages in response; sorted by message created_time (default: desc)

Publishing Post Endpoints

Overview

Create and manage Publishing posts within Sprout that are intended to be published to social networks at a future time.

  • Create Publishing Post - Create a Publishing Post (currently only supports posts in Draft status)
  • Retrieve Publishing Post - Retrieve a Publishing Post by its publishing_post_id

Limitations

  • Only posts created in draft status are supported at this time.
  • Instagram Mobile Publisher and story posts cannot be created directly; those will be created as media posts and can be updated within the Sprout UI.
  • Supports the following profile types: Instagram Business and Creator, Facebook Pages, Threads, X, LinkedIn Pages and Personal, YouTube, TikTok, Pinterest, and Google My Business

Requests - Publishing Post Endpoints

The request body for a Publishing Post API request is a JSON object with the following fields:

Key Description Example Value
group_id ID of the group in which to create the post 55667788
customer_profile_ids ID of the profile(s) for which to publish the post.
Multiple profiles on a post must exist within the same group.
[2345, 5678]
is_draft Indicates whether the post should be created in draft status.
Currently all posts require "is_draft": true as only draft post creation is supported.
true
text
(optional - per network)
Text of the post. "Post text"
media
(optional - per network)
Array of media object(s) for post media [{"media_id": "1234-abcd-7890", "media_type": "PHOTO"}]
media.media_id Media ID obtained from Media Upload endpoint "1234-abcd-7890"
media.media_type Supported values are PHOTO and VIDEO "PHOTO"
delivery
(optional)
Container for post delivery details. Only required for draft scheduled posts. {"scheduled_times": ["2024-06-30T18:20:00Z"], "type": "SCHEDULED"}
delivery.scheduled_times Array of iso8601 timestamps in UTC, representing the delivery date and time of the post.
Scheduled times must be in the future and any seconds will be rounded down to the nearest minute.
["2024-10-14T15:00:00Z", "2023-10-16T18:00:00Z"]
delivery.type Only SCHEDULED is supported at this time "SCHEDULED"
tag_ids
(optional)
Array of tag IDs to apply to the post [123, 456]

Create Publishing Post Endpoint

POST /v1/<customer ID>/publishing/posts

Create a Publishing Post in Sprout that is intended to be published at a future time. Creating a Post via the API will create one or more posts on the Sprout Publishing Calendar.

Draft Post Fan-out

For draft posts, the current behavior in Sprout and via the API will be to create one post on the calendar per profile on the post (this is referred to as “fan-out”). The unique publishing_post_id in the response will represent a single post on the Sprout Publishing Calendar.

The API response will not represent the single post on the Sprout Publishing Calendar but instead represent the posts as they would appear on social networks as they would be published in the future. For example, a post created with two profiles (one Facebook, one Instagram) will be represented by two objects in the response: one representing the future Instagram post and the other representing the future Facebook Post.

Another dimension is possible if the post is scheduled for multiple send times.
For example, if a post has two profiles (one Facebook, one Instagram) and two scheduled send times, the response will contain four objects: two Instagram posts and two Facebook posts, each containing the deliveries object with one of the scheduled delivery times.

Request Body - Create Publishing Post Endpoint

An example request:

{
	"group_id": 55667788,
	"customer_profile_ids": [
	    2345,
		5678
	],
	"is_draft": true,
	"text": "A draft post",
	"delivery": {
		"scheduled_times": [
			"2024-06-30T18:20:00Z"
		],
		"type": "SCHEDULED"
	},
	"media": [
        {
          "media_id": "1234-abcd-7890",
          "media_type": "PHOTO"
        }
    ]
}

Response Data - Publishing Post Endpoints

An example response:

{
  "data": [
    {
      "post_category": "POST",
      "post_type": "FACEBOOK_POST",
      "customer_profile_id": "2345",
      "profile_guid": "fbpr:1112345",
      "internal": {
        "publishing": {
          "publishing_post_id": 4567890,
          "group_id": 55667788,
          "is_draft": true,
          "text": "A draft post",
          "perma_link": "https://app.sproutsocial.com/publishing/activity/1234/4567890",
          "deliveries": [
            {
              "type": "SCHEDULED",
              "delivery_status": "PENDING",
              "scheduled_time": "2024-06-30T18:20:00Z"
            }
          ],
          "media": [
            {
              "id": "6789-defg-5678",
              "media_type": "PHOTO"
            }
          ],
          "created_by": {
            "id": 1155555,
            "email": "sprout.user@sproutsocial.com",
            "first_name": "Sprout",
            "last_name": "User"
          },
          "updated_by": {
            "id": 1155555,
            "email": "sprout.user@sproutsocial.com",
            "first_name": "Sprout",
            "last_name": "User"
          },
          "created_time": "2024-06-24T19:44:32Z",
          "updated_time": "2024-06-24T19:44:32Z"
        }
      }
    },
    {
      "post_category": "POST",
      "post_type": "INSTAGRAM_MEDIA",
      "customer_profile_id": "5678",
      "profile_guid": "ibpr:5556789",
      "internal": {
        "publishing": {
          "publishing_post_id": 4567891,
          "group_id": 55667788,
          "is_draft": true,
          "text": "A draft post",
          "perma_link": "https://app.sproutsocial.com/publishing/activity/1234/4567891",
          "deliveries": [
            {
              "type": "SCHEDULED",
              "delivery_status": "PENDING",
              "scheduled_time": "2024-06-30T18:20:00Z"
            }
          ],
          "media": [
            {
              "id": "6789-defg-5678",
              "media_type": "PHOTO"
            }
          ],
          "created_by": {
            "id": 1155555,
            "email": "sprout.user@sproutsocial.com",
            "first_name": "Sprout",
            "last_name": "User"
          },
          "updated_by": {
            "id": 1155555,
            "email": "sprout.user@sproutsocial.com",
            "first_name": "Sprout",
            "last_name": "User"
          },
          "created_time": "2024-06-24T19:44:32Z",
          "updated_time": "2024-06-24T19:44:32Z"
        }
      }
    }
  ]
}

Retrieve Publishing Post Endpoint

GET /v1/<customer ID>/publishing/posts/<publishing_post_id>

Retrieve a Publishing Post by its publishing_post_id. If multiple profiles or send times are present on the post, the response will contain the "fanned-out" posts as they would appear on social networks in the future.

Response Data - Retrieve Publishing Post Endpoint

An example response:

{
  "data": [
    {
      "post_category": "POST",
      "post_type": "FACEBOOK_POST",
      "customer_profile_id": "2345",
      "profile_guid": "fbpr:1112345",
      "internal": {
        "publishing": {
          "publishing_post_id": 4567890,
          "group_id": 55667788,
          "is_draft": true,
          "text": "A draft post",
          "perma_link": "https://app.sproutsocial.com/publishing/activity/1234/4567890",
          "deliveries": [
            {
              "type": "SCHEDULED",
              "delivery_status": "PENDING",
              "scheduled_time": "2024-06-30T18:20:00Z"
            }
          ],
          "media": [
            {
              "id": "6789-defg-5678",
              "media_type": "PHOTO"
            }
          ],
          "created_by": {
            "id": 1155555,
            "email": "sprout.user@sproutsocial.com",
            "first_name": "Sprout",
            "last_name": "User"
          },
          "updated_by": {
            "id": 1155555,
            "email": "sprout.user@sproutsocial.com",
            "first_name": "Sprout",
            "last_name": "User"
          },
          "created_time": "2024-06-24T19:44:32Z",
          "updated_time": "2024-06-24T19:44:32Z"
        }
      }
    }
  ]
}

Simple Media Upload

POST /v1/<customer ID>/media/

The media upload system works with other parts of the public API that require media existing in the Sprout Social systems. This media upload system supports three different means to send content to sprout:

  1. Simple Media Upload
    • Media files are limited to 50MiB in size
  2. Multipart Media Upload
    • This scheme relies on uploading a media file 5MiB at a time
  3. Download from a Link
    • This scheme relies on a publicly available internet reachable file on http/https hosted URLs
    • This scheme is built into the single upload or multipart upload paths, and can be treated as either depending on
    what makes sense for the media file in question. See the individual API endpoint definitions below for the caveats of using one over the other.

Limitations

  • Media sent to Sprout via this API are normally retained for 24 hours before is it removed unless used by other API operations

  • Currently, the only applicable use of uploaded media is to be used alongside post submissions.

  • Uploaded media must be identified as one of the specified supported media types:

    Content Type Common Extension
    image/png png
    image/gif gif
    image/webp webp
    image/jpeg jpg
    image/heic heic
    image/avif avif
    video/x-msvideo avi
    video/quicktime mov
    video/mp4 mp4
    video/mpeg mpg
    image/heic-sequence heifs
    video/hevc hevc
    video/avc avc
    video/av1 av1
    image/x-heif-jpeg jpeg
    image/heif heif
    video/webm webm
    video/x-matroska mkv
    application/x-matroska mkv
    application/x-subrip srt
    • ** Note: Although this API supports these content types, the target social networks have their own rules on media files which need to be honored. Sprout will not transcode these files into network compatible versions when used with posts. There are some built-in validation rules we enforce when a media file is used with pending posts, but these limitations may not catch every case where a social network rejects a given media file. See this help center page for details on known social network media limitations.

This endpoint supports uploading a media file in a single request or to request a link download for a media file existing on the internet.

The request format of this endpoint is multipart/form-data. The request must contain one of two request part names to be provided in each request:

  1. media - (Single File Upload) The media file contents in bytes
    • The part may contain an optional content disposition which specifies the original content type and file name of the media. Sending this information may help to identify the source content, but it is not mandatory
  2. media_url - (Link Download via Single File Upload) A UTF-8 text part containing the HTTP/HTTPS URL of a media file on the internet
Response

A response code of 200 indicates that the part was submitted successfully. Any other status should be accompanied by a descriptive error for why it failed. Generally, requests in the 4xx code range are fatal errors that require a new media request, whereas 5xx failures are temporary and can be retried with an exponential back-off retry policy.

On a successful transfer, the resulting payload will be a JSON document containing a media_id text field which can then be used by other API calls when associating said media with post creation activities. The response also contains an expiration_time which shows how long the media will be available for use in a pending post. Any requests associating with this expiration time will fail.

Limitations
  1. Media sent directly larger than 50 MiB will be rejected
  2. Media content that is not identified as a know media type will be rejected
  3. For link download requests, the network request will remain open and not respond until the link download request has been authorized and fully downloaded.
    • This transaction trades the convenience of a single request/response with the limitation that the link download needs to complete before a network timeout in order to succeed. If you see consistent sets of timeouts when submitting link download requests on this endpoint, it's advisable to switch to the multipart upload API for link downloads.
Example Request (Simple File Upload)
  curl -s -X POST \
    --form "media=@$MEDIA_DIR/$MEDIA_FILE;type=image/gif" \
    https://api.sproutsocial.com/v1/$CUSTOMER/media/ \
    -H "authorization: Bearer $TOKEN" \
    -H "Content-Type: multipart/form-data"

Response:

{
  "data": [
    {
      "media_id": "565fc90f-dd98-4c84-ab17-6f051fb536ce",
      "expiration_time": "2023-10-12T11:20:16Z"
    }
  ]
}
  curl -s -X POST \
    --form "media_url=https://my.public.media.com/my_file.jpg" \
    https://api.sproutsocial.com/v1/$CUSTOMER/media/ \
    -H "authorization: Bearer $TOKEN" \
    -H "Content-Type: multipart/form-data"

Response:

{
  "data": [
    {
      "media_id": "565fc90f-dd98-4c84-ab17-6f051fb536ce",
      "expiration_time": "2023-10-12T11:20:16Z"
    }
  ]
}

Multipart Media Upload

Multipart uploads become necessary when managing files larger than 50 MiB, or when media content is expected to take longer to download via link downloading. This benefit is traded with needing to perform multiple requests to the API in order to achieve similar objectives.

Processing Steps

  1. Initiate a new request for a Multipart upload using the Start multipart media upload steps below.
    • A successful response here will return a JSON submission_id which will be needed in each subsequent step
    • The multipart media request must be completed and used within 24 hours of this initial request
  2. Upload all other parts of the media file using the Continue multipart media upload steps below.
    • Each file part must be a sequential whole number. The initial upload is considered part 1, so each subsequent part must be 2, 3, 4, etc. until the file is entirely uploaded.
    • This can be done sequentially, or in parallel
  3. Once all parts have been uploaded, finish the upload processing by using the Complete multipart media upload steps below.

Limitations

  1. All media parts uploaded must be exactly 5MiB (5,242,880 bytes) except for the last upload part, which can be any size > 0 bytes
    • For files < 5 MiB send via this API, the "Start multipart media upload" step can receive a file under 5 MiB as long as no subsequent parts are sent.
  2. Media content that is not identified as a know media type will be rejected. This content ID will only occur on the first 5 MiB part of the media, so a failed identification within that file chunk will cause the request to fail

Start multipart media upload

POST /v1/<customer ID>/media/submission

This endpoint supports uploading a media file in a single request or to request a link download for a media file existing on the internet.

The request format of this endpoint is multipart/form-data. The request must contain one of two request part names to be provided in each request:

  1. media - The media file part contents in bytes
    • The part may contain an optional content disposition which specifies the original content type and file name of the media. Sending this information may help to identify the source content, but it is not mandatory
  2. media_url - (Link Download) A UTF-8 text part containing the HTTP/HTTPS URL of a media file on the internet.
    • When if successful, skip to Complete multipart media upload to await the completion of the link download requested.
Response

A response code of 200 indicates that the part was submitted successfully. Any other status should be accompanied by a descriptive error for why it failed. Generally, requests in the 4xx code range are fatal errors that require a new media request, whereas 5xx failures are temporary and can be retried with an exponential back-off retry policy.

On a successful request, the resulting payload will be a JSON document containing a submission_id text field. This field is needed for the follow-up Continue multipart media upload and Complete multipart media upload steps.

Example Request
  curl -s -X POST \
    --form "media=@$MEDIA_DIR/$MEDIA_FILE_PART_1;type=image/gif" \
    https://api.sproutsocial.com/v1/$CUSTOMER/media/submission \
    -H "authorization: Bearer $TOKEN" \
    -H "Content-Type: multipart/form-data"

Response:

{
  "data": [
    {
      "submission_id": "565fc90f-dd98-4c84-ab17-6f051fb536ce"
    }
  ]
}
  curl -s -X POST \
    --form "media_url=https://my.public.media.com/my_file.jpg" \
    https://api.sproutsocial.com/v1/$CUSTOMER/media/submission \
    -H "authorization: Bearer $TOKEN" \
    -H "Content-Type: multipart/form-data"

Response:

{
  "data": [
    {
      "submission_id": "565fc90f-dd98-4c84-ab17-6f051fb536ce"
    }
  ]
}

Continue multipart media upload

POST /v1/<customer ID>/media/submission/<submission_id>/part/<part_number>

If the media file part uploaded in Start multipart media upload was 5 MiB, and there are still more bytes to upload, the continue multipart media endpoint needs to be called continually with each part of the media file until its entirely uploaded. It uses the same multipart/form-data structure as the initial submission URL, but this one is slightly different.

  1. The URL contains a part number. It must represent a whole number starting at 2. This continues ascending (3,4,5,etc...) until you've upload all the data bytes of the source media.
  2. The form's media disposition is not needed and will be ignored. The content type of this data is implicitly application/octet-stream

There are no requirements about executing these upload parts in parallel if desired. If any part submission fails, they can be uploaded again as long as the 24-hour expiration hasn't lapsed on the original upload request and as long as the final completion step hasn't been executed.

Response

A response code of 200 indicates that the part was submitted successfully. Any other status should be accompanied by a descriptive error for why it failed. Generally, requests in the 4xx code range are fatal errors that require a new media request, whereas 5xx failures are temporary and can be retried with an exponential back-off retry policy.

This API endpoint has no payload response when it succeeds.

Example Request(s)
  curl -s -X POST \
    --form "media=@$MEDIA_DIR/$MEDIA_FILE_PART_2" \
    https://api.sproutsocial.com/v1/$CUSTOMER/media/submission/$SUBMISSIONID/part/2 \
    -H "authorization: Bearer $TOKEN" \
    -H "Content-Type: multipart/form-data"
  curl -s -X POST \
    --form "media=@$MEDIA_DIR/$MEDIA_FILE_PART_3" \
    https://api.sproutsocial.com/v1/$CUSTOMER/media/submission/$SUBMISSIONID/part/3 \
    -H "authorization: Bearer $TOKEN" \
    -H "Content-Type: multipart/form-data"

Response:

A response code of 200 indicates that the part was submitted successfully. Any other status should be accompanied by a descriptive error for why it failed.

(no body response)

Complete multipart media upload

GET /v1/<customer ID>/media/submission/<submission_id>
Response

A response code of 200 or 202 indicates that the request was good. Any other status should be accompanied by a descriptive error for why it failed. Generally, requests in the 4xx code range are fatal errors that require a new media request, whereas 5xx failures are temporary and can be retried with an exponential back-off retry policy.

Example Request (Not ready)
  curl -s -X GET \
    https://api.sproutsocial.com/v1/$CUSTOMER/media/submission/$SUBMISSIONID \
    -H "authorization: Bearer $TOKEN"

Response:

HTTP Status 202 indicates that the request is good, but the media is not ready to be served yet. This process can take seconds to minutes depending on the size of the content and if it was a link download or direct upload. If you receive this response, please defer retrying the request until the wait_until time has lapsed. If a high number of calls occur in a short duration, the requests could be rate limited and further complicate the processing of this request.

{
   "data": [
     {
       "submission_id": "febca520-f44e-4b7c-b451-04a911c53f0f",
       "wait_until": "2024-04-22T17:03:21.600802351Z"
     }
   ]
}
Example Request (ready)

HTTP Status 200 indicates that the request succeeded and that the media_id returned in the response body is now good to use in other subsequent API requests.

Response:

{
  "data": [
    {
      "media_id": "565fc90f-dd98-4c84-ab17-6f051fb536ce",
      "expiration_time": "2023-10-12T11:20:16Z"
    }
  ]
}

Metrics and Fields

Message Metadata

Message Fields

Key Type Network Availability Notes
content_category STRING X Facebook Instagram LinkedIn YouTube Pinterest TikTok Google My Business Whatsapp Threads Unified categorization of the content. The hierarchy is album, video, photo, link, poll or text.
created_time DATE X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads An iso8601 timestamp representing the publication date and time of the message.
from MAP X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads A shorthand for requesting all of the following "from" nested fields. Represents the social network profile that published the message.
from.guid STRING X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads The native ID of the authors' profile prefixed with a Sprout code that represents where the data was collected.
from.name STRING X Facebook Instagram LinkedIn YouTube Pinterest Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads The display name of the author.
from.profile_picture STRING X Facebook Instagram LinkedIn YouTube Pinterest Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads URL to the profile picture.
from.screen_name STRING X Instagram Pinterest TikTok Whatsapp Trustpilot Threads Also commonly called "handle," this field is mutable on most networks, but not changed as often as the display name.
guid STRING X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads The native ID of the message prefixed with a Sprout code that represents where this type of message is.
customer_profile_id NUMBER X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads ID of the profile associated with this message. Corresponds to the customer_profile_id in the requested filters.
internal MAP X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads A shorthand for requesting internal.tags.id and internal.sent_by.id.
internal.tags.id ARRAY<NUMBER> X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads Array of tag IDs this message is associated with. Includes active and archived tags.
internal.sent_by.id NUMBER X Facebook Instagram LinkedIn YouTube TikTok Glassdoor GoogleMyBusiness Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads ID of the team member that sent this message via Sprout.
internal.sent_by.email STRING X Facebook Instagram LinkedIn YouTube TikTok Glassdoor GoogleMyBusiness Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads Email address of the team member that sent this message.
internal.sent_by.first_name STRING X Facebook Instagram LinkedIn YouTube TikTok Glassdoor GoogleMyBusiness Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads First name of the team member that sent this message.
internal.sent_by.last_name STRING X Facebook Instagram LinkedIn YouTube TikTok Glassdoor GoogleMyBusiness Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads Last name of the team member that sent this message.
sent BOOLEAN X Facebook Instagram LinkedIn YouTube TikTok Glassdoor GoogleMyBusiness Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads (Posts endpoint only)
If the message is sent by the requested profiles, true. Otherwise, the message is considered received by the requested profile(s) and returned false.
post_type STRING X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads Uniquely identifies the social network and type of message this is. Refer to the Post Types table for full list of valid post_types
post_category STRING X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads A unified version of post_type, these names are not network specific.
network STRING X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads The social network that the data came from (e.g. INSTAGRAM).
perma_link STRING X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads URL to the message on the social network.
inbox_permalink STRING X Facebook Instagram LinkedIn YouTube Pinterest TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads URL to the message thread in the Sprout Social Smart Inbox.
profile_guid STRING X Facebook Instagram LinkedIn YouTube TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads The ID of the profile being tracked prefixed with an Sprout code that represents where the data was collected. When the message was made by the profile being tracked, this field will be identical to from.guid.
text STRING X Facebook Instagram LinkedIn YouTube TikTok Glassdoor GoogleMyBusiness Tripadvisor Whatsapp Yelp AppleAppStore GooglePlayStore Trustpilot Threads The text in the body of the message.
title STRING X Facebook LinkedIn YouTube Glassdoor Tripadvisor Whatsapp Text that is separate from the usual body of the message, usually shown as a title for the message in the social network.
clickthrough_link MAP X Facebook Instagram LinkedIn YouTube Pinterest TikTok Google My Business Whatsapp Threads Metadata about a link to another entity that appears on the message, e.g. when a Pinterest message contains a link to a different website.
clickthrough_link.name STRING X Facebook Instagram LinkedIn YouTube Pinterest TikTok Google My Business