Authentication with the API


When I’m making a sample query for enrollments against a particular organization unit in my instance, I am not getting a response of the enrollments but instead of the login page…

What is this to mean?

1 Like

Are you sure that you entered the correct authentication? Are you using the browser or another software to make the requests? What app are you using in DHIS2 and does the login page appear only when you run this query?

Would you use the Network tab (F12→Network) to and see if there are errors that appear before it moves you to the login page?


So I want to build a third party app to interact with the API, so I was laying the groundwork by reading up on how the API works and getting ideas of how to access the data I’m interested in.

The app I want to read from is Tracker Capture. (DHIS 2.35)
Having formulated the URL for the data I was interested in, I was making GET requests from Postman where I was receiving a login page response.

My question is how perform authentication with the API because I’m not too sure I was clear on that from the documentation alone.
Also would I need to perform authentication for every single call I make to DHIS or can I do once and then make subsequent calls as needed?

Hey! I think the authentication will depend on which protocol you use (Basic Authentication, Personal Access Tokens (PAT), OAuth 2) and you might find the Postman guide for each authorization helpful (

Generally Postman allows you to save variables for the authentication, and a proper authentication configuration is only needed once, so you won’t have to repeat the authentication configuration for each request.


Thank you! I figured it out! :smiley:

1 Like