Skip to main content

List All Protocols

GET /protocols Retrieve a list of all supported DeFi protocols.

Request

curl "https://api.darex.com/api/v1/protocols"

Query Parameters

ParameterTypeRequiredDescription
chainIdnumberNoFilter by chain ID

Response

[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Aave",
    "version": 3,
    "displayName": "Aave V3",
    "chainId": 8453,
    "protocolAddress": "0x...",
    "icon": "aave",
    "docsUrl": "https://docs.aave.com",
    "deprecated": false,
    "deprecationReason": null,
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-15T14:30:00Z"
  },
  {
    "id": "550e8400-e29b-41d4-a716-446655440001",
    "name": "Compound",
    "version": 3,
    "displayName": "Compound V3",
    "chainId": 8453,
    "protocolAddress": "0x...",
    "icon": "compound",
    "docsUrl": "https://docs.compound.finance",
    "deprecated": false,
    "deprecationReason": null,
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-15T14:30:00Z"
  },
  {
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "name": "Morpho",
    "version": 1,
    "displayName": "Morpho Blue",
    "chainId": 8453,
    "protocolAddress": "0x...",
    "icon": "morpho",
    "docsUrl": "https://docs.morpho.org",
    "deprecated": false,
    "deprecationReason": null,
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-15T14:30:00Z"
  }
]

Response Fields

FieldTypeDescription
idstringUnique protocol identifier (UUID)
namestringProtocol name (Aave, Compound, Morpho, Moonwell)
versionnumberProtocol version number
displayNamestringHuman-readable protocol name with version
chainIdnumberChain ID where this protocol is deployed
protocolAddressstringMain protocol contract address
iconstringIcon identifier for UI display
docsUrlstringLink to protocol documentation
deprecatedbooleanWhether this protocol version is deprecated
deprecationReasonstringReason for deprecation (if applicable)
createdAtstringISO 8601 creation timestamp
updatedAtstringISO 8601 last update timestamp

Get Single Protocol

GET /protocols/:id Retrieve details for a specific protocol.

Request

curl "https://api.darex.com/api/v1/protocols/550e8400-e29b-41d4-a716-446655440000"

Path Parameters

ParameterTypeRequiredDescription
idstringYesThe protocol UUID

Response

Same structure as individual items in List All Protocols.

Get Protocol by Name and Chain

GET /protocols/by-name/:name/chain/:chainId Retrieve all versions of a protocol on a specific chain.

Request

curl "https://api.darex.com/api/v1/protocols/by-name/Aave/chain/8453"

Path Parameters

ParameterTypeRequiredDescription
namestringYesProtocol name (Aave, Compound, Morpho, Moonwell)
chainIdnumberYesChain ID

Response

[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Aave",
    "version": 3,
    "displayName": "Aave V3",
    "chainId": 8453,
    "protocolAddress": "0x...",
    "icon": "aave",
    "docsUrl": "https://docs.aave.com",
    "deprecated": false,
    "deprecationReason": null,
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-15T14:30:00Z"
  }
]

Get Latest Protocol Version

GET /protocols/by-name/:name/chain/:chainId/latest Retrieve the latest version of a protocol on a specific chain.

Request

curl "https://api.darex.com/api/v1/protocols/by-name/Aave/chain/8453/latest"

Path Parameters

ParameterTypeRequiredDescription
namestringYesProtocol name
chainIdnumberYesChain ID

Response

Same structure as individual items in List All Protocols.

TypeScript Example

const BASE_URL = 'https://api.darex.com/api/v1';

interface Protocol {
  id: string;
  name: string;
  version: number;
  displayName: string;
  chainId: number;
  protocolAddress: string;
  icon?: string;
  docsUrl?: string;
  deprecated: boolean;
  deprecationReason?: string;
  createdAt: string;
  updatedAt: string;
}

// Get all protocols
async function getProtocols(chainId?: number): Promise<Protocol[]> {
  const params = chainId ? `?chainId=${chainId}` : '';
  const response = await fetch(`${BASE_URL}/protocols${params}`);
  return response.json();
}

// Get protocol by ID
async function getProtocol(id: string): Promise<Protocol> {
  const response = await fetch(`${BASE_URL}/protocols/${id}`);
  return response.json();
}

// Get latest protocol version
async function getLatestProtocol(
  name: string,
  chainId: number
): Promise<Protocol> {
  const response = await fetch(
    `${BASE_URL}/protocols/by-name/${name}/chain/${chainId}/latest`
  );
  return response.json();
}

// Usage
const protocols = await getProtocols(8453);
console.log(`Found ${protocols.length} protocols on Base`);

protocols.forEach((p) => {
  console.log(`${p.displayName}: ${p.protocolAddress}`);
  if (p.deprecated) {
    console.log(`  ⚠️ Deprecated: ${p.deprecationReason}`);
  }
});

Next Steps