Interface DataAPIClientOptions

The default options for the DataAPIClient. The Data API & DevOps specific options may be overridden when spawning a new instance of their respective classes.

interface DataAPIClientOptions {
    adminOptions?: AdminSpawnOptions;
    caller?: Caller | Caller[];
    dbOptions?: DbSpawnOptions;
    httpOptions?: DataAPIHttpOptions;
    preferHttp2?: boolean;


adminOptions?: AdminSpawnOptions

The default options when spawning an AstraAdmin instance.

caller?: Caller | Caller[]

The caller information to send with requests, of the form [name, version?], or an array of such.

Intended generally for integrations or frameworks that wrap the client.

The caller information is used to identify the client making requests to the server.

It will be sent in the headers of the request as such:

User-Agent: ...<name>/<version> astra-db-ts/<version>

If no caller information is provided, the client will simply be identified as astra-db-ts/<version>.

NB. If providing an array of callers, they should be ordered from most important to least important.


// 'my-app/1.0.0 astra-db-ts/1.0.0'
const client1 = new DataAPIClient('AstraCS:...', {
  caller: ['my-app', '1.0.0'],

// 'my-app/1.0.0 my-other-app astra-db-ts/1.0.0'
const client2 = new DataAPIClient('AstraCS:...', {
  caller: [['my-app', '1.0.0'], ['my-other-app']],
dbOptions?: DbSpawnOptions

The default options when spawning a Db instance.

httpOptions?: DataAPIHttpOptions

The client-wide options related to http operations.

There are four different behaviours for setting the client:

  • Not setting the httpOptions at all -- This will attempt to use fetch-h2 if available, and fall back to fetch if not available
  • client: 'default' or client: undefined (or unset) -- This will attempt to use fetch-h2 if available, and throw an error if not available
  • client: 'fetch' -- This will always use the native fetch API
  • client: 'custom' -- This will allow you to pass a custom Fetcher implementation to the client

fetch-h2 is a fetch implementation that supports HTTP/2, and is the recommended client for the best performance.

However, it's generally only available by default on node runtimes; in other environments, you may need to use the native fetch API instead, or pass in the fetch-h2 module manually.

See the astra-db-ts README for more information on different clients.

preferHttp2?: boolean

Whether to prefer HTTP/2 for requests to the Data API; if set to false, HTTP/1.1 will be used instead.

Prefer to use the DataAPIClientOptions.httpOptions property instead.

The two are functionally equivalent; this is provided for backwards compatibility.


Use the DataAPIClientOptions.httpOptions property instead.