API Documentation

Integrate DigitalPrank tools into your application

Authentication

All API requests require authentication using your Affiliate ID and API Key.

Get Your Credentials

  1. Sign up for the affiliate program at /affiliates/register.php
  2. Wait for admin approval
  3. Login to your dashboard at /affiliates/
  4. Find your API credentials in the "API Integration" tab

Authentication Methods

Method 1: HTTP Headers (Recommended)
curl -X GET https://digitalprank.com/api/tools \
  -H "X-Affiliate-ID: TEST123" \
  -H "X-API-Key: aff_test_c220484957a..."
Method 2: Query Parameters
curl "https://digitalprank.com/api/tools?affiliate_id=TEST123&api_key=aff_test_c220484957a..."
⚠️ Security Note: Never expose your API key in client-side JavaScript or public repositories. Always make API calls from your server.

Available Endpoints

Method Endpoint Description
GET /api API information and status
GET /api/tools List all available tools
GET /api/tools/{id} Get specific tool information
GET /api/tools/{slug}/embed Get embed code for a tool

Tools API

GET /api/tools

Retrieve a list of all available tools with affiliate tracking URLs.

Request:
curl -X GET https://digitalprank.com/api/tools \
  -H "X-Affiliate-ID: TEST123" \
  -H "X-API-Key: aff_test_c220484957a..."
Response:
{
  "success": true,
  "count": 5,
  "tools": [
    {
      "tool_id": 1,
      "name": "Fake Text Message Generator",
      "slug": "fake-text-message",
      "subdomain": "fake-text-message-generator",
      "url": "https://fake-text-message-generator.digitalprank.com",
      "affiliate_url": "https://fake-text-message-generator.digitalprank.com?ref=TEST123",
      "embed_url": "https://fake-text-message-generator.digitalprank.com?ref=TEST123&embed=1"
    }
  ],
  "affiliate": {
    "code": "TEST123",
    "commission_rate": "30%"
  }
}

GET /api/tools/{id}

Get detailed information about a specific tool.

Request:
curl -X GET https://digitalprank.com/api/tools/1 \
  -H "X-Affiliate-ID: TEST123" \
  -H "X-API-Key: aff_test_c220484957a..."
Response:
{
  "success": true,
  "tool": {
    "tool_id": 1,
    "name": "Fake Text Message Generator",
    "slug": "fake-text-message",
    "subdomain": "fake-text-message-generator",
    "category": "messaging",
    "credit_cost": 1,
    "is_active": 1,
    "url": "https://fake-text-message-generator.digitalprank.com",
    "affiliate_url": "https://fake-text-message-generator.digitalprank.com?ref=TEST123",
    "embed_url": "https://fake-text-message-generator.digitalprank.com?ref=TEST123&embed=1"
  }
}

Embed Codes

GET /api/tools/{slug}/embed

Get ready-to-use embed code for a tool.

Request:
curl -X GET https://digitalprank.com/api/tools/fake-text-message/embed \
  -H "X-Affiliate-ID: TEST123" \
  -H "X-API-Key: aff_test_c220484957a..."
Response:
{
  "success": true,
  "tool": {
    "name": "Fake Text Message Generator",
    "slug": "fake-text-message",
    "url": "https://fake-text-message-generator.digitalprank.com?ref=TEST123"
  },
  "embed_code": "<iframe src=\"...\" width=\"100%\" height=\"600\" frameborder=\"0\"></iframe>",
  "iframe_src": "https://fake-text-message-generator.digitalprank.com?ref=TEST123"
}
💡 How Embeds Work:
When users interact with embedded tools, their usage is automatically tracked and attributed to your affiliate account for 30 days via cookies.

Code Examples

JavaScript / Node.js

const axios = require('axios');

const API_URL = 'https://digitalprank.com/api';
const AFFILIATE_ID = 'TEST123';
const API_KEY = 'aff_test_c220484957a...';

async function getTools() {
  try {
    const response = await axios.get(`${API_URL}/tools`, {
      headers: {
        'X-Affiliate-ID': AFFILIATE_ID,
        'X-API-Key': API_KEY
      }
    });

    console.log(response.data);
    return response.data.tools;
  } catch (error) {
    console.error('API Error:', error.message);
  }
}

getTools();

Python

import requests

API_URL = 'https://digitalprank.com/api'
AFFILIATE_ID = 'TEST123'
API_KEY = 'aff_test_c220484957a...'

def get_tools():
    headers = {
        'X-Affiliate-ID': AFFILIATE_ID,
        'X-API-Key': API_KEY
    }

    response = requests.get(f'{API_URL}/tools', headers=headers)

    if response.status_code == 200:
        data = response.json()
        return data['tools']
    else:
        print(f'Error: {response.status_code}')
        return None

tools = get_tools()
print(tools)

PHP

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://digitalprank.com/api/tools');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-Affiliate-ID: TEST123',
    'X-API-Key: aff_test_c220484957a...'
]);

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

if ($statusCode === 200) {
    $data = json_decode($response, true);
    print_r($data['tools']);
}

cURL (Command Line)

# Get all tools
curl -X GET https://digitalprank.com/api/tools \
  -H "X-Affiliate-ID: TEST123" \
  -H "X-API-Key: aff_test_c220484957a..."

# Get specific tool
curl -X GET https://digitalprank.com/api/tools/1 \
  -H "X-Affiliate-ID: TEST123" \
  -H "X-API-Key: aff_test_c220484957a..."

# Get embed code
curl -X GET https://digitalprank.com/api/tools/fake-text-message/embed \
  -H "X-Affiliate-ID: TEST123" \
  -H "X-API-Key: aff_test_c220484957a..."

Rate Limits & Best Practices

Rate Limits

  • 1000 requests per hour per API key
  • 100 requests per minute burst
  • Response header X-RateLimit-Remaining shows remaining quota

Best Practices

Support

Need help? Here's how to get support: