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

# התחלה מהירה (API)

> ענו לשיחת הטלפון הראשונה שלכם באמצעות סוכן AI בארבע קריאות REST.

מדריך זה מלווה אתכם בארבע קריאות REST הנדרשות כדי לענות
לשיחת הטלפון הראשונה שלכם עם סוכן AI.

<Info>
  תזדקקו ל[חשבון ThunderPhone](https://app.thunderphone.com).
  ההרשמה בחינם ונמשכת פחות מדקה. מעדיפים ללחוץ במקום להשתמש ב-curl?
  [המדריך המהיר בלוח הבקרה](/he/quickstart-dashboard) מוביל לאותה
  שיחה ראשונה בלי לכתוב קוד.
</Info>

## שלב 1: קבלת מפתח API

<Steps>
  <Step title="התחברות">
    פתחו את [app.thunderphone.com](https://app.thunderphone.com).
  </Step>

  <Step title="ניווט אל מפתחות">
    עברו אל **Organization → Keys** בלוח הבקרה.
  </Step>

  <Step title="יצירת מפתח">
    לחצו על **Create key**, תנו לו שם והעתיקו את הערך
    `sk_live_...`. המפתח הגולמי מוצג **פעם אחת בלבד** — שמרו אותו
    במנהל הסודות שלכם מיד.
  </Step>
</Steps>

<Tip>
  נתקעתם? [יצירת מפתח API לשרת](/he/guides/api-keys) מסביר
  את התהליך הזה שלב אחר שלב, וה-copilot בתוך האפליקציה יכול
  להדגיש עבורכם כל פקד בזמן אמת.
</Tip>

לאורך מדריך זה, החליפו את `sk_live_YOUR_API_KEY` בערך
שהעתקתם זה עתה. המפתח מזהה את הארגון שלכם אוטומטית, ולכן
לעולם אינכם צריכים להוסיף מזהה ארגון לכתובות URL.

## שלב 2: יצירת סוכן

סוכן מגדיר כיצד ה-AI מטפל בשיחות — הנחיה, קול,
רמת מוצר, כלים וזכאות לווידג'ט.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.thunderphone.com/v1/agents \
    -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name":   "Customer Support",
      "prompt": "You are a friendly support agent for Acme Corp. Help with orders, returns, and product info. Be concise and helpful.",
      "voice":  "john",
      "product": "spark"
    }'
  ```

  ```python Python theme={null}
  import os, requests

  agent = requests.post(
      "https://api.thunderphone.com/v1/agents",
      headers={"Authorization": f"Bearer {os.environ['THUNDERPHONE_API_KEY']}"},
      json={
          "name":   "Customer Support",
          "prompt": "You are a friendly support agent for Acme Corp. Help with orders, returns, and product info. Be concise and helpful.",
          "voice":  "john",
          "product": "spark",
      },
  ).json()
  print("Agent id:", agent["id"])
  ```

  ```javascript Node.js theme={null}
  const agent = await fetch("https://api.thunderphone.com/v1/agents", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.THUNDERPHONE_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name:    "Customer Support",
      prompt:  "You are a friendly support agent for Acme Corp. Help with orders, returns, and product info. Be concise and helpful.",
      voice:   "john",
      product: "spark",
    }),
  }).then((r) => r.json());
  console.log("Agent id:", agent.id);
  ```
</CodeGroup>

<Tip>
  רמות מוצר: `spark` מותאם לעלות, `bolt` למהירות, ו-
  `storm-base` / `storm-extra` לבינה בהנחיות מורכבות. ראו
  [סוכנים](/api-reference/agents#product-tiers-at-a-glance) להשוואה
  המלאה.
</Tip>

## שלב 3: הקצו מספר טלפון

קריאה זו מבקשת מספר ממאגר ההדגמה של ThunderPhone ומקצה את
הסוכן החדש שלכם כמטפל בשיחות נכנסות. (כדי להביא מספר משלכם מספק
VoIP, עיינו במקום זאת ב-[חיבורי VoIP](/api-reference/voip-connections).)

<CodeGroup>
  ```bash cURL theme={null}
  # First provision
  curl -X POST https://api.thunderphone.com/v1/phone-numbers \
    -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"area_code": "415"}'

  # Then assign the agent you created in Step 2
  curl -X PATCH https://api.thunderphone.com/v1/phone-numbers/<id-from-previous> \
    -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"inbound_agent_id": 12}'
  ```

  ```python Python theme={null}
  number = requests.post(
      "https://api.thunderphone.com/v1/phone-numbers",
      headers={"Authorization": f"Bearer {os.environ['THUNDERPHONE_API_KEY']}"},
      json={"area_code": "415"},
  ).json()
  requests.patch(
      f"https://api.thunderphone.com/v1/phone-numbers/{number['id']}",
      headers={"Authorization": f"Bearer {os.environ['THUNDERPHONE_API_KEY']}"},
      json={"inbound_agent_id": agent["id"]},
  )
  print("Your ThunderPhone number:", number["number"])
  ```
</CodeGroup>

המספר החדש שלכם מתחיל במצב `status="provisioning"` ועובר למצב
`active` בתוך כמה שניות; עד שתסגרו את הדפדפן, המספר יהיה מוכן לקבל שיחות.

## שלב 4 (אופציונלי): הגדירו webhook

לאירועים בזמן אמת (ניתוב שיחות דינמי, עיבוד לאחר שיחה), הוסיפו
נקודת קצה של webhook. הירשמו רק לאירועים שאתם צריכים.

```bash theme={null}
curl -X POST https://api.thunderphone.com/v1/developer/webhook-endpoints \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label":  "Prod webhook",
    "url":    "https://your-server.com/thunderphone-webhook",
    "events": ["telephony.incoming", "telephony.complete"]
  }'
```

התשובה כוללת `secret` חד-פעמי — העתיקו אותו למנהל הסודות
שלכם. השתמשו בסוד זה כדי לאמת את הכותרת
`X-ThunderPhone-Signature` בבקשות נכנסות (עיינו ב-
[סקירת Webhooks](/he/webhooks/overview)).

## שלב 5: בדקו את הסוכן שלכם

התקשרו למספר שזה עתה הקציתם. הסוכן עונה, מציג
את עצמו ופועל בהתאם להנחיה שלכם.

בדקו את השיחה לאחר סיומה:

```bash theme={null}
curl https://api.thunderphone.com/v1/calls \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY"
```

עברו לשיחה ספציפית כדי לאחזר את התמלול ואת כתובת ה-URL של ההקלטה:

```bash theme={null}
curl https://api.thunderphone.com/v1/calls/{call_id}/transcript \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY"
curl https://api.thunderphone.com/v1/calls/{call_id}/audio \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY"
```

***

## השלבים הבאים

<CardGroup cols={2}>
  <Card title="הוסיפו כלי פונקציות" icon="screwdriver-wrench" href="/he/tools/overview">
    אפשרו לסוכן שלכם לקרוא לממשקי ה-API שלכם במהלך שיחה.
  </Card>

  <Card title="בצעו שיחות יוצאות" icon="arrow-up-right" href="/api-reference/outbound-calls">
    הפעילו שיחות מהקוד שלכם.
  </Card>

  <Card title="טפלו ב-webhooks" icon="bolt" href="/he/webhooks/overview">
    הגיבו לאירועי שיחה בזמן אמת.
  </Card>

  <Card title="הפניית API מלאה" icon="book" href="/api-reference/introduction">
    כל נקודת קצה ציבורית, מתועדת.
  </Card>
</CardGroup>
