cURL Examples

Ready-to-run commands for every endpoint. Replace fxd_your_key_here with your actual API key.

Set Variables

export API_KEY="fxd_your_key_here"
export BASE="https://api.pipdata.net"

Config

# No API key required
curl -s "$BASE/v1/config" | python3 -m json.tool

Symbols

# List first 10 symbols
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/symbols?limit=10" | python3 -m json.tool

# Search for symbols containing "USD"
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/symbols?search=USD" | python3 -m json.tool

# Search for crypto symbols
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/symbols?search=BTC" | python3 -m json.tool

# Get full metadata for a specific symbol
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/symbols?symbol=WMMARKETS:ZERO:EURUSD" | python3 -m json.tool

Historical Data

# Last 100 H1 bars for EUR/USD
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/history?symbol=WMMARKETS:ZERO:EURUSD&resolution=60&countback=100" \
  | python3 -m json.tool

# Last 50 M1 bars
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/history?symbol=WMMARKETS:ZERO:EURUSD&resolution=1&countback=50" \
  | python3 -m json.tool

# Last 365 Daily bars for Gold
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/history?symbol=WMMARKETS:ZERO:XAUUSD&resolution=1D&countback=365" \
  | python3 -m json.tool

# H4 bars for Bitcoin
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/history?symbol=WMMARKETS:ZERO:BTCUSD&resolution=240&countback=200" \
  | python3 -m json.tool

# Specific time range (Unix timestamps)
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/history?symbol=WMMARKETS:ZERO:EURUSD&resolution=60&from=1740960000&to=1749600000" \
  | python3 -m json.tool

# Latest single M1 bar (current price)
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/history?symbol=WMMARKETS:ZERO:BTCUSD&resolution=1&countback=1" \
  | python3 -c "import sys,json; d=json.load(sys.stdin); print(f\"BTC/USD: {d['c'][-1]}\" if d['s']=='ok' else 'no data')"

Data Coverage

# Check coverage for a single symbol
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/coverage?symbol=WMMARKETS:ZERO:EURUSD" | python3 -m json.tool

# Coverage for all accessible symbols
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/coverage" | python3 -m json.tool

Service Status

# Full status response
curl -s -H "X-API-Key: $API_KEY" "$BASE/v1/status" | python3 -m json.tool

# Just the overall status
curl -s -H "X-API-Key: $API_KEY" "$BASE/v1/status" \
  | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['status'])"

Usage Statistics

# Last 7 days (default)
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/usage" | python3 -m json.tool

# Last 30 days
curl -s -H "X-API-Key: $API_KEY" \
  "$BASE/v1/usage?days=30" | python3 -m json.tool

Alternative Auth Methods

# Authorization Bearer header
curl -s -H "Authorization: Bearer $API_KEY" \
  "$BASE/v1/symbols?limit=5"

# Query parameter
curl -s "$BASE/v1/symbols?limit=5&api_key=$API_KEY"

Inspect Rate-Limit Headers

curl -sv -H "X-API-Key: $API_KEY" \
  "$BASE/v1/symbols?limit=1" 2>&1 \
  | grep -i "x-ratelimit"

Example output:

< X-RateLimit-Limit-Minute: 120
< X-RateLimit-Remaining-Minute: 119
< X-RateLimit-Reset-Minute: 1749600060
< X-RateLimit-Limit-Day: 50000
< X-RateLimit-Remaining-Day: 49999

Shell Script — Latest Prices

#!/bin/bash
# latest_prices.sh — print the most recent close price for a list of symbols

API_KEY="fxd_your_key_here"
BASE="https://api.pipdata.net"

SYMBOLS=("EURUSD" "GBPUSD" "USDJPY" "XAUUSD" "BTCUSD" "US30")

for sym in "${SYMBOLS[@]}"; do
    FULL="WMMARKETS:ZERO:$sym"
    CLOSE=$(curl -s -H "X-API-Key: $API_KEY" \
        "$BASE/v1/history?symbol=$FULL&resolution=1&countback=1" \
        | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['c'][-1] if d['s']=='ok' else 'N/A')")
    printf "%-10s = %s\n" "$sym" "$CLOSE"
done

Example output:

EURUSD     = 1.08228
GBPUSD     = 1.27341
USDJPY     = 154.823
XAUUSD     = 2315.42
BTCUSD     = 67450.30
US30       = 38921.00