> ## Documentation Index
> Fetch the complete documentation index at: https://braintrust.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# API URL configuration conflicts in self-hosted deployments

export const plans_0 = "Any"

export const deployments_0 = "Braintrust-hosted, Self-hosted"

export const data_plane_version_0 = undefined

export const use_case_0 = "Use case - Logging with multiple environment configurations or self-hosted deployments"

<Note>
  **Applies to:**

  * Plan - {plans_0}
  * Deployment - {deployments_0}
  * {data_plane_version_0}
  * {use_case_0}
</Note>

## Summary

**Issue:** Streaming logs fails with initialization errors or Forbidden errors when both `apiUrl` and `appUrl` are set with conflicting values (e.g., staging URL in global env and production URL in app config).

**Cause:** `apiUrl` takes precedence over `appUrl`, causing SDK requests to go to the wrong data plane endpoint.

**Resolution:** Remove conflicting URL configurations and set only `BRAINTRUST_API_URL` or `apiUrl` to point to your data plane endpoint.

## Resolution Steps

### If using standard Braintrust hosted deployment

#### Step 1: Remove appUrl configuration

Only set `appUrl` if your frontend is hosted somewhere other than [https://www.braintrust.dev](https://www.braintrust.dev).

```javascript theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
const logger = initLogger({
    projectId: braintrustProjectId,
    projectName: braintrustProjectName,
    apiKey: braintrustApiKey
    // Remove appUrl unless custom frontend
})

```

#### Step 2: Verify API URL is not set in global environment

Check that `BRAINTRUST_API_URL` or `apiUrl` is not set in global environment variables with incorrect values.

### If using self-hosted or hybrid deployment

#### Step 1: Set only apiUrl to data plane endpoint

Configure `BRAINTRUST_API_URL` or `apiUrl` to point to your data plane, not the web app URL.

```javascript theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
const logger = initLogger({
    projectId: braintrustProjectId,
    projectName: braintrustProjectName,
    apiKey: braintrustApiKey,
    apiUrl: 'https://your-data-plane-url.com'  // Not appUrl
})

```

#### Step 2: Verify data plane URL in settings

Navigate to Settings > Data Plane in the Braintrust UI to confirm the correct endpoint.

#### Step 3: Remove conflicting appUrl configurations

Check both global environment variables and application-level configs for conflicting `appUrl` settings.

## Additional Information

### URL configuration differences

* `BRAINTRUST_API_URL` / `apiUrl`: Data plane endpoint where SDK makes logging requests (required for self-hosted)
* `appUrl`: Web app URL for authentication and link generation (only needed if frontend is not at braintrust.dev)
* When both are set, `apiUrl` takes precedence

### Common configuration mistakes

* Setting `API_URL` in global environment with staging URL while passing production `appUrl` from application
* Using `appUrl` instead of `apiUrl` for data plane configuration
* Not checking Settings > Data Plane for correct endpoint in self-hosted deployments
