How to Authenticate with D&B Direct API Web Service

Step 1: First you have to create an account in D&B using this online form http://developer.dnb.com/register-v2 and get your Username and Password.

Step 2: You can get connected with D&B direct api via SOAP and REST api.

Soap API Call Example:

To get connected with D&B api using soap client call. Follow the below php code.

After hit this code you can company detail request. As i mentioned this api function in soap client request.

Rest API Example:

To get connected with D&B Direct Rest api, You need an authentication Token to access it. First get the New Token using this POST request.

After that you Success result with new auth token. Use token in below Curl code to get data from D&B Direct api.


I am professional web developer and blogger. Use this blog to share own api and other web development experience with you. I do accept paid work. Write to me to start working on your dream project - codefixup@gmail.com


  1. Hello,
    I am still working on connecting to the D&B soap api, do you have anything else you can add? I am new to programming and SOAP is harder than I thought.

    • Hi Caitlin,

      Soap programming for d&b is quite simple. use this soap code to get connected.

      < ?php $opts = array( 'http'=>array(
      ‘ignore_errors’ => true,
      ‘header’=>”API-KEY:****Use API Key Here*****\r\nusername:***Username**\r\npassword:***Password**”,
      $fp = fopen(‘http://dnbdirect-api.dnb.com/DnBAPI-15/rest/company/060704780’, ‘rb’, false, stream_context_create($opts));
      $response = stream_get_contents($fp);
      print $response;

  2. no one code is working for me, how i get API-KEY. I have only username and password.
    And what is the website url where i have check given username and password given by client.

Leave a Reply

Your email address will not be published. Required fields are marked *