API Authentication

tip icon


This page explains how our API handles authentication. Note that all of our client libraries handle authentication for you, so we recommend you use these for your solution when possible.

The DataSift platform provides two types of API:

  • REST API
  • Streaming API

How you provide your authentication details differs between each.

REST API Authentication

To access REST API endpoints (regardless of HTTP method), you need to provide an Authorization header.

Authorization: DATASIFT_USERNAME:DATASIFT_API_KEY

For example to call the /account/usage endpoint:

curl -X GET https://api.datasift.com/v1.5/account/usage?period=hourly \
  -H 'Authorization: username:api_key'

API Keys and Account Identities

If you are making API calls to a PYLON API endpoint, you will need to use an Account Identity API Key. You can ready more about this in the appropriate guide for each PYLON product:

When using the Media Strategies API you use the same identity you would use for calling the related PYLON product. For instance when analyzing LinkedIn data you would use an identity that has access to the PYLON for LinkedIn Engagement Insights product.

All other API calls should be make with your core API key, found at app.datasift.com/settings.

You will receive an HTTP 403 error message, and a relevant error message should you try to use the wrong type of API key in an API call.

Streaming API Authentication

When accessing the streaming API (using the Websocket protocol), rather than using an Authorization header you instead pass your authentication details in the query string instead.

Threfore the URI format is:

wss://stream.datasift.com/<hash>?username=<username>&api_key=<api_key>