Quickstart: Analyze a remote image using the REST API and cURL in Computer Vision

In this quickstart, you analyze a remotely stored image to extract visual features by using Computer Vision's REST API. With the Analyze Image method, you can extract visual features based on image content.

If you don't have an Azure subscription, create a free account before you begin.


Create and run the sample command

To create and run the sample, do the following steps:

  1. Copy the following command into a text editor.
  2. Make the following changes in the command where needed:
    1. Replace the value of <subscriptionKey> with your subscription key.
    2. Replace the request URL (https://westcentralus.api.cognitive.microsoft.com/vision/v2.0/analyze) with the endpoint URL for the Analyze Image method from the Azure region where you obtained your subscription keys, if necessary.
    3. Optionally, change the language parameter of the request URL (language=en) to use a different supported language.
    4. Optionally, change the image URL in the request body (http://upload.wikimedia.org/wikipedia/commons/3/3c/Shaki_waterfall.jpg\) to the URL of a different image to be analyzed.
  3. Open a command prompt window.
  4. Paste the command from the text editor into the command prompt window, and then run the command.
curl -H "Ocp-Apim-Subscription-Key: <subscriptionKey>" -H "Content-Type: application/json" "https://westcentralus.api.cognitive.microsoft.com/vision/v2.0/analyze?visualFeatures=Categories,Description&details=Landmarks&language=en" -d "{\"url\":\"http://upload.wikimedia.org/wikipedia/commons/3/3c/Shaki_waterfall.jpg\"}"

Examine the response

A successful response is returned in JSON. The sample application parses and displays a successful response in the command prompt window, similar to the following example:

  "categories": [
      "name": "outdoor_water",
      "score": 0.9921875,
      "detail": {
        "landmarks": []
  "description": {
    "tags": [
    "captions": [
        "text": "a large waterfall over a rocky cliff",
        "confidence": 0.916458423253597
  "requestId": "b6e33879-abb2-43a0-a96e-02cb5ae0b795",
  "metadata": {
    "height": 959,
    "width": 1280,
    "format": "Jpeg"

Clean up resources

When no longer needed, close the command prompt window and the text editor.

Next steps

Explore the Computer Vision API used to analyze an image, detect celebrities and landmarks, create a thumbnail, and extract printed and handwritten text. To rapidly experiment with the Computer Vision API, try the Open API testing console.