SnipURL API Overview

Create Lightning Bitcoin payment links programmatically with our powerful RESTful API. Built with modern REST principles for seamless integration.

Base URL:
https://snipurl.org/api/v1/

Key Features

Instant Lightning Links

Create payment links in milliseconds

Real-time Analytics

Track payments and performance

Secure Authentication

API key-based security

Mobile Optimized

Perfect payment experience

Quick Start

Get up and running with the SnipURL API in just a few minutes.

1 Get Your API Key

Visit the main SnipURL website and generate your API key from the dashboard.

Get API Key →

2 Make Your First Request

CURL
curl -X POST https://snipurl.org/api/v1/links \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{
    "amount": 1000,
    "description": "Coffee Payment"
  }'

3 Handle the Response

JSON RESPONSE
{
  "success": true,
  "data": {
    "id": "abc123def456",
    "url": "https://snipurl.org/pay/abc123def456",
    "amount": 1000,
    "description": "Coffee Payment",
    "status": "active",
    "created_at": "2024-01-15T10:30:00Z",
    "expires_at": "2024-01-16T10:30:00Z"
  }
}

Authentication

Secure your API requests with API key authentication.

Authentication Header

HTTP HEADER
X-API-Key: your_api_key_here

Security Note

Never expose your API key in client-side code or public repositories. Always make API calls from your backend server.

Rate Limits

Fair usage policies to ensure system stability and performance for all users.

Current Limits

Limit Type Requests Time Window
Standard 1,000 1 hour
Burst 50 1 minute

Rate Limit Headers

Every response includes these headers to help you track your usage:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1642262400

Get Statistics

Endpoint

GET /api/v1/links/stats

Get comprehensive analytics and statistics for all your payment links.

Query Parameters

period optional

Time period for statistics

Values: 7d, 30d, 90d, all. Default: 30d

include_daily optional

Include daily breakdown data

Values: true, false. Default: false

Example Request

CURL
curl -X GET "https://snipurl.org/api/v1/links/stats?period=7d&include_daily=true" \
  -H "X-API-Key: your_api_key_here"

Example Response

JSON
{
  "success": true,
  "data": {
    "period": "7d",
    "summary": {
      "total_links": 45,
      "paid_links": 23,
      "pending_links": 18,
      "expired_links": 4,
      "total_amount": 125000,
      "paid_amount": 67500,
      "conversion_rate": 51.1,
      "average_payment_time": "00:14:32"
    },
    "revenue": {
      "total_sats": 67500,
      "total_btc": 0.000675,
      "total_usd": 43.88,
      "daily_average": 9642
    },
    "performance": {
      "total_views": 342,
      "total_clicks": 89,
      "click_through_rate": 26.0,
      "most_popular_amount": 1000
    },
    "daily_breakdown": [
      {
        "date": "2025-06-21",
        "links_created": 8,
        "payments": 5,
        "amount": 12500,
        "views": 67,
        "clicks": 18
      },
      {
        "date": "2025-06-20",
        "links_created": 6,
        "payments": 3,
        "amount": 8000,
        "views": 45,
        "clicks": 12
      }
    ]
  }
}

Response Fields

conversion_rate

Percentage of links that resulted in successful payments

average_payment_time

Average time from link creation to payment completion

click_through_rate

Percentage of views that resulted in payment attempts

daily_breakdown

Day-by-day analytics (only included if include_daily=true)

Analytics Note

Statistics are updated in real-time. All amounts are shown in satoshis (sats). USD conversions use the current BTC exchange rate and may vary.

API Key Info

Endpoint

GET /api/v1/key/info

Get information about your API key including usage limits and permissions.

Example Request

CURL
curl -X GET "https://snipurl.org/api/v1/key/info" \
  -H "X-API-Key: your_api_key_here"

Example Response

JSON
{
  "success": true,
  "data": {
    "key_id": "sk_live_abc123xyz789",
    "name": "Production API Key",
    "created_at": "2025-06-01T09:00:00Z",
    "last_used": "2025-06-21T11:30:45Z",
    "status": "active",
    "permissions": [
      "links:create",
      "links:read",
      "links:delete",
      "stats:read"
    ],
    "rate_limits": {
      "requests_per_minute": 60,
      "requests_per_hour": 3600,
      "requests_per_day": 50000
    },
    "usage": {
      "current_minute": 5,
      "current_hour": 127,
      "current_day": 2341,
      "total_requests": 48529
    },
    "account": {
      "user_id": "user_abc123",
      "plan": "pro",
      "total_links": 1247,
      "monthly_link_limit": 10000,
      "remaining_links": 8753
    }
  }
}

Response Fields

status

API key status: active, suspended, or revoked

permissions[]

Array of permissions granted to this API key

rate_limits

Current rate limiting configuration for your key

usage

Real-time usage statistics for rate limit monitoring

account.plan

Your current subscription plan: free, pro, or enterprise

Available Permissions

links:create

Create new payment links

links:read

View and list payment links

links:delete

Delete payment links

stats:read

Access analytics and statistics

Best Practice

Use this endpoint to monitor your API usage and ensure you're staying within rate limits. Check your remaining monthly link quota before creating bulk payment links.

Code Examples

Ready-to-use code examples in multiple programming languages for all API endpoints.

Node.js / JavaScript

JAVASCRIPT
const axios = require('axios');

class SnipURLAPI {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseURL = 'https://snipurl.org/api/v1';
    this.headers = {
      'X-API-Key': apiKey,
      'Content-Type': 'application/json'
    };
  }

  async createPaymentLink(amount, description) {
    try {
      const response = await axios.post(`${this.baseURL}/links`, {
        amount,
        description
      }, { headers: this.headers });
      
      return response.data;
    } catch (error) {
      throw new Error(`API Error: ${error.response?.data?.error || error.message}`);
    }
  }

  async getLinks(status = null) {
    try {
      const url = status ? `${this.baseURL}/links?status=${status}` : `${this.baseURL}/links`;
      const response = await axios.get(url, { headers: this.headers });
      return response.data;
    } catch (error) {
      throw new Error(`API Error: ${error.response?.data?.error || error.message}`);
    }
  }

  async getLinkById(id) {
    try {
      const response = await axios.get(`${this.baseURL}/links/${id}`, { headers: this.headers });
      return response.data;
    } catch (error) {
      throw new Error(`API Error: ${error.response?.data?.error || error.message}`);
    }
  }

  async deleteLink(id) {
    try {
      const response = await axios.delete(`${this.baseURL}/links/${id}`, { headers: this.headers });
      return response.data;
    } catch (error) {
      throw new Error(`API Error: ${error.response?.data?.error || error.message}`);
    }
  }

  async getStatistics() {
    try {
      const response = await axios.get(`${this.baseURL}/links/stats`, { headers: this.headers });
      return response.data;
    } catch (error) {
      throw new Error(`API Error: ${error.response?.data?.error || error.message}`);
    }
  }

  async getApiKeyInfo() {
    try {
      const response = await axios.get(`${this.baseURL}/key/info`, { headers: this.headers });
      return response.data;
    } catch (error) {
      throw new Error(`API Error: ${error.response?.data?.error || error.message}`);
    }
  }
}

// Usage Examples
async function examples() {
  const api = new SnipURLAPI('your_api_key_here');
  
  try {
    // Create a payment link
    const link = await api.createPaymentLink(2100, 'Bitcoin book purchase');
    console.log('Payment URL:', link.data.url);
    
    // Get all links
    const allLinks = await api.getLinks();
    console.log('Total links:', allLinks.data.length);
    
    // Get only active links
    const activeLinks = await api.getLinks('active');
    console.log('Active links:', activeLinks.data.length);
    
    // Get specific link
    const specificLink = await api.getLinkById('abc123def456');
    console.log('Link status:', specificLink.data.status);
    
    // Get statistics
    const stats = await api.getStatistics();
    console.log('Total earnings:', stats.data.total_amount, 'sats');
    
    // Get API key info
    const keyInfo = await api.getApiKeyInfo();
    console.log('Rate limit remaining:', keyInfo.data.rate_limit.remaining);
    
  } catch (error) {
    console.error('Error:', error.message);
  }
}

examples();

Python

PYTHON
import requests
from typing import Optional, Dict, Any

class SnipURLAPI:
    def __init__(self, api_key: str):
        self.api_key = api_key
        self.base_url = "https://snipurl.org/api/v1"
        self.headers = {
            "X-API-Key": api_key,
            "Content-Type": "application/json"
        }
    
    def _handle_response(self, response: requests.Response) -> Dict[str, Any]:
        """Handle API response and raise exceptions for errors."""
        if response.status_code >= 400:
            try:
                error_data = response.json()
                raise Exception(f"API Error: {error_data.get('error', 'Unknown error')}")
            except ValueError:
                raise Exception(f"HTTP Error: {response.status_code}")
        
        return response.json()
    
    def create_payment_link(self, amount: int, description: str) -> Dict[str, Any]:
        """Create a new payment link."""
        response = requests.post(
            f"{self.base_url}/links",
            json={"amount": amount, "description": description},
            headers=self.headers
        )
        return self._handle_response(response)
    
    def get_links(self, status: Optional[str] = None) -> Dict[str, Any]:
        """Get all payment links, optionally filtered by status."""
        url = f"{self.base_url}/links"
        if status:
            url += f"?status={status}"
        
        response = requests.get(url, headers=self.headers)
        return self._handle_response(response)
    
    def get_link_by_id(self, link_id: str) -> Dict[str, Any]:
        """Get a specific payment link by ID."""
        response = requests.get(
            f"{self.base_url}/links/{link_id}",
            headers=self.headers
        )
        return self._handle_response(response)
    
    def delete_link(self, link_id: str) -> Dict[str, Any]:
        """Delete a payment link."""
        response = requests.delete(
            f"{self.base_url}/links/{link_id}",
            headers=self.headers
        )
        return self._handle_response(response)
    
    def get_statistics(self) -> Dict[str, Any]:
        """Get aggregated statistics for all payment links."""
        response = requests.get(
            f"{self.base_url}/links/stats",
            headers=self.headers
        )
        return self._handle_response(response)
    
    def get_api_key_info(self) -> Dict[str, Any]:
        """Get information about the API key."""
        response = requests.get(
            f"{self.base_url}/key/info",
            headers=self.headers
        )
        return self._handle_response(response)

# Usage Examples
if __name__ == "__main__":
    api = SnipURLAPI("your_api_key_here")
    
    try:
        # Create a payment link
        link_result = api.create_payment_link(5000, "Digital product purchase")
        if link_result["success"]:
            print(f"Payment URL: {link_result['data']['url']}")
            link_id = link_result['data']['id']
        
        # Get all active links
        active_links = api.get_links("active")
        print(f"Active links: {len(active_links['data'])}")
        
        # Get specific link details
        if 'link_id' in locals():
            link_details = api.get_link_by_id(link_id)
            print(f"Link status: {link_details['data']['status']}")
        
        # Get statistics
        stats = api.get_statistics()
        print(f"Total earnings: {stats['data']['total_amount']} sats")
        print(f"Total links: {stats['data']['total_links']}")
        
        # Get API key information
        key_info = api.get_api_key_info()
        rate_limit = key_info['data']['rate_limit']
        print(f"Rate limit: {rate_limit['remaining']}/{rate_limit['limit']}")
        
    except Exception as e:
        print(f"Error: {e}")

PHP

PHP
Error: cURL Error: Could not resolve host: snipurl.org

cURL / Command Line

Create Payment Link

CURL
curl -X POST https://snipurl.org/api/v1/links \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{
    "amount": 1000,
    "description": "Coffee Payment"
  }'

Get All Links

CURL
curl -H "X-API-Key: your_api_key_here" \
  https://snipurl.org/api/v1/links

Get Statistics

CURL
curl -H "X-API-Key: your_api_key_here" \
  https://snipurl.org/api/v1/links/stats

Delete Link

CURL
curl -X DELETE \
  -H "X-API-Key: your_api_key_here" \
  https://snipurl.org/api/v1/links/abc123def456

Go (Golang)

GO
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

type SnipURLAPI struct {
    apiKey  string
    baseURL string
    client  *http.Client
}

type CreateLinkRequest struct {
    Amount      int    `json:"amount"`
    Description string `json:"description"`
}

type APIResponse struct {
    Success bool        `json:"success"`
    Data    interface{} `json:"data,omitempty"`
    Error   string      `json:"error,omitempty"`
    Message string      `json:"message,omitempty"`
}

func NewSnipURLAPI(apiKey string) *SnipURLAPI {
    return &SnipURLAPI{
        apiKey:  apiKey,
        baseURL: "https://snipurl.org/api/v1",
        client:  &http.Client{},
    }
}

func (s *SnipURLAPI) makeRequest(method, endpoint string, body interface{}) (*APIResponse, error) {
    url := s.baseURL + endpoint
    
    var reqBody io.Reader
    if body != nil {
        jsonData, err := json.Marshal(body)
        if err != nil {
            return nil, err
        }
        reqBody = bytes.NewBuffer(jsonData)
    }
    
    req, err := http.NewRequest(method, url, reqBody)
    if err != nil {
        return nil, err
    }
    
    req.Header.Set("X-API-Key", s.apiKey)
    req.Header.Set("Content-Type", "application/json")
    
    resp, err := s.client.Do(req)
    if err != nil {
        return nil, err
    }
    defer resp.Body.Close()
    
    var apiResp APIResponse
    if err := json.NewDecoder(resp.Body).Decode(&apiResp); err != nil {
        return nil, err
    }
    
    return &apiResp, nil
}

func (s *SnipURLAPI) CreatePaymentLink(amount int, description string) (*APIResponse, error) {
    return s.makeRequest("POST", "/links", CreateLinkRequest{
        Amount:      amount,
        Description: description,
    })
}

func (s *SnipURLAPI) GetLinks() (*APIResponse, error) {
    return s.makeRequest("GET", "/links", nil)
}

func (s *SnipURLAPI) GetStatistics() (*APIResponse, error) {
    return s.makeRequest("GET", "/links/stats", nil)
}

func main() {
    api := NewSnipURLAPI("your_api_key_here")
    
    // Create a payment link
    result, err := api.CreatePaymentLink(2100, "Bitcoin book purchase")
    if err != nil {
        fmt.Printf("Error: %v\n", err)
        return
    }
    
    if result.Success {
        fmt.Printf("Payment link created successfully\n")
        fmt.Printf("Response: %+v\n", result.Data)
    } else {
        fmt.Printf("API Error: %s\n", result.Error)
    }
    
    // Get statistics
    stats, err := api.GetStatistics()
    if err != nil {
        fmt.Printf("Error getting stats: %v\n", err)
        return
    }
    
    fmt.Printf("Statistics: %+v\n", stats.Data)
}

Error Handling

Learn how to handle API errors and status codes properly.

Error handling documentation content...

Best Practices

Guidelines for optimal API usage and integration.

Best practices documentation content...