Skip to main content

index/functions/getTokenImageUrl.md

getTokenImageUrl(tokenName, baseUrl): string

Get redirect URL for a token image

Retrieves the main token image/logo. This is the primary visual representation of the token shown throughout the UI.

Backend: Redirects to S3 if available, otherwise returns placeholder.

Parameters​

ParameterTypeDescription
tokenNamestringToken name (lowercase, e.g., 'anime', 'GUSDC')
baseUrlstringAPI base URL (e.g., 'https://api.example.com')

Returns​

string

Full redirect URL to token image

Throws​

Error if token name is invalid or empty

Example​

const imageUrl = getTokenImageUrl('anime', 'https://api.example.com');
// → "https://api.example.com/v1/tokens/anime/assets/image"

// Fetch the image (will redirect to S3)
const response = await fetch(imageUrl);
const blob = await response.blob();
const imageElement = document.querySelector('img');
if (imageElement) {
imageElement.src = URL.createObjectURL(blob);
}

Since​

7.3.0