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.

You access DataSift's APIs in two ways:

  • Use HTTP headers
  • Place all the parameters in a GET/POST request

HTTP Headers

This is the recommended appropach for production environments.

You need to include a header that contains:
Authorization: datasift-user:your-datasift-api-key

GET /8bc638ddff76a9c01bd6a454de03bd30 HTTP/1.1
Host: stream.datasift.com
Authorization: <username>:<api_key>
Connection: Keep-Alive

GET/POST Requests

Accessing a DataSift API endpoint using GET/POST parameters is the simpler approach. It is sometimes useful for testing. Here's an example that calls the REST API to compile a CSDL filter:

https://api.datasift.com/v1/compile?csdl=<csdl>&username=<username>&api_key=<api_key>

Note that when you hit the Streaming API using the Websocket protocol, you must authenticate in the URI using GET parameters - there is no other option. In this case, the URI format is:

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