> For the complete documentation index, see [llms.txt](https://docs.heyhal.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.heyhal.xyz/api-documentation/get-token-details.md).

# Get Token Details

**Endpoint:** <mark style="color:yellow;">`GET /api/v1/coin/details`</mark>

### Description

This endpoint retrieves detailed information about a specific token, including its metadata, comments, creator information, AI agent configuration, and price history (OHLC data).

### Authentication

Required: No

Type: None

### Request

#### Headers

#### Content-Type: application/json

#### Query Parameters

| Parameter | Type   | Required | Description                   |
| --------- | ------ | -------- | ----------------------------- |
| token     | string | Yes      | The mint address of the token |

Example Request:

GET /api/v1/coin/details?token=TokenMintAddress123...

### Response

#### Success Response

Status Code: 200 OK

Content-Type: application/json

interface TokenDetailsResponse {

&#x20; // Token Basic Info

&#x20; mintAddress: string;

&#x20; name: string;

&#x20; symbol: string;

&#x20; description: string;

&#x20; metaDataUrl: string;

&#x20; imageUrl: string;

&#x20; creatorWalletAddress: string;

&#x20; status: string;

&#x20;&#x20;

&#x20; // Token State

&#x20; tx: string | null;

&#x20; signature: string | null;

&#x20; migrationStatus: string | null;

&#x20; kingOfTheHillTimeStamp: string | null;

&#x20; marketCap: string | null;

&#x20;&#x20;

&#x20; // Timestamps

&#x20; createdAt: string;

&#x20; updatedAt: string;

&#x20;&#x20;

&#x20; // Related Entities

&#x20; comments: Array<{

&#x20;   id: number;

&#x20;   content: string;

&#x20;   createdAt: string;

&#x20;   updatedAt: string;

&#x20;   userId: string;

&#x20;   coinId: string;

&#x20; }>;

&#x20;&#x20;

&#x20; creator: {

&#x20;   walletAddress: string;

&#x20;   username: string;

&#x20;   role: string;

&#x20;   lastLogin: string;

&#x20; };

&#x20;&#x20;

&#x20; agent: {

&#x20;   id: number;

&#x20;   name: string;

&#x20;   description: string;

&#x20;   personality: string;

&#x20;   instruction: string;

&#x20;   knowledge: string;

&#x20;   points: number;

&#x20;   usedPoints: number;

&#x20;   telegramUrl: string;

&#x20;   twitterUrl: string;

&#x20;   websiteUrl: string;

&#x20;   createdAt: string;

&#x20;   updatedAt: string;

&#x20; } | null;

&#x20;&#x20;

&#x20; ohlc: Array<{

&#x20;   timestamp: string;

&#x20;   open: string;

&#x20;   high: string;

&#x20;   low: string;

&#x20;   close: string;

&#x20;   volume: string;

&#x20; }>;

}

#### Error Response

Status Code: 500 Internal Server Error

{

&#x20; "error": "An internal error occurred. Please try again later."

}

### Example Usage

### // Basic token details fetcher

### async function getTokenDetails(tokenMintAddress: string) {

### &#x20; try {

### &#x20;   const response = await fetch(

### &#x20;     \`<https://api.heyhal.xyz/api/v1/coin/details?token=${tokenMintAddress}\\`>

### &#x20;   );

### &#x20;  &#x20;

### &#x20;   if (!response.ok) {

### &#x20;     throw new Error(\`HTTP error! status: ${response.status}\`);

### &#x20;   }

### &#x20;  &#x20;

### &#x20;   const tokenDetails = await response.json();

### &#x20;   return tokenDetails;

### &#x20; } catch (error) {

### &#x20;   console.error('Error fetching token details:', error);

### &#x20;   throw error;

### &#x20; }

### }

### // Token Details Manager with caching

### class TokenDetailsManager {

### &#x20; private cache: Map\<string, {

### &#x20;   data: TokenDetailsResponse;

### &#x20;   timestamp: number;

### &#x20; }> = new Map();

### &#x20;&#x20;

### &#x20; private readonly CACHE\_DURATION = 30000; // 30 seconds

### &#x20;&#x20;

### &#x20; async getDetails(tokenMintAddress: string): Promise\<TokenDetailsResponse> {

### &#x20;   // Check cache

### &#x20;   const cached = this.cache.get(tokenMintAddress);

### &#x20;   if (cached && Date.now() - cached.timestamp < this.CACHE\_DURATION) {

### &#x20;     return cached.data;

### &#x20;   }

### &#x20;  &#x20;

### &#x20;   // Fetch fresh data

### &#x20;   const details = await getTokenDetails(tokenMintAddress);

### &#x20;  &#x20;

### &#x20;   // Update cache

### &#x20;   this.cache.set(tokenMintAddress, {

### &#x20;     data: details,

### &#x20;     timestamp: Date.now()

### &#x20;   });

### &#x20;  &#x20;

### &#x20;   return details;

### &#x20; }

### &#x20;&#x20;

### &#x20; clearCache(tokenMintAddress?: string) {

### &#x20;   if (tokenMintAddress) {

### &#x20;     this.cache.delete(tokenMintAddress);

### &#x20;   } else {

### &#x20;     this.cache.clear();

### &#x20;   }

### &#x20; }

### }

### Implementation Notes

1\. Data Processing Utilities

// Token status helper

function getTokenStatus(details: TokenDetailsResponse) {

&#x20; if (details.migrationStatus === 'completed') {

&#x20;   return 'MIGRATED';

&#x20; }

&#x20; if (details.kingOfTheHillTimeStamp) {

&#x20;   return 'KING\_OF\_HILL';

&#x20; }

&#x20; if (details.status === 'success') {

&#x20;   return 'ACTIVE';

&#x20; }

&#x20; return 'PENDING';

}

// Price history formatter

function formatPriceHistory(details: TokenDetailsResponse) {

&#x20; return details.ohlc.map(candle => ({

&#x20;   timestamp: new Date(candle.timestamp).getTime(),

&#x20;   open: parseFloat(candle.open),

&#x20;   high: parseFloat(candle.high),

&#x20;   low: parseFloat(candle.low),

&#x20;   close: parseFloat(candle.close),

&#x20;   volume: parseFloat(candle.volume)

&#x20; }));

}

// Social links aggregator

function getSocialLinks(details: TokenDetailsResponse) {

&#x20; return {

&#x20;   telegram: details.agent?.telegramUrl || null,

&#x20;   twitter: details.agent?.twitterUrl || null,

&#x20;   website: details.agent?.websiteUrl || null

&#x20; };

}

Data Display Components

// React component example

interface TokenInfoProps {

&#x20; tokenMintAddress: string;

}

function TokenInfo({ tokenMintAddress }: TokenInfoProps) {

&#x20; const \[details, setDetails] = useState\<TokenDetailsResponse | null>(null);

&#x20; const \[loading, setLoading] = useState(true);

&#x20; const \[error, setError] = useState\<string | null>(null);

&#x20;&#x20;

&#x20; useEffect(() => {

&#x20;   async function fetchDetails() {

&#x20;     try {

&#x20;       const data = await getTokenDetails(tokenMintAddress);

&#x20;       setDetails(data);

&#x20;     } catch (err) {

&#x20;       setError(err.message);

&#x20;     } finally {

&#x20;       setLoading(false);

&#x20;     }

&#x20;   }

&#x20;  &#x20;

&#x20;   fetchDetails();

&#x20; }, \[tokenMintAddress]);

&#x20;&#x20;

&#x20; if (loading) return \<div>Loading...\</div>;

&#x20; if (error) return \<div>Error: {error}\</div>;

&#x20; if (!details) return \<div>No data found\</div>;

&#x20;&#x20;

&#x20; return (

&#x20;   \<div>

&#x20;     \<h1>{details.name} ({details.symbol})\</h1>

&#x20;     \<img src={details.imageUrl} alt={details.name} />

&#x20;     \<p>{details.description}\</p>

&#x20;    &#x20;

&#x20;     \<h2>Market Data\</h2>

&#x20;     \<p>Market Cap: {details.marketCap || 'N/A'}\</p>

&#x20;    &#x20;

&#x20;     \<h2>Comments ({details.comments.length})\</h2>

&#x20;     {details.comments.map(comment => (

&#x20;       \<div key={comment.id}>

&#x20;         \<p>{comment.content}\</p>

&#x20;         \<small>

&#x20;           Posted on {new Date(comment.createdAt).toLocaleDateString()}

&#x20;         \</small>

&#x20;       \</div>

&#x20;     ))}

&#x20;    &#x20;

&#x20;     {details.agent && (

&#x20;       \<h2>AI Agent\</h2>

&#x20;       \<p>Name: {details.agent.name}\</p>

&#x20;       \<p>Description: {details.agent.description}\</p>

&#x20;       \<p>Points: {details.agent.points - details.agent.usedPoints}\</p>

&#x20;     )}

&#x20;   \</div>

&#x20; );

}

Real-time Updates

class TokenDetailsWatcher {

&#x20; private ws: WebSocket | null = null;

&#x20; private listeners: Set<(details: TokenDetailsResponse) => void> = new Set();

&#x20;&#x20;

&#x20; constructor(private tokenMintAddress: string) {}

&#x20;&#x20;

&#x20; connect() {

&#x20;   this.ws = new WebSocket('wss\://api.heyhal.xyz/ws');

&#x20;  &#x20;

&#x20;   this.ws.onopen = () => {

&#x20;     this.ws?.send(JSON.stringify({

&#x20;       type: 'subscribe',

&#x20;       token: this.tokenMintAddress

&#x20;     }));

&#x20;   };

&#x20;  &#x20;

&#x20;   this.ws.onmessage = (event) => {

&#x20;     const data = JSON.parse(event.data);

&#x20;     this.notifyListeners(data);

&#x20;   };

&#x20; }

&#x20;&#x20;

&#x20; addListener(callback: (details: TokenDetailsResponse) => void) {

&#x20;   this.listeners.add(callback);

&#x20; }

&#x20;&#x20;

&#x20; removeListener(callback: (details: TokenDetailsResponse) => void) {

&#x20;   this.listeners.delete(callback);

&#x20; }

&#x20;&#x20;

&#x20; private notifyListeners(data: TokenDetailsResponse) {

&#x20;   this.listeners.forEach(listener => listener(data));

&#x20; }

&#x20;&#x20;

&#x20; disconnect() {

&#x20;   this.ws?.close();

&#x20;   this.ws = null;

&#x20; }

}

<br>
