This is the documentation of version 0.58.0. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Type Alias GlobalConfig

    Global configuration for the TomTom Maps SDK.

    Contains essential parameters like API keys, language settings, and display preferences that apply across all SDK services and map functionality.

    This configuration can be set globally using TomTomConfig and will be merged with service-specific configurations, with service configs taking precedence.

    const config: GlobalConfig = {
    apiKey: 'your-api-key',
    commonBaseURL: 'https://api.tomtom.com',
    language: 'en-US',
    displayUnits: {
    distance: { type: 'metric' },
    time: { hours: 'hrs', minutes: 'mins' }
    }
    };
    type GlobalConfig = {
        apiKey: string;
        commonBaseURL: string;
        displayUnits?: DisplayUnits;
        language?: Language;
        retry?: RetryConfig;
    }
    Index
    apiKey: string

    TomTom API key for authentication.

    Required for all SDK features. Obtain an API key from the my.tomtom.com.

    None (required)
    
    commonBaseURL: string

    Base URL of every TomTom request: service calls, and the style, tile, sprite and glyph URLs the map fetches.

    Change it only to route those requests through a proxy of your own. Leaving apiKey unset too switches the SDK to proxy-credentials mode, where no key leaves the browser and requests carry the proxy's session cookie.

    "https://api.tomtom.com"
    
    displayUnits?: DisplayUnits

    Custom display units for time and distance.

    Applied to formatDistance and formatDuration utilities, which are used throughout the SDK for displaying map information. If not provided, default unit labels are used.

    language?: Language

    Language code for SDK services and map content.

    Accepts IETF language codes (case-insensitive). Affects search results, routing instructions, and map labels.

    "NGT" (Neutral Ground Truth - uses local language for each location)
    
    retry?: RetryConfig

    Configuration for automatic retry on rate-limited (429) responses.

    When set, the SDK automatically retries requests that receive a 429 status code using exponential backoff. All fields have sensible defaults.