💻 HeyGen API Fundamentals — พื้นฐาน API ของ HeyGen

HeyGen Avatar Creation & AI Video — การสร้างอวาตาร์ HeyGen และวิดีโอ AI

Week 10 · Present Perfect (I have created... / The API has returned...) · Beginner → Intermediate

HeyGen API Fundamentals

🎯 พื้นฐาน API ของ HeyGen
What is HeyGen API Fundamentals?

🇹🇭 ภาษาไทย

API (Application Programming Interface) ช่วยให้โปรแกรมต่างๆ สื่อสารกัน HeyGen API ให้คุณสร้างวิดีโอด้วยโค้ดโดยไม่ต้องใช้หน้าเว็บ คุณจะเรียนรู้เกี่ยวกับ API keys, endpoints, requests/responses, JSON และ rate limits สัปดาห์นี้เราจะเรียนไวยากรณ์ Present Perfect เช่น "I have created an API key" และ "The API has returned a response" — ใช้เมื่อพูดถึงประสบการณ์หรือการกระทำที่เพิ่งเสร็จ

🇬🇧 English

An API lets programs communicate with each other. The HeyGen API lets you create videos with code — no web interface needed! You'll learn about API keys, endpoints, requests/responses, JSON, and rate limits. Grammar: Present Perfect — "I have created an API key" and "The API has returned a response" — used for experiences or recently completed actions.

🤩 Fun Facts — ข้อเท็จจริงน่ารู้

🔹 The HeyGen API can generate a video in under 5 minutes using a single API call.
HeyGen API สร้างวิดีโอได้ในเวลาไม่ถึง 5 นาทีด้วย API call เพียงครั้งเดียว

🔹 JSON was created by Douglas Crockford and is now the most popular data format on the web.
JSON ถูกสร้างโดย Douglas Crockford และเป็นรูปแบบข้อมูลที่นิยมที่สุดบนเว็บ

🔹 HTTP status code 200 means "OK" — your request was successful.
สถานะ HTTP 200 แปลว่า "OK" — คำขอของคุณสำเร็จแล้ว

🔹 Rate limiting protects servers — HeyGen allows about 50 API calls per minute.
Rate limiting ปกป้องเซิร์ฟเวอร์ — HeyGen อนุญาตประมาณ 50 API calls ต่อนาที

🧪 Quick Check — ตรวจสอบด่วน

Test your understanding — ทดสอบความเข้าใจ

0/3

What is "API" in Thai?

"API" แปลว่าอะไร?

API / เอพีไอ
เอนด์พอยต์
การยืนยันตัวตน
คีย์ API
"API" = API / เอพีไอ

Which is the definition of "endpoint"?

คำนิยามของ "endpoint" คือข้อใด?

A specific URL that accepts API requests
Proving who you are to access a service
Application Programming Interface — a way for programs to co
None of the above
"endpoint" (เอนด์พอยต์): A specific URL that accepts API requests

Which grammar topic are we studying this week?

เราเรียนหัวข้อไวยากรณ์อะไรสัปดาห์นี้?

Present Perfect (I have created... / The API has returned...)
Future Perfect
Past Perfect Continuous
Subjunctive Mood
This week we study: Present Perfect (I have created... / The API has returned...)

📚 คำศัพท์สำคัญ
Key Vocabulary

API
API / เอพีไอ
Application Programming Interface — a way for programs to communicate
endpoint
เอนด์พอยต์
A specific URL that accepts API requests
authentication
การยืนยันตัวตน
Proving who you are to access a service
API key
คีย์ API
A secret code used to authenticate API calls
request
คำขอ / รีเควสต์
A message sent to an API asking it to do something
response
การตอบกลับ / รีสปอนส์
The data an API sends back
JSON
JSON / เจสัน
JavaScript Object Notation — a data format
parameter
พารามิเตอร์
A value you send with an API request
status code
สถานะโค้ด
A number indicating success or failure (200, 404, etc.)
rate limit
ขีดจำกัดอัตรา
Maximum number of API calls allowed per time period
token
โทเคน
A code used for authentication or measurement
webhook
เว็บฮุก
A callback URL that receives notifications

🧪 Quick Check — ตรวจสอบด่วน

Test your understanding — ทดสอบความเข้าใจ

0/3

What does "request" mean?

"request" หมายถึงอะไร?

A message sent to an API asking it to do something
The data an API sends back
JavaScript Object Notation — a data format
A value you send with an API request
"request" = คำขอ / รีเควสต์: A message sent to an API asking it to do something

"response" in Thai is:

"response" ภาษาไทยคือ:

การตอบกลับ / รีสปอนส์
คีย์ API
เอนด์พอยต์
สถานะโค้ด
"response" = การตอบกลับ / รีสปอนส์

Which word means: "A value you send with an API request..."?

คำใดหมายถึง: "A value you send with an API request..."?

parameter
API key
endpoint
rate limit
The answer is "parameter"

📖 ไวยากรณ์: Present Perfect (I have created... / The API has returned...)
Grammar Focus

📖 Grammar Focus: Present Perfect (I have created... / The API has returned...)

Subject + have/has + past participleประธาน + have/has + กริยาช่อง 3
I have created an API key. (ฉันได้สร้างคีย์ API แล้ว)
The API has returned a response. (API ได้ส่งกลับการตอบกลับแล้ว)
Negative: have/has + not + past participleปฏิเสธ: have/has + not + กริยาช่อง 3
I have not received a response yet. (ฉันยังไม่ได้รับการตอบกลับ)
The server has not processed the request. (เซิร์ฟเวอร์ยังไม่ได้ประมวลผลคำขอ)
Have/Has + subject + past participle? (questions)Have/Has + ประธาน + กริยาช่อง 3? (คำถาม)
Have you authenticated with the API key? (คุณยืนยันตัวตนด้วยคีย์ API แล้วหรือยัง?)
Has the video finished rendering? (วิดีโอเรนเดอร์เสร็จแล้วหรือยัง?)
Present Perfect with ever/never/already/yetPresent Perfect กับ ever/never/already/yet
I have already tested the endpoint. (ฉันได้ทดสอบเอนด์พอยต์แล้ว)
Have you ever used a webhook? (คุณเคยใช้เว็บฮุกไหม?)

🚀 บทเรียนทีละขั้น
Step-by-Step Tutorial

1Get Your API Key — รับคีย์ API ของคุณ

Go to Settings → API. Click "Generate API Key." Copy and save it securely — do not share it!
ไปที่ Settings → API คลิก "Generate API Key" คัดลอกและบันทึกอย่างปลอดภัย — อย่าแชร์!

2Make Your First API Request — ทำ API Request แรก

Use a tool like Postman or curl. Send a GET request to the avatars endpoint with your API key in the header.
ใช้เครื่องมืออย่าง Postman หรือ curl ส่ง GET request ไปยัง avatars endpoint พร้อมคีย์ API ใน header

3Understand the JSON Response — เข้าใจ JSON Response

The API returns JSON data. Look for "status," "data," and "error" fields. Status 200 means success.
API ส่งกลับข้อมูล JSON ดูฟิลด์ "status" "data" และ "error" สถานะ 200 แปลว่าสำเร็จ

4Create a Video via API — สร้างวิดีโอผ่าน API

Send a POST request to /v2/video/generate with avatar_id, script, and voice parameters in JSON.
ส่ง POST request ไปที่ /v2/video/generate พร้อม avatar_id, script และ voice parameters ใน JSON

🌎 การใช้งานจริง
Real World Application

💼 In Real Life — ในชีวิตจริง

Thai tech startups integrate the HeyGen API into their platforms so customers can generate personalized video messages automatically.

สตาร์ทอัพเทคโนโลยีไทยผสาน HeyGen API เข้ากับแพลตฟอร์มของตน เพื่อให้ลูกค้าสร้างข้อความวิดีโอเฉพาะบุคคลได้โดยอัตโนมัติ

🧪 Quick Check — ตรวจสอบด่วน

Test your understanding — ทดสอบความเข้าใจ

0/3

Which sentence correctly uses Present Perfect (I have created... / The API has returned...)?

ประโยคใดใช้ Present Perfect (I have created... / The API has returned...) ถูกต้อง?

I have created an API key. (ฉันได้สร้างคีย์ API แล้ว)
Me has do work.
They is going yesterday.
He have not do it.
The first option correctly uses Present Perfect (I have created... / The API has returned...).

What is the Thai meaning of "rate limit"?

"rate limit" แปลว่าอะไร?

ขีดจำกัดอัตรา
การยืนยันตัวตน
JSON / เจสัน
คีย์ API
rate limit = ขีดจำกัดอัตรา

In the real world, heygen api fundamentals is important because:

ในโลกจริง พื้นฐาน API ของ HeyGen สำคัญเพราะ:

Thai tech startups integrate the HeyGen API into their platf
It is not used in Thailand.
Only for tourists.
Nobody needs it.
Thai tech startups integrate the HeyGen API into their platf

📝 การบ้าน
Homework

Task 1: Generate an API key on HeyGen (if you have access) or describe the process in Present Perfect.
สร้างคีย์ API บน HeyGen (ถ้ามีสิทธิ์เข้าถึง) หรืออธิบายขั้นตอนด้วย Present Perfect
Task 2: Write 6 sentences using Present Perfect about your API learning journey.
เขียน 6 ประโยค Present Perfect เกี่ยวกับเส้นทางการเรียนรู้ API ของคุณ
Task 3: Read the HeyGen API documentation and list 5 endpoints with descriptions.
อ่านเอกสาร HeyGen API แล้วระบุ 5 endpoints พร้อมคำอธิบาย
Task 4: Write a JSON request body for creating a video and explain each parameter.
เขียน JSON request body สำหรับการสร้างวิดีโอ และอธิบายแต่ละ parameter

🎉 ยินดีด้วย! / Congratulations!

คุณจบบทเรียนสัปดาห์ที่ 10 แล้ว!

You have completed Week 10: HeyGen API Fundamentals! Keep learning! ไปต่อกันเลย!