Cognitive Services Java SDK Samples

These samples will get you started using the Java SDKs for various Cognitive Services. They'll cover a few common use cases that are end-to-end solutions, including best practices for interacting with the data from these APIs.

For quickstart versions of many of these samples (and for more examples not covered here), view the cognitive-services-quickstart-code repo for Java. This repo demonstrates short "snippets" of code that back up many of the quickstarts in the Cognitive Services documentation pages.

For a general overview about Cognitive Services, view What are Azure Cognitive Services?.



This project framework provides examples for the following services:



Getting Started


  1. A cognitive services API key and/or endpoint with which to authenticate the SDK's calls. If you don't have an Azure account, you can visit the Microsoft Cognitive Services Web site, create a new Azure account, and try Cognitive Services for free. Or follow the Create a Cognitive Services resource using the Azure portal guide. You can create a Cognitive Services account on the Azure portal through the Use with an Azure subscription button.
  2. JDK 7 or 8

Subscription keys are usually per service. For example, the subscription key for Spell Check will not be the same as it is for Custom Search.


Copy this repository to your local machine by typing

git clone

in your command line/bash. Or download and open the zip file of this repo.


In each sample you will need your subscription key and/or endpoint from your Azure Portal resource for the service. In the beginning of each sample, add your subscription key/endpoint where applicable.