API Reference

All API endpoints require the nodejs runtime. BigInt values are serialized as strings for JSON compatibility.

List Press Releases

GET/api/prs

Returns a paginated list of press releases with optional filters.

Query Parameters

ParamTypeDefaultDescription
categorystringFilter by category (e.g. Technology, DeFi)
statestringFilter by state: PendingCuration, Approved, Flagged, Rejected
sortstringnewestSort order: newest, oldest, quality
pagenumber1Page number (1-indexed)
limitnumber20Results per page (max 100)

Example Request

bash
curl "http://localhost:3000/api/prs?category=Technology&state=Approved&sort=newest&page=1&limit=10"

Example Response

json
{
  "prs": [
    {
      "id": 1,
      "onChainId": "1",
      "submitter": "0x1234...5678",
      "title": "ChainPress Launches on Avalanche",
      "category": "Technology",
      "tags": ["blockchain", "press-release"],
      "tier": "Premium",
      "state": "Approved",
      "qualityScore": 85,
      "createdAt": "2026-05-22T12:00:00.000Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 42,
    "totalPages": 5
  }
}

Get Press Release

GET/api/prs/:id

Returns a single press release by on-chain ID. Excludes Removed PRs.

Path Parameters

ParamTypeDescription
idstring (digits)On-chain press release ID (BigInt)

Example Request

bash
curl "http://localhost:3000/api/prs/1"

Example Response

json
{
  "id": 1,
  "onChainId": "1",
  "submitter": "0x1234...5678",
  "title": "ChainPress Launches on Avalanche",
  "category": "Technology",
  "tags": ["blockchain", "press-release"],
  "content": "## Press Release\n\nChainPress is live...",
  "contentHash": "0xabc...",
  "arweaveTxId": "abc123...",
  "tier": "Premium",
  "state": "Approved",
  "qualityScore": 85,
  "createdAt": "2026-05-22T12:00:00.000Z",
  "updatedAt": "2026-05-22T14:00:00.000Z"
}

List Curators

GET/api/curators

Returns a paginated list of curators with optional state filter.

Query Parameters

ParamTypeDefaultDescription
statestringFilter: Pending, Active, Slashed, Inactive
pagenumber1Page number
limitnumber20Results per page

Example Request

bash
curl "http://localhost:3000/api/curators?state=Active&page=1&limit=20"

Example Response

json
{
  "curators": [
    {
      "address": "0x1234...5678",
      "stake": "500000000000000000000",
      "reputation": 15,
      "state": "Active",
      "rewardPool": "0",
      "createdAt": "2026-05-22T12:00:00.000Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 5,
    "totalPages": 1
  }
}

Create Curator

POST/api/curators

Create or update a curator record. Requires x-api-key header.

Request Body

FieldTypeDescription
addressstring (hex)Ethereum address of the curator

Example Request

bash
curl -X POST "http://localhost:3000/api/curators" \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-sync-api-key" \
  -d '{"address": "0x1234...5678"}'

Upload to Arweave

POST/api/upload

Upload press release content to Arweave via Irys. Returns the Arweave transaction ID.

Request Body

FieldTypeDescription
contentstringPress release content (1-50000 chars)

Example Request

bash
curl -X POST "http://localhost:3000/api/upload" \
  -H "Content-Type: application/json" \
  -d '{"content": "## My Press Release\n\nContent here..."}'

Example Response

json
{
  "arweaveTxId": "abc123def456..."
}

Sync On-Chain Events

POST/api/sync

Sync on-chain events to the database. Requires x-api-key header authentication. Increments the last indexed block number.

Example Request

bash
curl -X POST "http://localhost:3000/api/sync" \
  -H "x-api-key: your-sync-api-key"

Example Response

json
{
  "success": true,
  "lastBlock": "42"
}

Health Check

GET/api/health

System health check. Returns database connectivity status and contract addresses.

Example Request

bash
curl "http://localhost:3000/api/health"

Example Response

json
{
  "status": "ok",
  "database": "connected",
  "contracts": {
    "NewsToken": "0xA2E099aCBCf1b85fA4D21dbfa5083fe65B83F9Ad",
    "PRSubmission": "0x575731b0f3DA45fA9F0de75e886700DDcf440276",
    "CurationEngine": "0x3f1264C0a6AFb286DA39F082D7241944d9F96cCc",
    "Treasury": "0xd726D7a7eDB6eB049b2B2211A0f6506DF5A43327"
  }
}