> ## 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.

# Creating permalinks to log events via API

export const plans_0 = "Any"

export const deployments_0 = "Any"

export const data_plane_version_0 = undefined

export const use_case_0 = undefined

<Note>
  **Applies to:**

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

## Summary

**Goal:** Generate direct UI links to specific model executions in Braintrust when using the AI Proxy without the SDK.

**Features:** Project Logs API, permalink URL construction, event ID retrieval.

## Configuration Steps

### Step 1: Fetch log events

Call the Project Logs API endpoint with your project ID to retrieve log events.

```javascript theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
const projectId = "your-project-id";
const apiKey = "YOUR_API_KEY";

let events = [];

try {
  const response = await fetch(
    `https://api.braintrust.dev/v1/project_logs/${projectId}/fetch`,
    {
      method: "GET",
      headers: {
        Authorization: `Bearer ${apiKey}`,
        "Content-Type": "application/json",
      },
    }
  );

  if (!response.ok) {
    throw new Error(`Request failed: ${response.status} ${response.statusText}`);
  }

  const data = await response.json();
  events = data.events ?? [];
} catch (error) {
  console.error("Failed to fetch project logs:", error);
}

```

### Step 2: Extract event IDs

Each event in the response contains an `id` field needed for the permalink.

```javascript theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
for (const { id: eventId, span_attributes } of events) {
  const eventName = span_attributes?.name;
  console.log(`${eventName}: ${eventId}`);
}

```

### Step 3: Build permalink URL

Construct the UI link using the project ID and event ID.

```javascript theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
function buildPermalink(projectId, eventId) {
  const APP_URL = "https://www.braintrust.dev";
  const ORG_NAME = "your-org-name";
  return `${APP_URL}/app/${ORG_NAME}/object?object_type=project_logs&object_id=${projectId}&id=${eventId}`;
}

const permalink = buildPermalink(projectId, eventId);

```

console.log(permalink)
