ibm-watson-cognitive Getting started with ibm-watson-cognitive

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9


This topic provides basic instructions for obtaining credentials for Watson services and provides relevant links for each service and the Watson Developer Cloud SDKs.

Watson services homepages:


VersionRelease Date

Calling Watson APIs with curl

Depending on the service, you will either need to use Basic Authentication with a username and password or pass an apikey as a parameter in each request.

Some services also support token authentication.

GET using Tone Analyzer:

curl -X GET \
-u "username":"password" \
-d "version=2016-05-19" \
-d "text=Hey! Welcome to Watson Tone Analyzer!" \

POST using AlchemyLanguage:

curl -X POST \
-d "apikey=YOUR_API_KEY" \
-d "" \

Getting API credentials

To authenticate to Watson services, you need credentials for each service that you plan to use. Depending on the service, you will need to pass a username and password with Basic Authentication, or you will need to pass an API key in a parameter for each request you make.

How to get credentials for a Watson service:

  1. Sign up for Bluemix and log in.
  2. Go to the service page for your desired Watson service:
  3. Select your desired plan, and click CREATE:

Bluemix service catalog page

  1. Click the "Service Credentials" button from your service dashboard page to view your credentials. If you aren't taken to the service dashboard automatically, go to your Bluemix dashboard and click on your desired service instance.

Location of credentials on your Bluemix service dashboard

Using Watson Developer Cloud SDKs

The quickest way to get started with Watson services is to use the Watson Developer Cloud SDKs. The following GitHub repositories contain installation instructions and basic usage examples:

For example, here's how to make an AlchemyLanguage API call with the Node.js SDK:

Install the SDK:

$ npm install watson-developer-cloud

Save the following code to a file (we'll call it app.js). Make sure you replace API_KEY with your API key.

// Instantiate the service 
var AlchemyLanguageV1= require('watson-developer-cloud/alchemy-language/v1');
var alchemy_language = AlchemyLanguageV1({
  api_key: 'API_KEY'

var parameters = {
  extract: [
  url: ''

alchemy_language.combined(parameters, function (err, response) {
  if (err)
    console.log('error:', err);
    console.log(JSON.stringify(response, null, 2));

Run the app:

$ node app.js 

Got any ibm-watson-cognitive Question?