SDG API


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, ideal for data science labelling with recommended cut-off values 98% probability and above)
  • aurora-sdg-multi: Aurora SDG multi-label mBERT model (fast, Aurora definition of SDG’s, 104 languages, ideal for SDG badges)
  • 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'