Ola Map SDK

Authentication

How to get your API key and authenticate with Ola Maps API

Authentication

To use the Ola Maps API, you need an API key. This guide explains how to obtain and use your API key.

Getting Your API Key

Step 1: Create an Account

  1. Visit the Ola Maps Developer Portal
  2. Click on "Sign Up" or "Register"
  3. Complete the registration process

Step 2: Generate API Key

  1. Log in to your developer account
  2. Navigate to the "API Keys" section
  3. Click "Generate New API Key"
  4. Give your API key a descriptive name (e.g., "Production", "Development")
  5. Copy and securely store your API key

Important: Your API key is like a password. Never share it publicly or commit it to version control.

Using Your API Key

Basic Usage

Initialize the SDK client with your API key:

const OlaMapsClient = require('ola-map-sdk');

const client = new OlaMapsClient('YOUR_API_KEY');

For security, use environment variables:

1. Create a .env file:

OLA_MAPS_API_KEY=your_api_key_here

2. Load environment variables:

require('dotenv').config();
const OlaMapsClient = require('ola-map-sdk');

const client = new OlaMapsClient(process.env.OLA_MAPS_API_KEY);

3. Install dotenv:

npm install dotenv

Node.js Applications

In server-side applications:

// config/maps.js
const OlaMapsClient = require('ola-map-sdk');

const client = new OlaMapsClient(process.env.OLA_MAPS_API_KEY);

module.exports = client;

Then use it in your application:

const client = require('./config/maps');

// Use the client
const results = await client.places.autocomplete('Bangalore');

Need Help?

On this page