Skip to main content
The NarrativeApi class accepts a configuration object that controls authentication, environment targeting, and request behavior.

Constructor options

Environment URLs

The SDK supports two built-in environments, or you can specify a custom URL:

Configuration examples

Production (default)

Development environment

Custom base URL

For self-hosted or custom deployments:

Enable verbose logging

Useful for debugging API requests:
When verbose mode is enabled, the SDK logs:
  • Request URLs and methods
  • Request payloads
  • Response data
  • Configuration details
Verbose mode is automatically enabled when using the dev environment.

Custom headers

Add custom headers to all requests:

Runtime configuration

You can update the API key after initialization:

Environment variables

While the SDK doesn’t automatically read environment variables, the recommended pattern is:

TypeScript types

The SDK exports configuration types for TypeScript users:

API Keys

Create and manage API keys

Authentication Guide

Authentication best practices

SDK Overview

TypeScript SDK overview

API Modules

Available API methods