Hey folks,
I’m trying to build a sidecar service that controls call recordings programmatically. The use case is pretty specific: we need to pause recording while the agent is doing internal notes, then resume when they’re talking to the customer again.
I’ve been digging through the recording-related endpoints, but I’m stuck. I can see calls to GET /api/v2/conversations/{conversationId}/recordings to fetch existing recordings, but I don’t see a clear POST endpoint to start or stop a recording for an active conversation ID. The docs mention recordingStart and recordingStop events, but those seem to be for webhooks, not control.
I tried hitting PUT /api/v2/conversations/calls/{conversationId}/recordingstate but I’m not sure how to structure the body to toggle between start and stop. If I try to create one with a generic POST, it doesn’t seem to accept a simple state change, which isn’t what I want.
Here’s the snippet I’m testing with in Node:
const axios = require('axios');
async function toggleRecording(conversationId, action) {
// action is 'start' or 'stop'
const url = `https://mycompany.mygenesiscpu.com/api/v2/conversations/calls/${conversationId}/recordingstate`;
try {
const response = await axios.put(url, { recordingState: action }, {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});
console.log('Success:', response.data);
} catch (error) {
console.error('Failed:', error.response.status, error.response.data);
}
}
I’m getting 400s because I’m guessing at the request body structure. What’s the actual REST way to control this? Or am I forced to use the Architect flow to handle the recording state and just trigger the flow via API?