~/Documentation
เอกสาร

การยืนยันตัวตน

คำขอ API ทั้งหมดต้องยืนยันตัวตนด้วยโทเค็น Bearer

การใช้คีย์ API ของคุณ

รวมคีย์ API ของคุณในส่วนหัว Authorization ของทุกคำขอ:

Authorization: Bearer ${RENDERFUL_API_KEY}

Developer API keys typically start with sk_ (legacy keys may start with vega_). Agent keys start with rf_.

ตัวอย่างคำขอ

curl -X POST https://api.renderful.ai/api/v1/generations \
  -H "Authorization: Bearer ${RENDERFUL_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"type":"text-to-image","model":"flux-dev","prompt":"A sunset"}'

แนวทางปฏิบัติด้านความปลอดภัย

  • อย่าเปิดเผยคีย์ API ในโค้ดฝั่งไคลเอนต์
  • ใช้ตัวแปรสภาพแวดล้อมเพื่อเก็บคีย์ของคุณ
  • หมุนเวียนคีย์เป็นระยะ
  • ใช้คีย์ต่างกันสำหรับการพัฒนาและการใช้งานจริง

Balance endpoints by key type

Use the balance endpoint that matches the key prefix you are authenticating with.

Key TypePrefixBalance Endpoint
Developer API keysk_ / vega_GET /api/v1/account/balance
Agent API keyrf_GET /api/v1/agents/balance

Query developer balance

curl -X GET https://api.renderful.ai/api/v1/account/balance \
  -H "Authorization: Bearer sk_your_api_key"

รูปแบบคีย์ API

คีย์ API ของ Renderful มีรูปแบบเฉพาะเพื่อให้ระบุได้ง่าย:

คำนำหน้าคำอธิบาย
sk_Developer API key for dashboard-created server-side integrations
vega_Legacy developer API key format still accepted for existing integrations
rf_Agent API key returned by POST /api/v1/agents/register