API Documentation

Integrate with Elusiv using our REST API and smart contracts

Overview

Elusiv provides REST API endpoints for accessing the Knowledge Vault and managing research completions. All protected endpoints require wallet signature authentication and NFT ownership verification. Note: API endpoints use "library" in their paths for historical reasons, but they access the Knowledge Vault.

API base URL: https://api.elusiv.ai (production) or http://localhost:3001 (development)

Authentication

Authentication Flow

All protected endpoints require wallet signature authentication:

1. Get Challenge

Request a signing challenge from GET /api/auth/challenge

2. Sign Message

User signs the challenge with their wallet (ethers.js, web3.js, etc.)

3. Send Signature

Include signature in Authorization: Signature <signature> header

4. Verification

API verifies signature and checks ElusivAccessPass NFT ownership

Signature Format

Example signature string:

Access Elusiv Knowledge Vault (library_access).1703123456789.abc123def456

Knowledge Vault API Endpoints

Public Endpoints

GET /health

Health check endpoint providing system status.

{ "status": "healthy", "timestamp": "...", "version": "1.0.0" }

GET /api/auth/challenge

Get a signing challenge for authentication.

Parameters: action (optional, default: "library_access")

Protected Endpoints (Require Authentication + NFT)

GET /api/library

Get Knowledge Vault metadata and document list.

Requires: Wallet signature + ElusivAccessPass NFT

GET /api/library/categories

Get available document categories.

GET /api/library/search

Search documents by query.

Parameters: q (required), category (optional)

GET /api/library/download/:filename

Download a PDF document.

Returns: PDF file stream

Research Completion API

Completion Endpoints

POST /api/research/complete/:requestId

Submit a research completion by uploading a document.

Body: FormData with PDF file

GET /api/research/completion/:requestId

Get completion details for a research request.

POST /api/research/approve/:requestId

Approve a submitted completion (requester only).

POST /api/research/reject/:requestId

Reject a submitted completion (requester only).

GET /api/research/pending-approvals

Get pending approvals for the authenticated user.

Smart Contract ABIs

Contract Addresses

Elusiv uses three main smart contracts:

ElusivAccessPass (ERC-721)

NFT contract for Access Pass membership. ABI available in frontend/src/lib/abis/ElusivAccessPass.json

ElusivToken (ERC-20)

Token contract for $ELUSIV. ABI available in frontend/src/lib/abis/ElusivToken.json

ElusivResearchDesk

Research request queue contract. ABI available in frontend/src/lib/abis/ElusivResearchDesk.json

Key Functions

requestResearch(string query)

Submit a research request to the Research Desk.

submitCompletion(uint256 requestId, string documentHash)

Submit a completion for a research request.

approveCompletion(uint256 requestId)

Approve a submitted completion.

Integration Examples

JavaScript/TypeScript Example

Basic Authentication Flow:
// 1. Get challenge
const challengeResponse = await fetch('/api/auth/challenge');
const { data: challenge } = await challengeResponse.json();
 
// 2. Sign with wallet
const provider = new ethers.BrowserProvider(window.ethereum);
const signer = await provider.getSigner();
const signature = await signer.signMessage(challenge.challenge);
 
// 3. Access protected endpoints
const headers = {
  'Authorization': `Signature ${signature}`
};
 
const libraryResponse = await fetch('/api/library', { headers });
const libraryData = await libraryResponse.json();

Error Handling

Common Error Codes

401 Unauthorized

Missing or invalid authentication signature.

403 Forbidden

User does not own an ElusivAccessPass NFT.

429 Rate Limited

Too many requests. Retry after the specified time.

503 Service Unavailable

NFT verification service temporarily unavailable.

Rate Limiting

Rate Limits

  • Authentication attempts: 10 per wallet/IP per 15 minutes
  • General requests: 100 per IP per 15 minutes
  • NFT verification: Cached for 5 minutes to reduce blockchain calls

Security Features

Signature Expiration

Signatures expire after 5 minutes for security.

Replay Protection

Nonce-based one-time signatures prevent replay attacks.

Path Traversal Protection

Secure file access prevents directory traversal attacks.

Ready to Integrate?

Start building with the Elusiv API.