v1.0.0Changelog

Quickstart Guide

Get up and running with the Darta API in just a few minutes. This guide will walk you through making your first API call and understanding the response format.

1. Get Your API Key

First, you'll need to sign up for a Darta account and get your API key:

Free API Key

Start with 500 free search credits. No credit card required.

  1. Sign up at darta.dev
  2. Navigate to your dashboard
  3. Copy and securely store your API key

2. Make Your First API Call

Let's start with a simple search for wireless headphones across Amazon and eBay:

Your first API call
curl -X POST https://darta.dev/api/search \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "wireless headphones",
    "platforms": ["amazon", "ebay"],
    "results": 5
  }'

Replace YOUR_API_KEY with your actual API key.

3. Understanding the Response

The API will return a JSON response with results organized by platform:

Example response
{
  "request_id": "req_1234567890abcdef",
  "query": "wireless headphones",
  "platforms_searched": ["amazon", "ebay"],
  "total_results": 10,
  "credits_charged": 8,
  "search_time_ms": 2340,
  "results": [
    {
      "platform": "amazon",
      "id": "B08PZHYWJS",
      "title": "Sony WH-1000XM4 Wireless Premium Noise Canceling Overhead Headphones",
      "price": 348.00,
      "currency": "USD",
      "url": "https://amazon.com/dp/B08PZHYWJS",
      "image_url": "https://m.media-amazon.com/images/I/71o8Q5XJS5L._AC_SL1500_.jpg",
      "rating": 4.4,
      "review_count": 54891,
      "availability": "In Stock",
      "condition": "new",
      "seller": "Amazon.com"
    },
    {
      "platform": "ebay",
      "id": "123456789012",
      "title": "Sony WH-1000XM4 Wireless Headphones - Black",
      "price": 299.99,
      "currency": "USD",
      "url": "https://www.ebay.com/itm/123456789012",
      "image_url": "https://i.ebayimg.com/images/g/abc123/s-l1600.jpg",
      "rating": 4.8,
      "review_count": 156,
      "availability": "Available",
      "condition": "new",
      "seller": "certified_electronics"
    }
  ],
  "usage": {
    "credits_used": 8,
    "credits_remaining": 992,
    "concurrent_requests": 1,
    "concurrent_limits": {
      "limit": 4,
      "used": 1,
      "remaining": 3
    }
  }
}

4. Code Examples

Here are examples in popular programming languages:

JavaScript/Node.js

quickstart.js
const axios = require('axios');

async function searchProducts() {
  try {
    const response = await axios.post('https://darta.dev/api/search', {
      query: 'wireless headphones',
      platforms: ['amazon', 'ebay'],
      results: 5
    }, {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      }
    });
    
    console.log(`Found ${response.data.total_results} results`);
    console.log(`Credits used: ${response.data.credits_charged}`);
    console.log(`Search time: ${response.data.search_time_ms}ms`);
    
    // Display results
    response.data.results.forEach((product, index) => {
      console.log(`${index + 1}. [${product.platform.toUpperCase()}] ${product.title} - $${product.price}`);
    });
    
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}

searchProducts();

Python

quickstart.py
import requests
import json

def search_products():
    url = 'https://darta.dev/api/search'
    headers = {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    }
    
    payload = {
        'query': 'wireless headphones',
        'platforms': ['amazon', 'ebay'],
        'results': 5
    }
    
    try:
        response = requests.post(url, headers=headers, json=payload)
        response.raise_for_status()
        
        data = response.json()
        print(f"Found {data['total_results']} results")
        print(f"Credits used: {data['credits_charged']}")
        print(f"Search time: {data['search_time_ms']}ms")
        
        # Display results
        for i, product in enumerate(data['results'], 1):
            print(f"{i}. [{product['platform'].upper()}] {product['title']} - ${product['price']}")
                
    except requests.exceptions.RequestException as e:
        print(f"Error: {e}")

search_products()

PHP

quickstart.php
<?php

function searchProducts() {
    $url = 'https://darta.dev/api/search';
    $headers = [
        'Authorization: Bearer YOUR_API_KEY',
        'Content-Type: application/json'
    ];
    
    $payload = json_encode([
        'query' => 'wireless headphones',
        'platforms' => ['amazon', 'ebay'],
        'results' => 5
    ]);
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
    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 " . $data['total_results'] . " results\n";
        echo "Credits used: " . $data['credits_charged'] . "\n";
        echo "Search time: " . $data['search_time_ms'] . "ms\n";
        
        // Display results
        foreach ($data['results'] as $index => $item) {
            echo ($index + 1) . ". [" . strtoupper($item['platform']) . "] " . $item['title'] . " - $" . $item['price'] . "\n";
        }
    } else {
        echo "Error: HTTP " . $httpCode . "\n";
        echo $response . "\n";
    }
}

searchProducts();

?>

5. Advanced Features

Darta offers powerful features to enhance your search experience:

⚡ Real-time Streaming

Get results as they arrive with Server-Sent Events. Add stream: true to your request.

Enable streaming
{
  "query": "wireless headphones",
  "platforms": ["amazon", "ebay"],
  "stream": true
}

🔍 Detailed Product Information

Fetch comprehensive product details including specifications, features, and seller information.

Get detailed results
{
  "query": "iPhone 15 Pro",
  "platforms": ["amazon", "ebay"],
  "details": true
}

🎯 Advanced Filtering

Filter results by price, condition, and location.

Filter results
{
  "query": "Toyota Camry 2018-2022",
  "platforms": ["craigslist", "facebook_marketplace"],
  "price": { "min": 15000, "max": 25000 },
  "condition": "used",
  "location": {
    "city": "Nashville, TN",
    "radius_miles": 50
  }
}

6. Next Steps

Now that you've made your first API call, here's what to explore next:

Common Use Cases

Here are some popular ways developers use the Darta API:

🛒 Price Comparison Tools

Build applications that compare prices across multiple e-commerce platforms to help users find the best deals.

📊 Market Research

Analyze product trends, pricing strategies, and competitor offerings across different marketplaces.

🏠 Real Estate Analysis

Aggregate property listings from multiple real estate platforms for comprehensive market analysis.

🤖 AI-Powered Shopping

Integrate with AI agents to provide intelligent product recommendations and automated shopping assistance.

You're Ready to Build!

You now have everything you need to start integrating the Darta API into your application. Remember to handle errors gracefully and respect rate limits for the best experience.