Getting Started with PubMatic APIs

Document created by catherine.racette on Mar 9, 2017Last modified by catherine.racette on Aug 24, 2017
Version 10Show Document
  • View in full screen mode

Getting Started with PubMatic APIs

Note: Before you can begin implementing PubMatic APIs, you must follow the instructions below for registration and token generation in Apigee. API Documentation can be accessed through the Developers Home page on this community.

For help with the API process, please email api-support@pubmatic.com

 

Step 1: Register with PubMatic

Register to use the PubMatic APIs using this Registration Form. Complete the details and submit for approval.

  • Publisher Requirements: Provide your Publisher ID assigned by PubMatic.
  • Developer Requirements: Provide your Github profile ID and LinkedIn profile ID, if it exists, to speed up your profile activation.
  • Partner Requirements: Provide the name of the person at PubMatic who referred you to speed up your profile activation.
The registration request will be reviewed by a PubMatic API Administrator. Once approved (allow 1-2 business days), you will receive a confirmation email.

Step 2: Request a PubToken

  1. Send an email to api-support@pubmatic.com  to request a PubToken, which will be your permanent token for use in the PubMatic system.
    Provide the following information in the request:
  • Environment (e.g., Production/Sandbox)
  • Publisher ID
  • Site ID
  • PubMatic email ID
  • Apigee account details

    It is possible that the PubToken for Production and SandBox environments will be different.When sending an email to api-support@pubmatic.com to receive a PubToken, be sure to specify which environment it is for: Production or Sandbox.

  1. After your account is approved (allow 1-2 business days) you will receive an email from noreplly@apigee.com. This email will contain details for setting a password. Once you've followed the instructions to set your password, log out of the current screen.
  2. Go to http://developer.pubmatic.com/user and log in using your Apigee UserName and Password.
  3. Open the My Apps tab and click Add a new app.
    This tab should open by default after logging in, but can also be accessed by clicking your username in the upper-right and selecting My Apps.
  4. After successfully creating an app, click on the app name (on the My Apps tab) to view your Consumer Key and Consumer Secret.

Step 3: Generate Access Token

Using the following instructions, first generate a Short-Lived Access Token using the Consumer Key, Consumer Secret and the PubToken. You will then generate the permanent token you will use in PubMatic's APIs (step 2 below).

 

  1. Generate a base64 encode of Consumer Key:Consumer Secret string (you may use - http://www.motobit.com/util/base64-decoder-encoder.asp).
    For example, if your consumer key= CANfdsfdasdfFG and consumer secret key= XyZdfsdLRV. You should generate a base64 encode of
    CANfdsfdasdfFG:XyZdfsdLRV.
  2. Call the following HTTP URL using any suitable HTTP utility (PubMatic uses curl). Replace Base64Encoded (key:secret) placeholder in the curl call
    below with an encoded value generated in above step. Replace <pubMaticApiKey> placeholder in curl call below with 'PubToken' provided to you.

    Production:
    curl -H "Content-Type:application/x-www-form-urlencoded" -H "Authorization:Basic <base64_encoded_key:secret>" -X POST -d 'grant_type=password&username=<pubMaticApiKey>&password=<pubMaticApiKey>' http://api.pubmatic.com/v1/oauth/generateOauthToken

    SandBox:
    curl -H "Content-Type:application/x-www-form-urlencoded" -H "Authorization:Basic <base64_encoded_key:secret>" -X POST -d 'grant_type=password&username=<pubMaticApiKey>&password=<pubMaticApiKey>' http://api-sandbox.pubmatic.com/v1/oauth/generateOauthToken

  3. With every API call, set the HTTP header "Authorization with the value, "Bearer $access_token".

    $access_token is a placeholder for the value you got in the above response.

Attachments

    Outcomes