> 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-all-coins.md).

# Get All Coins

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

**Description**

This endpoint retrieves a comprehensive list of all tokens created on the platform, including their associated comments, creator information, and AI agent details. The data is returned in a structured format with related entities nested within each token object.

**Authentication Required:** No

**Type:** None

**Request Headers**

Content-Type: application/json

**Parameters**

None (no query parameters required)

### Response

Success Response

Status Code: 200 OK

Content-Type: application/json

type Response = Array<{

&#x20;\
// Token Information

&#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; tx: string | null;

&#x20; signature: string | null;

&#x20; migrationStatus: string | null;

&#x20; kingOfTheHillTimeStamp: string | null;

&#x20; marketCap: string | null;

&#x20; createdAt: string;

&#x20; updatedAt: string;

&#x20;&#x20;

&#x20; // Related Entities

&#x20; comments: Array<{

&#x20;   id: number;

&#x20;   content: string;

&#x20;   createdAt: string;

&#x20;   user: {

&#x20;     walletAddress: string;

&#x20;     username: string;

&#x20;     role: string;

&#x20;   }

&#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;   agentId: string;

&#x20;   name: string;

&#x20;   description: string;

&#x20;   personality: string;

&#x20;   instruction: string;

&#x20;   knowledge: string;

&#x20;   points: number;

&#x20;   usedPoints: number;

&#x20;   ownerWalletAddress: string;

&#x20;   telegramUrl: string;

&#x20;   twitterUrl: string;

&#x20;   websiteUrl: string;

&#x20;   createdAt: string;

&#x20;   updatedAt: string;

&#x20;   deletedAt: string | null;

&#x20; } | null;

}>

**Error Response**

Status Code: 500 Internal Server Error

`{`

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

`}`

**Example Usage**

`async function getAllCoins() {`

&#x20; `try {`

&#x20;   `const response = await fetch('https://api.heyhal.xyz/api/v1/coin/all');`

&#x20;  &#x20;

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

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

&#x20;   `}`

&#x20;  &#x20;

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

&#x20;   `return coins;`

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

&#x20;   `console.error('Error fetching coins:', error);`

&#x20;   `throw error;`

&#x20; `}`

`}`

<br>

// Example usage with filtering and display

`async function displayActiveCoins() {`

&#x20; `try {`

&#x20;   `const allCoins = await getAllCoins();`

&#x20;  &#x20;

&#x20;   // Filter for active coins

&#x20;   `const activeCoins = allCoins.filter(coin =>`&#x20;

&#x20;     `coin.status === 'success' && !coin.migrationStatus`

&#x20;   `);`

&#x20;  &#x20;

&#x20;   // Sort by market cap

&#x20;   `const sortedCoins = activeCoins.sort((a, b) =>`&#x20;

&#x20;     `Number(b.marketCap || 0) - Number(a.marketCap || 0)`

&#x20;   `);`

&#x20;  &#x20;

&#x20;   // Process and display

&#x20;   `sortedCoins.forEach(coin => {`

&#x20;     `` console.log(` ``

&#x20;       `Token: ${coin.name} (${coin.symbol})`

&#x20;       `Market Cap: ${coin.marketCap || 'N/A'}`

&#x20;       `Creator: ${coin.creator.username || coin.creator.walletAddress}`

&#x20;       `Comments: ${coin.comments.length}`

&#x20;       `AI Agent: ${coin.agent ? 'Enabled' : 'Disabled'}`

&#x20;     `` `); ``

&#x20;   `});`

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

&#x20;   `console.error('Error processing coins:', error);`

&#x20; `}`

`}`

<br>

## Implementation Notes

**Data Structure**

The response includes nested relationships for comments, creator, and agent

Sensitive information (like telegramToken) is excluded from the agent data

All timestamps are returned in ISO 8601 format<br>

**Performance Considerations**

The endpoint retrieves all coins and their relationships in a single query

Consider implementing pagination if the dataset grows large (under progress)

Response is cached at the database level for optimal performance<br>

**Null Handling**

Several fields can be null (tx, signature, migrationStatus, etc.)

The agent object itself can be null if no AI agent is associated

Implement proper null checks in your frontend code

**Related Fields**

comments includes the user who made the comment

creator includes basic user information

agent includes AI configuration but excludes sensitive data

### Common Use Cases

**Token Directory**

`const tokens = await getAllCoins();`

`const directory = tokens.map(token => ({`

&#x20; `name: token.name,`

&#x20; `symbol: token.symbol,`

&#x20; `marketCap: token.marketCap,`

&#x20; `status: token.status,`

&#x20; `creatorName: token.creator.username`

`}));`<br>

**Social Activity Metrics**

`const tokens = await getAllCoins();`

`const socialMetrics = tokens.map(token => ({`

&#x20; `symbol: token.symbol,`

&#x20; `commentCount: token.comments.length,`

&#x20; `hasAgent: !!token.agent,`

&#x20; `socialLinks: {`

&#x20;   `telegram: token.agent?.telegramUrl,`

&#x20;   `twitter: token.agent?.twitterUrl,`

&#x20;   `website: token.agent?.websiteUrl`

&#x20; `}`

`}));`

**Migration Status Tracking**

`const tokens = await getAllCoins();`

`const migrationStatus = tokens.reduce((acc, token) => {`

&#x20; `acc[token.mintAddress] = {`

&#x20;   `status: token.migrationStatus,`

&#x20;   `timestamp: token.kingOfTheHillTimeStamp`

&#x20; `};`

&#x20; `return acc;`

`}, {});`

<br>
