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 email@example.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.
Step 2: Request a PubToken
- Send an email to firstname.lastname@example.org 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 email@example.com to receive a PubToken, be sure to specify which environment it is for: Production or Sandbox.
- After your account is approved (allow 1-2 business days) you will receive an email from firstname.lastname@example.org. 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.
- Go to http://developer.pubmatic.com/user and log in using your Apigee UserName and Password.
- 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.
- 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
Use the following instructions to generate the Access Token (PubToken) using the Consumer Key and Consumer Secret.
The PubToken will expire 60 days from the time it is created.
- 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
- 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.
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
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
- 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.