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

# demo.requested

> A rep asked your app to build a demo account for a prospect. Build it, then send back its link.

Before a demo, a rep answers your demo form in **Calls → Prep a demo**: who it's for, the meeting, and the questions you set under **Calls → Demos**. When they press **Prep demo**, Custral writes the call's script from your demo talk tracks and sends this event to your app. Your app builds a demo account in **your** product from the answers (sample data, the prospect's name, what they asked to see) and answers with its link. The rep then sees **Open demo** beside the script.

## Payload

```json theme={null}
{
  "id": "whd_2Xn8rK5cD",
  "event": "demo.requested",
  "createdAt": "2026-12-01T10:00:00.412Z",
  "data": {
    "id": "dreq_3Ab9xK2mQ7",
    "revision": 1,
    "callbackUrl": "https://api.custral.com/v1/demo-requests/dreq_3Ab9xK2mQ7/environment",
    "prospect": {
      "company": "Northwind Freight",
      "website": "northwind.example",
      "size": "51–200",
      "industry": "Logistics"
    },
    "meeting": {"startsAt": "2026-12-03T22:00:00.000Z", "endsAt": "2026-12-03T22:30:00.000Z"},
    "attendees": [{"name": "Dana Ruiz"}],
    "answers": [
      {"key": "fleet_size", "question": "How many trucks do they run?", "value": 120},
      {"key": "regions", "question": "Which regions?", "value": ["West", "Central"]},
      {"key": "fix", "question": "What do they want fixed?", "value": "Dispatch calls drivers for every ETA."}
    ],
    "presenter": {"name": "Sam Lee", "email": "sam@acme.example"},
    "requestedAt": "2026-12-01T10:00:00.000Z"
  }
}
```

**id** `string` *required*

The request. Answer it on `callbackUrl`.

**revision** `number` *required*

Goes up each time the rep presses **Send again** (they changed an answer, or the meeting moved). Use `id` +
`revision` as your idempotency key: a retried delivery of the same revision should not build a second demo.

**test** `true`

Present only on a **Send test request** from the Demos tab. Its `id` is `dreq_test` and answering it does nothing.

**prospect** `object` *required*

What the rep typed. `company` is always present; `website`, `size`, `industry` and `logoUrl` only when filled in.

**meeting** `object`

The calendar meeting the demo is for, when the rep picked one.

**attendees** `object[]` *required*

The meeting's guests. Names always; **emails only when a workspace admin turned on "Include attendee emails"** on the
Demos tab, because they are the prospect's personal data. Empty with no meeting.

**answers** `object[]` *required*

The rep's answers to your demo form, in the form's order. `key` is the key you set on the question, `question` is
its wording, and `value` is text, a number, or a list of the choices picked. A question the rep left blank is left
out. Build against `key`: it stays the same when an admin rewords the question.

**presenter** `object` *required*

The rep who asked.

## Answer it

Answer with an API key of the same workspace that holds the **`demos:manage`** scope. The request is found only inside that key's workspace.

```ts SDK theme={null}
import {Custral} from "@custral/sdk";

const custral = new Custral({apiKey: process.env.CUSTRAL_API_KEY});

// `request` is the event's `data`. After your app has built the demo:
await custral.demoRequests.setEnvironment(request.id, {
status: "ready",
url: "https://demo.acme.example/s/one-time-sign-in-token",
});

// Or, when it can't:
await custral.demoRequests.setEnvironment(request.id, {
status: "failed",
message: "We have no sample data for Logistics yet.",
});

```

```bash curl theme={null}
curl -X POST "https://api.custral.com/v1/demo-requests/dreq_3Ab9xK2mQ7/environment" \
  -H "Authorization: Bearer $CUSTRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status": "ready", "url": "https://demo.acme.example/s/one-time-sign-in-token"}'
```

* **`url` must be `https://`.** Anything else is refused (`demo_environment_url_invalid`). The rep sees the link's host next to **Open demo**, and it opens in a new tab.
* **Never put a password in the link or the message.** If your demo needs a sign-in, send a one-time sign-in link.
* **Answering again replaces the earlier answer**, so you can rebuild a demo and send its new link.
* If your app never answers, the rep's screen says "No answer from your app yet" after 10 minutes and offers **Send again**.

## Example receiver

```ts theme={null}
import express from "express";
import {Custral, type DemoRequestedEventData} from "@custral/sdk";

const custral = new Custral({
  apiKey: process.env.CUSTRAL_API_KEY,
  webhookSecret: process.env.CUSTRAL_WEBHOOK_SECRET!,
});
const app = express();

app.post("/hooks/custral", express.raw({type: "application/json"}), async (req, res) => {
  const event = custral.webhooks.constructEvent(req.body, req.header("X-Custral-Signature"));
  res.sendStatus(200); // answer fast; build the demo after
  if (event.event !== "demo.requested") return;
  const request = event.data as DemoRequestedEventData;
  if (request.test) return;

  const demo = await buildDemoAccount(request); // your code: seed an account in your product
  await custral.demoRequests.setEnvironment(request.id, {status: "ready", url: demo.signInUrl});
});
```

See [Security](https://docs.custral.com/dev/webhooks/security.md) for the signature check and [Delivery](https://docs.custral.com/dev/webhooks/delivery.md) for retries.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.