> For the complete documentation index, see [llms.txt](https://clanker.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://clanker.gitbook.io/documentation/authenticated/get-tokens-by-admin.md).

# Get Tokens by Admin

### Endpoint

```
GET /api/tokens/fetch-by-admin
```

### Authentication

This endpoint requires API key authentication.

| Header      | Required | Description                     |
| ----------- | -------- | ------------------------------- |
| `x-api-key` | Yes      | Your API key for authentication |

### Query Parameters

| Parameter       | Type      | Required | Default | Description                                                   |
| --------------- | --------- | -------- | ------- | ------------------------------------------------------------- |
| `admin`         | `string`  | Yes      | -       | The admin wallet address (0x...) to filter tokens by          |
| `limit`         | `number`  | No       | `10`    | Number of tokens to return per page (min: 1, max: 200)        |
| `cursor`        | `string`  | No       | -       | Pagination cursor for fetching the next page of results       |
| `chainId`       | `number`  | No       | -       | Filter by specific chain ID (e.g., `8453` for Base)           |
| `includeUser`   | `boolean` | No       | `false` | Include user/creator data in the response                     |
| `includeMarket` | `boolean` | No       | `false` | Include market data (price, market cap, etc.) in the response |

### Response

#### Success (200 OK)

```json
{
  "data": [
    {
      "id": "uuid",
      "contract_address": "0x...",
      "name": "Token Name",
      "symbol": "TKN",
      "admin": "0x...",
      "chain_id": 8453,
      "deployed_at": "2024-01-01T00:00:00.000Z",
      "pool_address": "0x...",
      "img_url": "https://...",
      ...
    }
  ],
  "total": 42,
  "cursor": "eyJpZCI6Ii4uLiJ9"
}
```

| Field    | Type             | Description                                         |
| -------- | ---------------- | --------------------------------------------------- |
| `data`   | `array`          | Array of token objects                              |
| `total`  | `number`         | Total number of tokens matching the query           |
| `cursor` | `string \| null` | Cursor for the next page, `null` if no more results |

#### Error Responses

**401 Unauthorized**

Missing or invalid API key.

```json
{
  "error": "API key is required"
}
```

**400 Bad Request**

Missing or invalid admin address.

```json
{
  "error": "Admin address is required"
}
```

```json
{
  "error": "Invalid admin address"
}
```

### Examples

#### Basic Request

```bash
curl -X GET "https://clanker.world/api/tokens/fetch-by-admin?admin=0x1234567890abcdef1234567890abcdef12345678" \
  -H "x-api-key: your-api-key"
```

#### With Pagination

```bash
curl -X GET "https://clanker.world/api/tokens/fetch-by-admin?admin=0x1234567890abcdef1234567890abcdef12345678&limit=20&cursor=eyJpZCI6Ii4uLiJ9" \
  -H "x-api-key: your-api-key"
```

#### With All Options

```bash
curl -X GET "https://clanker.world/api/tokens/fetch-by-admin?admin=0x1234567890abcdef1234567890abcdef12345678&limit=50&chainId=8453&includeUser=true&includeMarket=true" \
  -H "x-api-key: your-api-key"
```

#### JavaScript/TypeScript Example

```typescript
const response = await fetch(
  'https://clanker.world/api/tokens/fetch-by-admin?' + new URLSearchParams({
    admin: '0x1234567890abcdef1234567890abcdef12345678',
    limit: '20',
    includeMarket: 'true',
  }),
  {
    headers: {
      'x-api-key': 'your-api-key',
    },
  }
);

const { data, total, cursor } = await response.json();
```

### Pagination

To paginate through results:

1. Make an initial request without a `cursor`
2. If the response includes a `cursor` value, use it in your next request
3. Continue until `cursor` is `null` or undefined

```typescript
let cursor: string | undefined;
const allTokens = [];

do {
  const params = new URLSearchParams({ admin: '0x...', limit: '50' });
  if (cursor) params.set('cursor', cursor);

  const response = await fetch(`/api/tokens/fetch-by-admin?${params}`, {
    headers: { 'x-api-key': 'your-api-key' },
  });
  
  const result = await response.json();
  allTokens.push(...result.data);
  cursor = result.cursor;
} while (cursor);
```

### Rate Limits

Authenticated requests are subject to standard API rate limits. Contact support for rate limit details.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://clanker.gitbook.io/documentation/authenticated/get-tokens-by-admin.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
