Error 401 when trying to connect stardog cloud (free)

import stardog
from pathlib import Path

# specify our endpoint, username, and password
# default values are provided, be sure to change if necessary
conn_details = {
    'endpoint': 'https://sd-<XXX>',
    'username': '<MAIL>',
    'password': '<SSO PASS>'

with stardog.Admin(**conn_details) as admin:
  db = admin.new_database('db')

  with stardog.Connection('db', **conn_details) as conn:
    results ='select * { ?a ?p ?o }')



Traceback (most recent call last):
  File "/home/kali/Desktop/Stardog/python-client/", line 12, in <module>
    with stardog.Admin(**conn_details) as admin:
  File "/home/kali/Desktop/Stardog/python-client/env/lib/python3.11/site-packages/stardog/", line 53, in __init__
  File "/home/kali/Desktop/Stardog/python-client/env/lib/python3.11/site-packages/stardog/", line 65, in alive
    r = self.client.get("/admin/alive")
  File "/home/kali/Desktop/Stardog/python-client/env/lib/python3.11/site-packages/stardog/http/", line 59, in get
    return self.__wrap(self.session.get(self.url + path, **kwargs))
  File "/home/kali/Desktop/Stardog/python-client/env/lib/python3.11/site-packages/stardog/http/", line 75, in __wrap
    raise exceptions.StardogException(
stardog.exceptions.StardogException: [401] : 

The endpoint and the credentials are correct.


I think instead of using your SSO password, you need to use the password specific to your endpoint. You can set this password by going into Studio, go to the Security tab and select your user. Select the menu in the upper right corner and select "Change Password". This should allow you to set a password for your user on this endpoint.
Screenshot 2024-03-06 at 07.25.45

You can then use the password to connect to our endpoint in your python script.

Best regards,


Hi Lars, thank you for your response. After making the changes, everything is working correctly. Thank you.