---
title: "ClientConfig | Client js | Api client"
description: "Documentation for MapTiler Client"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Class ClientConfig

The configuration object definition

-   Defined in [config.ts:29](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/config.ts#L29)

##### Index

### Constructors

[constructor](#constructor)

### Properties

[bufferToPixelData?](#buffertopixeldata) [tileCacheSize](#tilecachesize)

### Accessors

[apiHost](#apihost) [apiKey](#apikey) [apiURL](#apiurl) [fetch](#fetch) [useEuEndpoints](#useeuendpoints)

## Constructors

### constructor[](#constructor)

-   new ClientConfig(): ClientConfig[](#constructorclientconfig)
    
    #### Returns ClientConfig
    

## Properties

### `Optional`bufferToPixelData[](#buffertopixeldata)

bufferToPixelData?: [BufferToPixelDataFunction](https://docs.maptiler.com/client-js/api/types/index.BufferToPixelDataFunction/)

-   Defined in [config.ts:51](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/config.ts#L51)

### tileCacheSize[](#tilecachesize)

tileCacheSize: number = 200

Number of tiles to keep in cache

-   Defined in [config.ts:49](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/config.ts#L49)

## Accessors

### apiHost[](#apihost)

-   get apiHost(): string
    
    The host currently used for the MapTiler API requests (`api.maptiler.com` or `api.maptiler.eu`)
    
    #### Returns string
    
    -   Defined in [config.ts:99](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/config.ts#L99)
    

### apiKey[](#apikey)

-   get apiKey(): string
    
    Get the MapTiler Cloud API key
    
    #### Returns string
    
    -   Defined in [config.ts:63](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/config.ts#L63)
    
-   set apiKey(k: string): void
    
    Set the MapTiler Cloud API key
    
    #### Parameters
    
    -   k: string
    
    #### Returns void
    
    -   Defined in [config.ts:56](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/config.ts#L56)
    

### apiURL[](#apiurl)

-   get apiURL(): string
    
    The base URL currently used for the MapTiler API requests (`https://api.maptiler.com/` or `https://api.maptiler.eu/`)
    
    #### Returns string
    
    -   Defined in [config.ts:107](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/config.ts#L107)
    

### fetch[](#fetch)

-   get fetch(): [FetchFunction](https://docs.maptiler.com/client-js/api/types/config.FetchFunction/)
    
    Get the fetch fucntion
    
    #### Returns [FetchFunction](https://docs.maptiler.com/client-js/api/types/config.FetchFunction/)
    
    -   Defined in [config.ts:77](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/config.ts#L77)
    
-   set fetch(f: [FetchFunction](https://docs.maptiler.com/client-js/api/types/config.FetchFunction/)): void
    
    Set a the custom fetch function to replace the default one
    
    #### Parameters
    
    -   f: [FetchFunction](https://docs.maptiler.com/client-js/api/types/config.FetchFunction/)
    
    #### Returns void
    
    -   Defined in [config.ts:70](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/config.ts#L70)
    

### useEuEndpoints[](#useeuendpoints)

-   get useEuEndpoints(): boolean
    
    Whether the EU-based `api.maptiler.eu` host is currently in use instead of the default `api.maptiler.com`
    
    #### Returns boolean
    
    -   Defined in [config.ts:92](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/config.ts#L92)
    
-   set useEuEndpoints(value: boolean): void
    
    Switch between the default `api.maptiler.com` host and the EU-based `api.maptiler.eu` host. Set to `false` to switch back to the default.
    
    #### Parameters
    
    -   value: boolean
    
    #### Returns void
    
    -   Defined in [config.ts:85](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/config.ts#L85)
