Recording Webhook Integration
Confirm with Genfin that Recording API is enabled for your organization before sending production traffic.
Use this integration when your backend processes audio before sending it to Genfin. Upload the final audio to your Google Cloud Storage or S3 bucket, generate a signed GET URL, then submit that URL and a stable recording ID. Genfin downloads the audio and runs your configured transcription and analysis. Avoid ingesting the same calls through another integration if that would also send unprocessed audio.
Your existing organization PII settings still apply to submitted recordings. When PII redaction is enabled, audio playback becomes unavailable after processing; the saved transcript remains available in Genfin. Processing audio in your own backend does not automatically change this setting.
Connect
An organization administrator opens Organization → Integrations → Recording API and clicks Connect. No bucket or folder registration is needed.
Use direct GCS XML object URLs or S3 virtual-hosted object URLs with the correct bucket region. Custom domains, websites, extra request headers and arbitrary fetch destinations are unsupported. The account that connects the integration is the attribution user.
Create a named key under Settings → API Keys. All active organization keys can submit when this integration is enabled; naming a separate key helps rotation but does not restrict its permissions. Revoke compromised keys there. Disconnecting blocks new submissions but cannot revoke media URLs already queued for processing.
Prepare a signed audio URL
Upload the final processed audio to a private object in your own GCS or S3 bucket. Generate a V4 signed URL for an HTTPS GET request that requires only the normal host header. Genfin downloads the file directly; you do not upload the audio bytes to this endpoint or share cloud credentials.
Supported URL shapes (the signature query string must be retained in full):
- Google Cloud Storage:
https://storage.googleapis.com/YOUR_BUCKET/processed/call.mp3?... - Amazon S3:
https://YOUR_BUCKET.s3.YOUR_REGION.amazonaws.com/processed/call.mp3?...
Use a direct object URL, not a storage console link, folder URL, website, custom domain, or URL requiring extra headers. Use the correct S3 bucket region. No bucket whitelist or folder registration is needed.
Provide a URL with at least one hour of validity remaining at submission; 24 hours is recommended. You are responsible for this lifetime, including any earlier temporary-credential expiry for S3. The API does not check or track expiry. Keep the object available until the recording has finished processing in Genfin. Treat the signed URL as a credential and keep object names free of PII.
Submit audio
Send POST https://api.genfin.ai/api/v1/recordings with:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"external_id": "processed-recording-001",
"recording_url": "YOUR_V4_SIGNED_GET_URL",
"started_at": "2026-11-01T11:00:00Z",
"direction": "outbound",
"from_number": "+12025550100",
"to_number": "+12025550123",
"agent_name": "Example Agent"
}
Replace the example URL, dates and call metadata with your own values. Send the signed URL unchanged, including its complete query string.
Required fields
Include these on every submission, including retries and URL refreshes:
| Field | What to send |
|---|---|
external_id |
Your stable, nonempty ID for one processed recording or segment, up to 255 characters. Reuse it for retries; use a new ID for different audio or a different redaction version. |
recording_url |
The complete signed HTTPS GET URL for the processed audio in your GCS or S3 bucket. |
started_at |
The call's actual start time as an ISO 8601 timestamp with a timezone. |
direction |
Exactly inbound or outbound. |
from_number |
Required caller number, preferably in E.164 format, such as +12025550100. |
to_number |
Required dialed number, preferably in E.164 format, such as +12025550123. |
agent_id or agent_name |
Exactly one: a positive existing Genfin agent ID belonging to your organization, or a nonempty agent name up to 255 characters. A name is resolved through your organization's aliases and may create a new agent. |
Use agent_name when your backend does not store Genfin agent IDs. If you send agent_id, it must be a Genfin ID, not an ID from your telephony provider. Do not send both. Missing or unsupported direction, missing or unusable phone numbers, and missing, blank or conflicting agent fields return 422 before a new recording is created or queued.
Both phone numbers are required on every submission, including retries and URL refreshes. Missing, null, blank, masked or unusable values return 422. Phone fields accept up to 100 characters and use Genfin's existing normalization: 10-digit numbers receive the +1 country code, and numbers with 11–15 digits retain their country code. Prefer E.164 to avoid ambiguity; common formatting such as (202) 555-0123 is accepted. Caller and dialed roles do not change with direction.
Optional fields
| Field | What to send |
|---|---|
customer_name |
Customer name, up to 255 characters; used only with a usable customer phone number. |
title |
Display title for the recording, up to 255 characters. Defaults to Processed recording. |
Inbound calls use from_number for customer matching and outbound calls use to_number. Customer names are optional descriptive metadata, not a matching key; an existing customer name is preserved. Additional fields are rejected; send only the documented fields.
Submission response
The response contains only recording_id and duplicate:
{"recording_id": 123, "duplicate": false}
New submissions return 202 after the recording is saved and the queue accepts the request. Existing IDs return 200 with duplicate: true. Processing happens asynchronously; view the recording, transcript and analysis in Genfin. Acceptance does not guarantee completion before URL expiry.
Python example
Install the dependency with python -m pip install requests. Set these environment variables in your shell or deployment configuration:
GENFIN_API_KEY: the organization API key created above.RECORDING_URL: your signed GET URL for the processed audio.
Replace the sample call ID, start time, direction, agent and required phone numbers below. Save as submit_recording.py and run python submit_recording.py. Keep API keys and signed URLs out of source control and logs.
import os
import requests
API_BASE_URL = "https://api.genfin.ai"
headers = {"Authorization": f"Bearer {os.environ['GENFIN_API_KEY']}"}
payload = {
"external_id": "processed-call-001", # Keep stable for this audio.
"recording_url": os.environ["RECORDING_URL"],
"started_at": "2026-11-01T11:00:00Z", # Replace with the call start time.
"direction": "outbound", # inbound or outbound
"agent_name": "Example Agent", # Or agent_id, but not both.
"from_number": "+12025550100",
"to_number": "+12025550123",
}
response = requests.post(
f"{API_BASE_URL}/api/v1/recordings",
headers=headers,
json=payload,
timeout=30,
)
response.raise_for_status()
recording = response.json()
print("Recording:", recording["recording_id"], "Duplicate:", recording["duplicate"])
This example submits once, raises an error for unsuccessful HTTP responses and uses a 30-second timeout. After success, view the recording in Genfin.
Retry timeouts, 429, and 5xx with the same external_id, using backoff and honoring Retry-After. Send requests for the same ID sequentially; overlapping first submissions can create duplicates. A 503 can occur after the recording was saved, so retry it. Correct other 4xx errors before retrying. If the signed URL expires before download, generate a fresh URL and resubmit the same ID with all required metadata. After success, do not repeatedly resubmit to check progress.
Retries preserve completed audio and saved call metadata. Use a new ID for different audio or a different redaction version.
Troubleshooting
| Result | What to check or do |
|---|---|
401 |
Supply a valid organization API key in the Authorization: Bearer ... header. Check that the key has not been revoked. |
403 |
Connect Recording API in the same organization as the key. The response may also indicate an attribution-account configuration issue or that the organization's recording allowance has been reached. |
422 |
Check required fields, both phone numbers, direction, the agent ID/name choice, timezone-aware timestamps and signed-URL format. Do not retry unchanged invalid input. |
429 |
Slow down and retry with exponential backoff and jitter, honoring Retry-After when supplied. |
5xx or a network timeout |
Retry the same external_id and required metadata. A failed enqueue can return 503 after metadata has already been saved; keep the same ID to recover the saved recording. |
| Recording has not finished processing | Check the recording in Genfin. If the URL expired before download, resubmit with a fresh URL and the same ID. Contact Genfin if progress stalls. |
| Playback unavailable after transcription | Check your organization's PII redaction setting. With PII enabled, audio playback is removed after processing even when you processed the original audio yourself. |
The API uses your organization's existing recording allowance and shared public API rate limits. Before production traffic, verify a representative signed object through your enabled Genfin environment, including playback under your PII settings, transcription, expected analysis, file format/size and URL lifetime.
Google signed URLs · S3 presigned URLs and temporary credentials