PRIV ProtocolPRIV Docs
API Reference

DataXchange API

Programmatic access to the PRIV Protocol data marketplace for buying and selling datasets.

Programmatic access to the data marketplace.

List Datasets

GET/dataxchange/datasets

Browse available datasets.

Parameters

ParameterTypeDescription
categorystringFilter by category
minPricestringMinimum price (PRIV)
maxPricestringMaximum price (PRIV)
sortBystringprice, dataPoints, created
orderstringasc or desc
limitnumberResults per page
cursorstringPagination cursor

Response

{
  "success": true,
  "data": {
    "datasets": [
      {
        "id": "ds_abc123",
        "title": "DeFi Trading Data - January 2024",
        "description": "Swap activity from major DEXs",
        "category": "defi",
        "price": "100",
        "priceUsd": "30.00",
        "dataPoints": 50000,
        "seller": "0x742d...1234",
        "rating": 4.8,
        "purchases": 12,
        "createdAt": "2024-02-01T00:00:00Z"
      }
    ],
    "cursor": "next_cursor",
    "hasMore": true
  }
}

Example

curl "https://api.priv.io/v1/dataxchange/datasets?category=defi&maxPrice=500&limit=20" \
  -H "Authorization: Bearer pk_live_xxx"

Get Dataset

GET/dataxchange/datasets/:id

Get detailed dataset information.

Response

{
  "success": true,
  "data": {
    "id": "ds_abc123",
    "title": "DeFi Trading Data - January 2024",
    "description": "Comprehensive swap data from Uniswap, Aave, and more",
    "category": "defi",
    "price": "100",
    "dataPoints": 50000,
    "timeRange": {
      "start": "2024-01-01",
      "end": "2024-01-31"
    },
    "schema": {
      "fields": ["timestamp", "event", "tokens", "amounts", "user_hash"],
      "types": ["datetime", "string", "array", "array", "string"]
    },
    "sample": [
      {
        "timestamp": "2024-01-15T10:30:00Z",
        "event": "swap",
        "tokens": ["ETH", "USDC"],
        "amounts": ["1-2", "2000-3000"],
        "user_hash": "anon_abc123"
      }
    ],
    "seller": {
      "address": "0x742d...1234",
      "rating": 4.8,
      "totalSales": 25
    }
  }
}

Purchase Dataset

POST/dataxchange/purchase

Purchase access to a dataset.

Request

{
  "datasetId": "ds_abc123",
  "signature": "0x..."
}

The signature must be generated by signing a message with your wallet.

Response

{
  "success": true,
  "data": {
    "purchaseId": "pur_xyz789",
    "accessToken": "at_abc123",
    "transactionHash": "0x...",
    "downloadUrl": "https://api.priv.io/v1/dataxchange/download/pur_xyz789"
  }
}

Download

After purchase, download the dataset:

curl "https://api.priv.io/v1/dataxchange/download/pur_xyz789" \
  -H "Authorization: Bearer pk_live_xxx" \
  -o dataset.json

My Purchases

GET/dataxchange/purchases

List your purchased datasets.

Response

{
  "success": true,
  "data": {
    "purchases": [
      {
        "id": "pur_xyz789",
        "datasetId": "ds_abc123",
        "title": "DeFi Trading Data - January 2024",
        "price": "100",
        "purchasedAt": "2024-02-15T10:00:00Z",
        "downloadUrl": "https://api.priv.io/v1/dataxchange/download/pur_xyz789"
      }
    ]
  }
}

Categories

GET/dataxchange/categories

List available categories.

Response

{
  "success": true,
  "data": {
    "categories": [
      {
        "id": "defi",
        "name": "DeFi Trading",
        "description": "DEX swaps, lending, staking",
        "datasetCount": 150
      },
      {
        "id": "nft",
        "name": "NFT Activity",
        "description": "Mints, sales, bids",
        "datasetCount": 80
      }
    ]
  }
}

Seller Endpoints

List Dataset

POST/dataxchange/datasets

Create a new dataset listing.

{
  "title": "My Dataset",
  "description": "Description here",
  "category": "defi",
  "price": "100",
  "metadataUri": "ipfs://Qm...",
  "signature": "0x..."
}

Get Earnings

GET/dataxchange/earnings

View your earnings from dataset sales.

{
  "success": true,
  "data": {
    "total": "500",
    "pending": "100",
    "withdrawn": "400"
  }
}

Withdraw

POST/dataxchange/withdraw

Withdraw your earnings.

{
  "amount": "100",
  "signature": "0x..."
}