~/Documentation
文件

身分驗證

所有 API 請求都需要使用 Bearer 權杖進行身分驗證。

使用您的 API 金鑰

在每個請求的 Authorization 標頭中包含您的 API 金鑰:

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 金鑰格式

Renderful API 金鑰遵循特定格式以便識別:

前綴描述
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