title: Creating a user using the Duo Security Admin API
body: <p>Following the documentation for the <a href="https://duo.com/docs/adminapi" rel="nofollow noreferrer">Duo Security Admin API</a>, I am trying to create/delete a user. The documentation only indicates that a post command needs to be used. No examples are given and I’m not sure where to start.</p>
  <p>I am trying to create a user and also delete a user using the following code. Neither works as I am not seeing the user being created or deleted in my admin console.</p>
  <pre class="lang-json prettyprint-override"><code>{&quot;code&quot;: 40101, &quot;message&quot;: &quot;Missing request credentials&quot;, &quot;stat&quot;: &quot;FAIL&quot;}
  </code></pre>
  <p>When I paste my URL I get this error and user is not created. What am I doing wrong?</p>
  <pre class="lang-java prettyprint-override"><code>import java.io.*;
  import java.net.URL;
  import java.net.HttpURLConnection;
  
  public class duo {
      public static void main(String[] args) throws IOException, InterruptedException {
          // Create a neat value object to hold the URL
          URL url;
          url = new URL(&quot;https://api-e9770554.duosecurity.com/admin/v1/users&quot;);
  
          // Open a connection(?) on the URL(??) and cast the response(???)
          HttpURLConnection connection = (HttpURLConnection) url.openConnection();
  
          // Now it's &quot;open&quot;, we can set the request method, headers etc.
          connection.setRequestProperty(&quot;accept&quot;, &quot;application/json&quot;);
  
          // This line makes the request
          InputStream responseStream = connection.getInputStream();
      }
  }
  </code></pre>