문서
문서
웹훅
웹훅은 생성 작업이 완료될 때 비동기 알림을 가능하게 합니다. API 결과를 폴링하는 대신, 웹훅 URL을 제공하여 생성 결과가 포함된 POST 요청을 받을 수 있습니다.
웹훅 사용하기
생성 요청에 {code} 매개변수를 추가하세요. 작업이 완료되거나 실패하면 엔드포인트로 POST 요청을 보냅니다:
{
"type": "text-to-image",
"model": "flux-dev",
"prompt": "A beautiful sunset over mountains",
"webhook_url": "https://your-app.com/webhooks/renderful"
}웹훅 페이로드
엔드포인트는 다음 JSON 페이로드가 포함된 POST 요청을 받습니다:
{
"event": "generation.completed",
"data": {
"id": "gen_abc123",
"status": "completed",
"model": "flux-dev",
"outputs": ["https://..."],
"created_at": "2024-01-15T10:30:00Z",
"completed_at": "2024-01-15T10:30:15Z"
}
}