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

# Cursor AI

> Use Cursor to generate and maintain a backend integration against the Trikon Voice API.

Cursor is an AI-assisted editor. Point it at this documentation and it can scaffold a server that starts outbound calls, stores the API key safely, and handles webhooks.

This is the right path when you want **code you own** — a Node, Python, or Go service — rather than a no-code workflow.

## Before you start

* API access enabled, with a key from **Settings → Developer API**.
* An **outbound** agent and its agent ID.
* A phone line UUID from **Settings → Phone Numbers & Telephony**.
* This docs site open so you can `@`-mention pages or paste the [Make a call](/developers/make-a-call) request into the chat.

## 1. Keep secrets out of the repo

Create a `.env` (and add `.env` to `.gitignore`):

```bash theme={null}
TRIKON_API_KEY=your_workspace_api_key
TRIKON_BASE_URL=https://voice.trikon.tech
TRIKON_ENTERPRISE=acmeclinic
TRIKON_AGENT_ID=8f2c1d34-5b6a-4c7e-9f10-2a3b4c5d6e7f
TRIKON_FROM=f47ac10b-58cc-4372-a567-0e02b2c3d479
```

In Cursor Cloud Agents, put the same names in the run's secrets instead of committing them.

## 2. Ask Cursor to build the client

Open Agent mode and paste a prompt like this (keep your real key out of the prompt — tell it to read `.env`):

```text theme={null}
Build a small backend that starts a Trikon Voice outbound call.

Read .env for TRIKON_API_KEY, TRIKON_BASE_URL, TRIKON_ENTERPRISE,
TRIKON_AGENT_ID, and TRIKON_FROM.

POST {TRIKON_BASE_URL}/api/outbound-call with:
- Header Authorization: Bearer $TRIKON_API_KEY
- Header Content-Type: application/json
- Body: to, agentId, enterprise, from, name, metadata

Expose POST /internal/call-lead that accepts { "to", "name", "metadata" }
and forwards those fields to Trikon. Never log the API key.
```

A typical generated call looks like this:

```ts theme={null}
const response = await fetch(`${process.env.TRIKON_BASE_URL}/api/outbound-call`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TRIKON_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    to: "+919845012345",
    agentId: process.env.TRIKON_AGENT_ID,
    enterprise: process.env.TRIKON_ENTERPRISE,
    from: process.env.TRIKON_FROM,
    name: "Asha",
    metadata: { amount_due: "4500", due_date: "12 October" },
  }),
});

const data = await response.json();
// { success: true, callUuid: "..." }
```

Point Cursor at [Make a call](/developers/make-a-call) if the generated fields drift (the API expects `to`, `agentId`, `enterprise`, and `from`).

## 3. Handle webhooks in the same service

Ask Cursor to add `POST /webhooks/trikon` that:

1. Returns `200 OK` within 3 seconds.
2. Reads `event`, `callUuid`, `to`, `transcript`, `intent`, and `summary`.
3. Queues CRM updates instead of doing them in the request handler.

Then paste that URL into **Settings → Developer API**. Payload shapes are on [Webhooks](/developers/webhooks).

## 4. Check the work

<Steps>
  <Step title="Call yourself">
    Hit your local endpoint with your own number. The agent should ring and use `{{customer_name}}` if you passed `name`.
  </Step>

  <Step title="Match the call log">
    The JSON `callUuid` should appear in **Call Logs** in the app.
  </Step>

  <Step title="Confirm the webhook">
    After the call, your handler should receive `call.completed` (or `call.no_answer` / `call.failed`).
  </Step>
</Steps>

<Tip>
  If Cursor invents extra headers or query parameters, delete them. Authentication is only `Authorization: Bearer`, and the call is a single JSON POST to `/api/outbound-call`.
</Tip>
