API Documentation

Introduction

Welcome to the DeviceAPI documentation. Our API provides a simple yet powerful way to access a vast database of device and two-wheeler specifications. Whether you are building a comparison website, a research tool, or just need structured data, our RESTful API has you covered.

This guide will walk you through the necessary steps to get authenticated and start making requests to fetch the data you need.

Authentication

Our API uses API keys to authenticate requests. You can view your API key below. If you do not have a key, you will need to log in or sign up to generate one.

All API requests must include an API key in the Authorization header. The key should be included as a Bearer token.

Best Practice: Use Environment Variables

For security reasons, it is highly recommended to store your API key in an environment variable rather than hardcoding it in your application. The code examples on this page demonstrate how to load the key from an environment variable, while falling back to your key for immediate testing.

Your API Key

Please login or sign up to see your unique API key.

Header Example

You must include the following header in your API requests:

http
Authorization: Bearer YOUR_API_KEY

Replace YOUR_API_KEY with your actual API key. All of the code examples on this page will automatically use your key if you are logged in.

API Endpoints

1. Get All Devices

This endpoint retrieves a list of all available devices.

GET /api/devices

Query Parameters

This endpoint does not have any query parameters.

Examples

cURL

bash
curl -X GET "https://api.innepall.com/api/devices" -H "Authorization: Bearer YOUR_API_KEY"

Python

python
import requests
import os

API_KEY = os.getenv("API_KEY", "YOUR_API_KEY")
API_URL = "https://api.innepall.com/api/devices"

headers = {
    "Authorization": f"Bearer {API_KEY}"
}

response = requests.get(API_URL, headers=headers)

if response.status_code == 200:
    devices = response.json()['devices']
    print(f"Found {len(devices)} devices.")
else:
    print(f"Error: {response.status_code}")

JavaScript (Node.js)

javascript
const fetch = require('node-fetch');

const API_KEY = process.env.API_KEY || "YOUR_API_KEY";
const API_URL = "https://api.innepall.com/api/devices";

const headers = {
    "Authorization": `Bearer ${API_KEY}`
};

fetch(API_URL, { headers })
    .then(res => res.json())
    .then(data => console.log(`Found ${data.devices.length} devices.`))
    .catch(err => console.error("Error:", err));

PHP

php
<?php

$apiKey = getenv('API_KEY') ?: "YOUR_API_KEY";
$apiUrl = "https://api.innepall.com/api/devices";

$headers = [
    "Authorization: Bearer " . $apiKey
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpcode == 200) {
    $data = json_decode($response, true);
    echo "Found " . count($data['devices']) . " devices.\n";
} else {
    echo "Error: " . $httpcode;
}

?>

2. Get Device by ID

Retrieves the detailed specifications for a single device using its unique ID.

GET /api/devices/:id

Path Parameters

  • id (required): The unique ID of the device.

Examples

cURL

bash
curl -X GET "https://api.innepall.com/api/devices/YOUR_DEVICE_ID" -H "Authorization: Bearer YOUR_API_KEY"

Python

python
import requests
import os

API_KEY = os.getenv("API_KEY", "YOUR_API_KEY")
DEVICE_ID = "YOUR_DEVICE_ID" # e.g., 1718042436123
API_URL = f"https://api.innepall.com/api/devices/{DEVICE_ID}"

headers = {
    "Authorization": f"Bearer {API_KEY}"
}

response = requests.get(API_URL, headers=headers)

if response.status_code == 200:
    device_details = response.json()
    print(device_details)
else:
    print(f"Error: {response.status_code}")

3. Get All Two-Wheelers

This endpoint retrieves a list of all available two-wheelers.

GET /api/twowheelers

Query Parameters

This endpoint does not have any query parameters.

Examples

cURL

bash
curl -X GET "https://api.innepall.com/api/twowheelers" -H "Authorization: Bearer YOUR_API_KEY"

Python

python
import requests
import os

API_KEY = os.getenv("API_KEY", "YOUR_API_KEY")
API_URL = "https://api.innepall.com/api/twowheelers"

headers = {
    "Authorization": f"Bearer {API_KEY}"
}

response = requests.get(API_URL, headers=headers)

if response.status_code == 200:
    two_wheelers = response.json()['devices']
    print(f"Found {len(two_wheelers)} two-wheelers.")
else:
    print(f"Error: {response.status_code}")

PHP

php
<?php

$apiKey = getenv('API_KEY') ?: "YOUR_API_KEY";
$apiUrl = "https://api.innepall.com/api/twowheelers";

$headers = [
    "Authorization: Bearer " . $apiKey
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpcode == 200) {
    $data = json_decode($response, true);
    echo "Found " . count($data['devices']) . " two-wheelers.\n";
} else {
    echo "Error: " . $httpcode;
}

?>

4. Get Two-Wheeler by ID

Retrieves the detailed specifications for a single two-wheeler using its unique ID.

GET /api/twowheelers/:id

Path Parameters

  • id (required): The unique ID of the two-wheeler.

Examples

cURL

bash
curl -X GET "https://api.innepall.com/api/twowheelers/YOUR_TWOWHEELER_ID" -H "Authorization: Bearer YOUR_API_KEY"

Python

python
import requests
import os

API_KEY = os.getenv("API_KEY", "YOUR_API_KEY")
TWOWHEELER_ID = "YOUR_TWOWHEELER_ID" # e.g., 1718042436123
API_URL = f"https://api.innepall.com/api/twowheelers/{TWOWHEELER_ID}"

headers = {
    "Authorization": f"Bearer {API_KEY}"
}

response = requests.get(API_URL, headers=headers)

if response.status_code == 200:
    twowheeler_details = response.json()
    print(twowheeler_details)
else:
    print(f"Error: {response.status_code}")

PHP

php
<?php

$apiKey = getenv('API_KEY') ?: "YOUR_API_KEY";
$twowheelerId = 'YOUR_TWOWHEELER_ID';
$apiUrl = "https://api.innepall.com/api/twowheelers/" . $twowheelerId;

$headers = [
    "Authorization: Bearer " . $apiKey
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpcode == 200) {
    $data = json_decode($response, true);
    print_r($data);
} else {
    echo "Error: " . $httpcode;
}

?>

5. Get Item by URL (Scraping)

This endpoint fetches and parses device data from a given URL.

GET /api/fetch?url=ENCODED_URL

Query Parameters

  • url (required): The URL of the device page to fetch data from. The URL must be properly encoded.

Examples

Python

python
import requests
import os

API_KEY = os.getenv("API_KEY", "YOUR_API_KEY")
FETCH_URL = "https://www.example.com/device-details" # Example URL, replace with a real device URL
API_URL = f"https://api.innepall.com/api/fetch?url={FETCH_URL}"

headers = {
    "Authorization": f"Bearer {API_KEY}"
}

response = requests.get(API_URL, headers=headers)

if response.status_code == 200:
    device_data = response.json()
    print(device_data)
else:
    print(f"Error: {response.status_code}")

PHP

php
<?php

$apiKey = getenv('API_KEY') ?: 'YOUR_API_KEY';

// The URL of the product page you want to scrape.
// IMPORTANT: This URL must be URL-encoded to be passed safely as a query parameter.
$fetchUrl = urlencode("https://www.example.com/product-page-to-scrape");

$apiUrl = "https://api.innepall.com/api/fetch?url=" . $fetchUrl;

$headers = [
    "Authorization: Bearer " . $apiKey
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpcode == 200) {
    $data = json_decode($response, true);
    echo "Successfully scraped data:\n";
    print_r($data);
} else {
    echo "Error fetching or scraping URL. Status code: " . $httpcode;
    // You can uncomment the line below to see the full error response from the API
    // echo "\nResponse: " . $response;
}

?>

Test API