Save on Cloudflare R2
# support
a
Can someone provide guidance on the R2 https://docs.vapi.ai/providers/cloud/cloudflare As soon as we active this feature, what's going to happen to the API response? We are still getting the VAPI url, or are we getting the new URL pointing tot he R2 bucket?
Would be great if i can have an example of output with/without the feature being active, when we call the getCall api.
s
When you activate Cloudflare R2 integration, the recording URLs in your API responses will change from Vapi's default storage URLs to your configured R2 bucket URLs. However, the API response structure and field names remain exactly the same. Detailed Solution Here's exactly what happens to your
getCall
API response when R2 is activated: API Response Fields (These Stay the Same)
Copy code
json
{
  "artifact": {
    "recordingUrl": "URL_CHANGES_HERE",
    "stereoRecordingUrl": "URL_CHANGES_HERE", 
    "recording": {
      "mono": {
        "combinedUrl": "URL_CHANGES_HERE",
        "assistantUrl": "URL_CHANGES_HERE",
        "customerUrl": "URL_CHANGES_HERE"
      },
      "stereoUrl": "URL_CHANGES_HERE"
    }
  }
}
URL Structure Changes WITHOUT R2 (Default Vapi Storage):
Copy code
json
{
  "artifact": {
    "recordingUrl": "https://storage.vapi.ai/recordings/call-123-mono.wav",
    "stereoRecordingUrl": "https://storage.vapi.ai/recordings/call-123-stereo.wav",
    "recording": {
      "mono": {
        "combinedUrl": "https://storage.vapi.ai/recordings/call-123-mono.wav",
        "assistantUrl": "https://storage.vapi.ai/recordings/call-123-assistant.wav",
        "customerUrl": "https://storage.vapi.ai/recordings/call-123-customer.wav"
      },
      "stereoUrl": "https://storage.vapi.ai/recordings/call-123-stereo.wav"
    }
  }
}
WITH R2 Activated: The URL structure depends on your R2 configuration: Option 1 - Default R2 URLs (no custom domain):
Copy code
json
{
  "artifact": {
    "recordingUrl": "https://[your-account-id].r2.cloudflarestorage.com/[path]/call-123-mono.wav",
    "stereoRecordingUrl": "https://[your-account-id].r2.cloudflarestorage.com/[path]/call-123-stereo.wav",
    "recording": {
      "mono": {
        "combinedUrl": "https://[your-account-id].r2.cloudflarestorage.com/[path]/call-123-mono.wav",
        "assistantUrl": "https://[your-account-id].r2.cloudflarestorage.com/[path]/call-123-assistant.wav",
        "customerUrl": "https://[your-account-id].r2.cloudflarestorage.com/[path]/call-123-customer.wav"
      },
      "stereoUrl": "https://[your-account-id].r2.cloudflarestorage.com/[path]/call-123-stereo.wav"
    }
  }
}
Option 2 - Custom R2 Domain (if you set bucketPlan.url):
Copy code
json
{
  "artifact": {
    "recordingUrl": "https://your-custom-domain.com/[path]/call-123-mono.wav",
    "stereoRecordingUrl": "https://your-custom-domain.com/[path]/call-123-stereo.wav",
    "recording": {
      "mono": {
        "combinedUrl": "https://your-custom-domain.com/[path]/call-123-mono.wav",
        "assistantUrl": "https://your-custom-domain.com/[path]/call-123-assistant.wav", 
        "customerUrl": "https://your-custom-domain.com/[path]/call-123-customer.wav"
      },
      "stereoUrl": "https://your-custom-domain.com/[path]/call-123-stereo.wav"
    }
  }
}
Key Technical Details 1. Immediate Effect: Once R2 is configured, all new calls will use your R2 bucket URLs 2. Existing Calls: Previous calls will still have the old Vapi storage URLs 3. Fallback Mechanism: If R2 upload fails, Vapi automatically falls back to their default storage 4. Path Structure: Your recordings will be stored at
[bucket]/[optional-path]/[recording-filename]
Configuration Impact on URLs From the codebase analysis, the URL generation logic is: // If you provide a custom URL in bucketPlan.url: url =
${credential.bucketPlan.url}/${path}
// If no custom URL provided: url =
https://${credential.accountId}.r2.cloudflarestorage.com/${path}
a
Thanks mate! 😄