> ## Documentation Index
> Fetch the complete documentation index at: https://tokenlayer-2a53bba4.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get started with the Thrust API in under 5 minutes

## Prerequisites

Before you begin, make sure you have:

1. A Thrust account with an API key
2. Your Supabase project URL
3. A tool to make HTTP requests (cURL, Postman, or code)

## Step 1: Set Up Your Environment

First, set your environment variables:

```bash theme={null}
export API_URL="https://yppncslmsswqydhhgygz.supabase.co/functions/v1"
export API_KEY="your_api_key_here"
```

## Step 2: Create Your First Token

Let's create a new token on the platform:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "${API_URL}/create-token-transaction" \
    -H "Authorization: Bearer ${API_KEY}" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "My Token",
      "symbol": "MTK",
      "description": "A revolutionary new token",
      "imageUrl": "https://example.com/logo.png",
      "chainId": "base-sepolia",
      "endpointId": 40245,
      "userAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://yppncslmsswqydhhgygz.supabase.co/functions/v1/create-token-transaction',
    {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        name: 'My Token',
        symbol: 'MTK',
        description: 'A revolutionary new token',
        imageUrl: 'https://example.com/logo.png',
        chainId: 'base-sepolia',
        endpointId: 40245,
        userAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'
      })
    }
  );

  const data = await response.json();
  console.log('Token created:', data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://yppncslmsswqydhhgygz.supabase.co/functions/v1/create-token-transaction",
      headers={
          "Authorization": f"Bearer {API_KEY}",
          "Content-Type": "application/json"
      },
      json={
          "name": "My Token",
          "symbol": "MTK",
          "description": "A revolutionary new token",
          "imageUrl": "https://example.com/logo.png",
          "chainId": "base-sepolia",
          "endpointId": 40245,
          "userAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
      }
  )

  data = response.json()
  print("Token created:", data)
  ```
</CodeGroup>

### Expected Response

```json theme={null}
{
  "success": true,
  "transaction": {
    "to": "0x1234567890123456789012345678901234567890",
    "data": "0x...",
    "value": "0",
    "gasLimit": "500000"
  },
  "tokenData": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "My Token",
    "symbol": "MTK",
    "slug": "my-token"
  }
}
```

## Step 3: Vote on Content

Now let's vote on a token or post:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "${API_URL}/vote" \
    -H "Authorization: Bearer ${API_KEY}" \
    -H "Content-Type: application/json" \
    -d '{
      "contentType": "token",
      "contentId": "550e8400-e29b-41d4-a716-446655440000",
      "voteType": "upvote",
      "votingTokenId": "550e8400-e29b-41d4-a716-446655440000"
    }'
  ```

  ```javascript JavaScript theme={null}
  const vote = await fetch(
    'https://yppncslmsswqydhhgygz.supabase.co/functions/v1/vote',
    {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        contentType: 'token',
        contentId: '550e8400-e29b-41d4-a716-446655440000',
        voteType: 'upvote',
        votingTokenId: '550e8400-e29b-41d4-a716-446655440000'
      })
    }
  );

  const voteResult = await vote.json();
  console.log('Vote recorded:', voteResult);
  ```

  ```python Python theme={null}
  vote_response = requests.post(
      "https://yppncslmsswqydhhgygz.supabase.co/functions/v1/vote",
      headers={
          "Authorization": f"Bearer {API_KEY}",
          "Content-Type": "application/json"
      },
      json={
          "contentType": "token",
          "contentId": "550e8400-e29b-41d4-a716-446655440000",
          "voteType": "upvote",
          "votingTokenId": "550e8400-e29b-41d4-a716-446655440000"
      }
  )

  vote_data = vote_response.json()
  print("Vote recorded:", vote_data)
  ```
</CodeGroup>

### Expected Response

```json theme={null}
{
  "success": true,
  "message": "Vote recorded successfully",
  "vote": {
    "id": "vote-uuid-here",
    "contentType": "token",
    "contentId": "550e8400-e29b-41d4-a716-446655440000",
    "voteType": "upvote",
    "weight": 1.5
  }
}
```

## Step 4: Get Trending Tokens

Now let's fetch trending tokens:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "${API_URL}/get-tokens" \
    -H "Authorization: Bearer ${API_KEY}" \
    -H "Content-Type: application/json" \
    -d '{
      "filter": "trending",
      "limit": 10
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://yppncslmsswqydhhgygz.supabase.co/functions/v1/get-tokens',
    {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        filter: 'trending',
        limit: 10
      })
    }
  );

  const data = await response.json();
  console.log('Trending tokens:', data);
  ```

  ```python Python theme={null}
  response = requests.post(
      "https://yppncslmsswqydhhgygz.supabase.co/functions/v1/get-tokens",
      headers={
          "Authorization": f"Bearer {API_KEY}",
          "Content-Type": "application/json"
      },
      json={
          "filter": "trending",
          "limit": 10
      }
  )

  data = response.json()
  print("Trending tokens:", data)
  ```
</CodeGroup>

### Expected Response

```json theme={null}
{
  "success": true,
  "tokens": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Example Token",
      "symbol": "EXMPL",
      "slug": "example-token",
      "logo": "https://example.com/logo.png",
      "description": "An example token",
      "holders_count": 1234,
      "upvotes": 567,
      "downvotes": 89,
      "is_live": false,
      "hashtags": ["trending", "defi"]
    }
  ],
  "pagination": {
    "limit": 10,
    "offset": 0,
    "total_returned": 10,
    "has_more": true
  }
}
```

## Common Use Cases

### Browse Tokens by Hashtag

```javascript theme={null}
const hashtagTokens = await fetch(
  'https://yppncslmsswqydhhgygz.supabase.co/functions/v1/get-tokens',
  {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      filter: 'trending',
      hashtag_name: 'defi',
      limit: 20
    })
  }
);
```

### Search for Tokens

```javascript theme={null}
const searchResults = await fetch(
  'https://yppncslmsswqydhhgygz.supabase.co/functions/v1/search-token',
  {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      query: 'bitcoin',
      limit: 10
    })
  }
);
```

### Get User Notifications

```javascript theme={null}
const notifications = await fetch(
  'https://yppncslmsswqydhhgygz.supabase.co/functions/v1/get-notifications',
  {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      limit: 20,
      unreadOnly: true
    })
  }
);
```

## SDK Examples

### React Hook Example

```javascript theme={null}
import { useState, useEffect } from 'react';

export function useTrendingTokens(limit = 20) {
  const [tokens, setTokens] = useState([]);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState(null);

  useEffect(() => {
    const fetchTokens = async () => {
      try {
        const response = await fetch(
          'https://yppncslmsswqydhhgygz.supabase.co/functions/v1/get-tokens',
          {
            method: 'POST',
            headers: {
              'Authorization': `Bearer ${API_KEY}`,
              'Content-Type': 'application/json'
            },
            body: JSON.stringify({
              filter: 'trending',
              limit
            })
          }
        );

        const data = await response.json();
        setTokens(data.tokens);
      } catch (err) {
        setError(err.message);
      } finally {
        setLoading(false);
      }
    };

    fetchTokens();
  }, [limit]);

  return { tokens, loading, error };
}
```

## Error Handling

Always handle errors in your API calls:

```javascript theme={null}
const makeApiCall = async (endpoint, data) => {
  try {
    const response = await fetch(
      `https://yppncslmsswqydhhgygz.supabase.co/functions/v1/${endpoint}`,
      {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${API_KEY}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(data)
      }
    );

    const result = await response.json();

    if (!response.ok) {
      throw new Error(result.error || 'API request failed');
    }

    return result;
  } catch (error) {
    console.error('API Error:', error.message);
    throw error;
  }
};
```

## Next Steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="book" href="/api-reference">
    Explore all available endpoints
  </Card>

  <Card title="Authentication" icon="key" href="/authentication">
    Learn about advanced authentication
  </Card>

  <Card title="Errors" icon="triangle-exclamation" href="/errors">
    Understand error codes
  </Card>

  <Card title="Examples" icon="code" href="/examples">
    See more code examples
  </Card>
</CardGroup>

## Need Help?

* Join our [Discord community](https://discord.gg/thrust)
* Check the [API Reference](/api-reference) for detailed endpoint documentation
* Email us at [support@thrust.app](mailto:support@thrust.app)
