Skill Level: Any Skill Level

Let's say you want to analyze stocks or some news from different data sources and interpret the message, Alchemy News API lets you make a query based on some input parameters and returns the data. One of the data that would help is the "sentiment".


An account in Bluemix.

Create the Alchemy service.

Jot down the API key credentials. this will be used when feeding the URL to query data from the Alchemy APIs.


  1. Create Bluemix account and Alchemy API.


    Login to Bluemix at ( Create a new one if you do not have it )



    Set up for the Alchemy service. Once created – note down the credentials and the API_KEY for further use.




  2. Interpret the news.

    Let's say the user wants to know if he wants to invest in bullion, or metals ( in this case we pick Copper ). I would want to know if it is a good thing to buy, sell or hold.

    Here I will give various examples on how to get this data and read the sentiments and other data.


    A simple API call would be to get all information about a particular industry sector i.e metals. ( e.g: Copper ) and return the data.

    Create an URL including the API_KEY and mention the query ( referenced by the letter q below ) and mention how the return has to be, in this case return a JSON of title and url and post it in the browser.,enriched.url.title

    Note : The return = url and title and watch the output, “return = enriched.url.url¬† and enriched.url.title”

    The query in the URL is “q.enriched.url.url”





  3. Watch for daily query limits - or else you can encounter an error as shown.

    Sometimes you might run out of number of queries for a day. There is a certain limit per day for 'unlicensed' users – then we can expect to see such an error. To resolve one has to purchase a licensed version of the API.


    A snapshot of transactions exceeded message :



  4. Query for news having "Trump" as the keyword in the title and in the Government and Politics section.

    Here, I want to query for News that has the “trump” in it's title, Start and End Date, and look in the “Govt and Politics” section.




    The same API in text here:,enriched.url.url,enriched.url.enrichedTitle.docSentiment&start=1480897800&end=1484245800&q.enriched.url.enrichedTitle.entities.entity=|text=trump,type=person|&q.enriched.url.enrichedTitle.docSentiment.type=positive&q.enriched.url.enrichedTitle.taxonomy.taxonomy_.label=law,%20govt%20and%20politics&count=25&outputMode=json


    The resulting JSON output would be something like :

    Note the “return” in the API where we specify the different types of information we need to see.

    We can also see the “document sentiment” along with a score to help us make some business decisions.

    The inputs are mentioned by the “q -query “parameter in the API.

    e.g: enriched.url.enrichedTitle.entities


    More such keys can be found at this URL :


  5. References


  6. Various Input and Output possibilities

    User can provide different inputs to the API like

    – Start and End date.

    – Subject we are interested in ( like name of a person, city etc )

    – Sentiment – where we can specify to query for 'positive' or negative sentiments ( or both )

    – Location of the key word we are searching for like is it in the Text /body or Title

    – Taxonomy ( or different categories ) that we would like to query the data from . e.g: search for 'Trump' in the Govt and Politics section.


    Please refer to for more information on various parameters that can be fed to the API.

Join The Discussion