# Quickstart: your first AI phone call

> Create a test key, an assistant and a call to a test number, then read what was said. About five minutes, with no phone line and no AI spend.

In about five minutes you will create an AI assistant that speaks Hebrew, have it call a test number, and read the conversation. Everything runs in **test mode**: speech recognition, the language model and the voice are simulated, the call goes to a virtual phone network instead of a real one, and nothing is billed. When it works, a live key runs the same code on real calls.

Each step shows the request in cURL, in Node.js with `@morevoice/sdk`, and in Python with `requests`. Pick a tab once and every page follows your choice.

> **Coming soon: The API is in beta**
>
> The API is switched on per organisation during the beta. Ask us to join; until then, `/v1` answers `404` for your organisation and the dashboard has no API keys.

## Before you start

- A MoreVoice account where you are an administrator or the owner: API keys are created in the dashboard.
- For Node.js: Node 18 or later and `npm install @morevoice/sdk`. For Python: Python 3.10 or later and `pip install requests`. For cURL: `curl`, plus `jq` for step 4.

1. **Create a test key**

   In the dashboard, open **Developers › API keys**, switch **Mode** to **Test** and select **Create test key**. Give the key a name, keep the type **Secret**, and copy the key. You see it only once. It starts with `mv_test_sk_`.

   Keep it in an environment variable, so it never ends up in your code:

   ```sh
   export MOREVOICE_API_KEY=mv_test_sk_…
   ```

   Check that the key works. The answer says which organisation and mode it belongs to:

   **cURL**

   ```sh
   # Check the key: which organisation, which mode, which scopes.
   curl https://api.morevoice.ai/v1/whoami \
     -H "Authorization: Bearer $MOREVOICE_API_KEY"
   ```

   **Node.js**

   ```ts title="check-key.ts"
   import MoreVoice from "@morevoice/sdk";

   const mv = new MoreVoice(); // reads MOREVOICE_API_KEY

   // Check the key: which organisation, which mode, which scopes.
   const me = await mv.whoami.retrieve();
   console.log(`${me.org_id} · ${me.livemode ? "live" : "test"} mode · API version ${me.api_version}`);
   ```

   **Python**

   ```python title="check_key.py"
   import os

   import requests

   API = "https://api.morevoice.ai/v1"
   HEADERS = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}"}

   # Check the key: which organisation, which mode, which scopes.
   response = requests.get(f"{API}/whoami", headers=HEADERS, timeout=30)
   response.raise_for_status()
   me = response.json()
   mode = "live" if me["livemode"] else "test"
   print(f"{me['org_id']} · {mode} mode · API version {me['api_version']}")
   ```

   ```json title="Response"
   {
     "object": "api_key_principal",
     "org_id": "org_7n42DGM5Tflk9n8mt7Fhc9",
     "key_id": "key_9i2E2pKO6g3z4nXl57Qb4g",
     "livemode": false,
     "scopes": ["*"],
     "api_version": "2026-11-01"
   }
   ```

2. **Create an assistant**

   An assistant is the AI on the call: what it says first, what it knows, how it sounds. This one calls patients to confirm an appointment. `{{customer_name}}` is a variable that each call fills in.

   **cURL**

   ```sh
   # Create an assistant that calls patients to confirm tomorrow's appointment, in Hebrew.
   curl https://api.morevoice.ai/v1/assistants \
     -H "Authorization: Bearer $MOREVOICE_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "Appointment reminders",
       "language": "he",
       "first_message": "שלום {{customer_name}}, כאן מרפאת השרון. רציתי לאשר את התור שלך מחר בעשר. זה עדיין מתאים?",
       "system_prompt": "You call patients to confirm tomorrow'"'"'s appointment. Speak Hebrew and keep every answer short. If the time no longer suits them, say that the clinic will call back to find a new one."
     }'
   ```

   **Node.js**

   ```ts title="create-assistant.ts"
   import MoreVoice from "@morevoice/sdk";

   const mv = new MoreVoice(); // reads MOREVOICE_API_KEY

   // Create an assistant that calls patients to confirm tomorrow's appointment, in Hebrew.
   const assistant = await mv.assistants.create({
   	name: "Appointment reminders",
   	language: "he",
   	first_message: "שלום {{customer_name}}, כאן מרפאת השרון. רציתי לאשר את התור שלך מחר בעשר. זה עדיין מתאים?",
   	system_prompt:
   		"You call patients to confirm tomorrow's appointment. Speak Hebrew and keep every answer short. " +
   		"If the time no longer suits them, say that the clinic will call back to find a new one.",
   });
   console.log(assistant.id); // asst_…
   ```

   **Python**

   ```python title="create_assistant.py"
   import os

   import requests

   API = "https://api.morevoice.ai/v1"
   HEADERS = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}"}

   # Create an assistant that calls patients to confirm tomorrow's appointment, in Hebrew.
   response = requests.post(
       f"{API}/assistants",
       headers=HEADERS,
       json={
           "name": "Appointment reminders",
           "language": "he",
           "first_message": "שלום {{customer_name}}, כאן מרפאת השרון. רציתי לאשר את התור שלך מחר בעשר. זה עדיין מתאים?",
           "system_prompt": (
               "You call patients to confirm tomorrow's appointment. Speak Hebrew and keep every answer short. "
               "If the time no longer suits them, say that the clinic will call back to find a new one."
           ),
       },
       timeout=30,
   )
   response.raise_for_status()
   assistant = response.json()
   print(assistant["id"])  # asst_…
   ```

   The answer is the whole assistant, with defaults for everything you didn't set (the voice, speech recognition, turn-taking). Keep its ID:

   ```sh
   export ASSISTANT_ID=asst_…
   ```

   [Create and configure an assistant](https://docs.morevoice.ai/guides/assistants/) explains every setting, with tips for Hebrew.

3. **Call a test number**

   `+972500000001` is a test number that answers: a simulated caller talks to your assistant for a few turns, then hangs up.

   **cURL**

   ```sh
   # Call the test number that answers. With a test key the call is simulated: no phone rings.
   curl https://api.morevoice.ai/v1/calls \
     -H "Authorization: Bearer $MOREVOICE_API_KEY" \
     -H "Content-Type: application/json" \
     -H "Idempotency-Key: $(uuidgen)" \
     -d '{
       "to": "+972500000001",
       "assistant_id": "'"$ASSISTANT_ID"'",
       "purpose": "service",
       "variables": { "customer_name": "דנה" }
     }'
   ```

   **Node.js**

   ```ts title="call-test-number.ts"
   import MoreVoice from "@morevoice/sdk";

   const mv = new MoreVoice(); // reads MOREVOICE_API_KEY

   // Call the test number that answers. With a test key the call is simulated: no phone rings.
   // The SDK sends an Idempotency-Key with every POST, so a retry never places a second call.
   const call = await mv.calls.create({
   	to: "+972500000001",
   	assistant_id: process.env.ASSISTANT_ID!,
   	purpose: "service",
   	variables: { customer_name: "דנה" },
   });
   console.log(call.id, call.status); // call_… queued
   ```

   **Python**

   ```python title="call_test_number.py"
   import os
   import uuid

   import requests

   API = "https://api.morevoice.ai/v1"
   HEADERS = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}"}

   # Call the test number that answers. With a test key the call is simulated: no phone rings.
   # The Idempotency-Key is required: retrying with the same key never places a second call.
   response = requests.post(
       f"{API}/calls",
       headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())},
       json={
           "to": "+972500000001",
           "assistant_id": os.environ["ASSISTANT_ID"],
           "purpose": "service",
           "variables": {"customer_name": "דנה"},
       },
       timeout=30,
   )
   response.raise_for_status()
   call = response.json()
   print(call["id"], call["status"])  # call_… queued
   ```

   - `purpose` is required on every outbound call. It decides which compliance checks run. It is `service` here, because the call is about an existing appointment.
   - `Idempotency-Key` is required too. If your request times out, send it again with the same key: MoreVoice returns the first answer and never dials twice. The SDK adds a key for you.

   The call starts as `queued`. Keep its ID:

   ```json title="Response (201 Created)"
   {
     "id": "call_8tRPaZp5hLMbrGqdJ9AmNa",
     "object": "call",
     "type": "ai",
     "direction": "outbound",
     "transport": "sip",
     "status": "queued",
     "from": null,
     "to": "+972500000001",
     "assistant_id": "asst_4Gk2LmN9pQ4rS6tV8wX0yZ",
     "purpose": "service",
     "started_at": "2026-11-03T09:14:22.000Z",
     "answered_at": null,
     "ended_at": null,
     "duration_ms": null,
     "end_reason": null,
     "summary": null,
     "cost": null,
     "variables": { "customer_name": "דנה" },
     "metadata": {},
     "livemode": false
   }
   ```

   The call object has more fields than shown here; [call objects](https://docs.morevoice.ai/guides/call-objects/) lists them all.

4. **Follow the call and read the transcript**

   A call goes from `queued` to `ringing`, `in_progress` and `ended`. Wait for the end, then read what was said:

   **cURL**

   ```sh
   # Wait for the call to end (a call.ended webhook tells you without polling).
   while true; do
     status=$(curl -s https://api.morevoice.ai/v1/calls/$CALL_ID -H "Authorization: Bearer $MOREVOICE_API_KEY" | jq -r .status)
     [ "$status" = "ended" ] && break
     sleep 2
   done

   # Then read what was said.
   curl https://api.morevoice.ai/v1/calls/$CALL_ID/transcript \
     -H "Authorization: Bearer $MOREVOICE_API_KEY"
   ```

   **Node.js**

   ```ts title="follow-call.ts"
   import MoreVoice from "@morevoice/sdk";

   const mv = new MoreVoice(); // reads MOREVOICE_API_KEY
   const callId = process.env.CALL_ID!;

   // Wait for the call to end (a call.ended webhook tells you without polling).
   const call = await mv.calls.waitUntilEnded(callId);
   console.log(`Ended: ${call.end_reason}, ${call.duration_ms} ms`);

   // Then read what was said.
   const transcript = await mv.calls.retrieveTranscript(callId);
   for (const segment of transcript.segments) console.log(`${segment.speaker}: ${segment.text}`);
   ```

   **Python**

   ```python title="follow_call.py"
   import os
   import time

   import requests

   API = "https://api.morevoice.ai/v1"
   HEADERS = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}"}
   call_id = os.environ["CALL_ID"]

   # Wait for the call to end (a call.ended webhook tells you without polling).
   while True:
       response = requests.get(f"{API}/calls/{call_id}", headers=HEADERS, timeout=30)
       response.raise_for_status()
       call = response.json()
       if call["status"] == "ended":
           break
       time.sleep(2)
   print(f"Ended: {call['end_reason']}, {call['duration_ms']} ms")

   # Then read what was said.
   response = requests.get(f"{API}/calls/{call_id}/transcript", headers=HEADERS, timeout=30)
   response.raise_for_status()
   for segment in response.json()["segments"]:
       print(f"{segment['speaker']}: {segment['text']}")
   ```

   ```json title="Transcript"
   {
     "object": "transcript",
     "call_id": "call_8tRPaZp5hLMbrGqdJ9AmNa",
     "language": "he",
     "segments": [
       { "speaker": "assistant", "text": "שלום דנה, כאן מרפאת השרון. רציתי לאשר את התור שלך מחר בעשר. זה עדיין מתאים?", "start_ms": 820, "end_ms": 5900, "interrupted": false, "tool": null },
       { "speaker": "customer", "text": "כן, מתאים לי", "start_ms": 6400, "end_ms": 7700, "interrupted": false, "tool": null }
     ]
   }
   ```

   In test mode the caller's lines come from a script and the AI's from a simulated model, so they read like a test, not like a real conversation. The post-call summary is a fixed stand-in too: no AI model runs in test mode.

## Test numbers

`+972500000001` answers, as in step 3. Other test numbers are busy, reach an answering machine, are on the do-not-call list, ring with no answer or fail, so you can test every path of your code: see [test mode](https://docs.morevoice.ai/get-started/test-mode/#test-numbers). Test numbers exist only in test mode; a live key dials them like any other number.

## Get told when the call ends

Polling is fine for a first test. In production, let MoreVoice tell you: add a webhook endpoint and handle the `call.ended` event, then `call.analyzed` when the summary is ready. Test-mode events go only to test-mode endpoints, so your tests never reach production systems. See [webhooks](https://docs.morevoice.ai/webhooks/setup/).

## Go live

1. Create a live key (`mv_live_sk_…`) the same way, with **Mode** on **Live**.
2. Connect a phone line and choose the number to call from: [phone numbers and SIP](https://docs.morevoice.ai/guides/phone-numbers-and-sip/) shows how to connect a SIP trunk, and [outbound calls](https://docs.morevoice.ai/guides/outbound-calls/) how to set the caller ID with `from_number_id`.
3. Read [compliance](https://docs.morevoice.ai/guides/compliance/) before you call customers: §30A consent for marketing, the do-not-call lists, and calling hours around Shabbat and holidays.

## Next steps

- [Authentication and API keys](https://docs.morevoice.ai/get-started/authentication/): key types, scopes and rotation; [test mode](https://docs.morevoice.ai/get-started/test-mode/): what is simulated and what isn't.
- [Outbound calls](https://docs.morevoice.ai/guides/outbound-calls/): variables, metadata, the call purpose and idempotency.
- [Campaigns](https://docs.morevoice.ai/guides/campaigns/): call a whole list within calling hours.
- [The API reference](https://docs.morevoice.ai/api/), with a [test-mode playground](https://docs.morevoice.ai/api/playground/).
