Developers and data engineers can use our SDG classification API to classify text fragments in multiple languages and to relate their text fragment to the SDG goals.

Rate limits

The API is throttled down for public use to 5 requests per second. If you need an increased rate, sent us an e-mail.

Calling the API

The classifier base URL is https://aurora-sdg.labs.vu.nl/classifier/classify/<model>

The path parameter <model> needs to be replaced by one of the available model designations:

  • aurora-sdg: Aurora SDG mBERT model (slower, Aurora definition of SDG's, 104 languages)
  • aurora-sdg-multi: Aurora SDG multi-label mBERT model (fast, Aurora definition of SDG's, 104 languages)
  • elsevier-sdg-multi: Elsevier SDG multi-label mBERT model (fast, Elsevier definition of SDG's, 104 languages)
  • osdg: OSDG model (alternative, OSDG definition of SDG's, 15 languages)

Please refer to our About the models page for further information.

The text to be classified can either be send as text-parameter in a HTTP GET request or as JSON-type content in the body of an HTTP-POST request:

                {
                  "text": "Text to be classified"
                }
                

CAUTION!

HTTP GET requests have a limited path length, which depends both on the server and the client used. In order to avoid problems, we strongly suggest to use HTTP-POST requests.

Examples

Let us classify the Text "The Aurora SDG classifier rocks" with the help of some common tools.

cURL

curl --location --request POST 'https://aurora-sdg.labs.vu.nl/classifier/classify/aurora-sdg-multi' \
--header 'Content-Type: application/json' \
--data-raw '{"text": "The Aurora SDG classifier rocks"}'
              

Python (requests)

import requests
import json

url = "https://aurora-sdg.labs.vu.nl/classifier/classify/aurora-sdg-multi"

payload = json.dumps({"text": "The Aurora SDG classifier rocks"})
headers = {'Content-Type': 'application/json'}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
              

R (httr)

library(httr)

headers = c(
  'Content-Type' = 'application/json'
)

body = '{"text": "The Aurora SDG classifier rocks"}';

res <- VERB("POST", url = "https://aurora-sdg.labs.vu.nl/classifier/classify/aurora-sdg-multi", body = body, add_headers(headers))

cat(content(res, 'text'))
              

Shell (wget)

wget --no-check-certificate --quiet \
  --method POST \
  --timeout=0 \
  --header 'Content-Type: application/json' \
  --body-data '{"text": "The Aurora SDG classifier rocks"}}' \
   'https://aurora-sdg.labs.vu.nl/classifier/classify/aurora-sdg-multi'
              

Response

The classifier returns the following JSON object:
{
  "@self": "https://aurora-sdg.labs.vu.nl/classify/aurora-sdg-multi",
  "text": "The Aurora SDG classification service rocks",
  "model": "aurora-sdg-multi",
  "model_name": "Aurora SDG classifier - multi model",
  "@context": {
    "sdg": "http://metadata.un.org/sdg/",
    "product": "https://schema.org/Product",
    "model": "https://schema.org/Model",
    "text": "https://schema.org/Text",
    "icon": "https://schema.org/thumbnail",
    "prediction": "https://schema.org/Float",
    "xsd": "http://www.w3.org/2001/XMLSchema#"
  },
  "predictions": [
    {
      "prediction": 0.0179583188,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/1",
                "label": "Goal 1",
                "code": "1",
                "name": "No poverty",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_1.png"
      }
    },
    {
      "prediction": 0.0301075056,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/2",
                "label": "Goal 2",
                "code": "2",
                "name": "Zero hunger",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_2.png"
      }
    },
    {
      "prediction": 0.00898723304,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/3",
                "label": "Goal 3",
                "code": "3",
                "name": "Good health and well-being",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_3.png"
      }
    },
    {
      "prediction": 0.0223726798,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/4",
                "label": "Goal 4",
                "code": "4",
                "name": "Quality Education",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_4.png"
      }
    },
    {
      "prediction": 0.0334077254,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/5",
                "label": "Goal 5",
                "code": "5",
                "name": "Gender equality",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_5.png"
      }
    },
    {
      "prediction": 0.024526149,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/6",
                "label": "Goal 6",
                "code": "6",
                "name": "Clean water and sanitation",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_6.png"
      }
    },
    {
      "prediction": 0.0311004557,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/7",
                "label": "Goal 7",
                "code": "7",
                "name": "Affordable and clean energy",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_7.png"
      }
    },
    {
      "prediction": 0.0417585634,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/8",
                "label": "Goal 8",
                "code": "8",
                "name": "Decent work and economic growth",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_8.png"
      }
    },
    {
      "prediction": 0.0379618816,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/9",
                "label": "Goal 9",
                "code": "9",
                "name": "Industry, innovation and infrastructure",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_9.png"
      }
    },
    {
      "prediction": 0.0250196643,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/10",
                "label": "Goal 10",
                "code": "10",
                "name": "Reduced inequalities",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_10.png"
      }
    },
    {
      "prediction": 0.0348257087,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/11",
                "label": "Goal 11",
                "code": "11",
                "name": "Sustainable cities and communities",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_11.png"
      }
    },
    {
      "prediction": 0.0723089129,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/12",
                "label": "Goal 12",
                "code": "12",
                "name": "Responsible consumption and production",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_12.png"
      }
    },
    {
      "prediction": 0.605728865,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/13",
                "label": "Goal 13",
                "code": "13",
                "name": "Climate action",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_13.png"
      }
    },
    {
      "prediction": 0.194514841,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/14",
                "label": "Goal 14",
                "code": "14",
                "name": "Life below water",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_14.png"
      }
    },
    {
      "prediction": 0.110757239,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/15",
                "label": "Goal 15",
                "code": "15",
                "name": "Life in Land",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_15.png"
      }
    },
    {
      "prediction": 0.033486817,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/16",
                "label": "Goal 16",
                "code": "16",
                "name": "Peace, Justice and strong institutions",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_16.png"
      }
    },
    {
      "prediction": 0.040825516,
      "sdg": {
                "@type": "sdg",
                "id": "http://metadata.un.org/sdg/17",
                "label": "Goal 17",
                "code": "17",
                "name": "Partnerships for the goals",
                "type": "Goal",
                "icon": "https://aurora-sdg.labs.vu.nl/resources/sdg_icon_17.png"
      }
    }
  ]
}