Create user using admin api


I currently have duo 2fa integrated with our custom webapp. I would like to now be able to create a user on our account using the admin api. But I cannot find any documentation that has an example of how to do so.

I can see from the documentation that it’s a post command, but it has no specifics. Can anyone give me an example of that or point me in the right direction?

Thanks you.


Hello Brian_Fleishman!

The best reference is our Admin API documentation. The API Details section should help you figure it out. Additionally, you may find it useful to look at our API demo clients out on our GitHub, like our Python demo client.


I’ve poured through that documentation, but it doesn’t give any examples of an http post. And unfortunately I’m not that familiar with any of the languages that are in the documentation, except for Java.

Do you know of any place where I can see a working example of an http post to create or delete a user? Thanks.


Hi Brian,
I was in the same boat just hours ago. I was having issues trying to figure out how to just retrieve a user’s information via the admin API. I’m doing it in PHP, but I’m sure the translation to java would be, hopefully, straight forward:

  1. See Duo Admin API | Duo Security for docs
  2. Download source files at
  3. Files of interest will be in the folder duo_api_php/src
  4. Retrieve the integration key, secret key and api URL by logging into the Duo console ( and navigating to Applications and clicking on the Admin API user that you have set up in “first steps” of Duo Admin API | Duo Security

I created a sample php script that pulled the information for one user (see below). To create a user you would call the “create_user” method that is contained in the Admin.php file. You can see in that function/method its doing a POST. Parameters are found here: Duo Admin API | Duo Security

Sample source code for calling the “users” method of the “Admin” class

namespace DuoAPI;
include 'Requester.php';
include 'CurlRequester.php';
include 'Client.php';
include 'Admin.php';
$D = new Admin("integration key here","secret key here","");
# just a particular user     
#  $users = $D->users("smith");

# all users
  $users = $D->users();

  // Loop through Array
  foreach ($users["response"]["response"] as $key => $value) {
print $value["username"] .  "  " . $value["email"] .  "  " . $value["realname"] . "\n";