Voice
Update voice audio
Required scope: voice:manage
Renames an asset or changes its retention. Send expectedRevision to refuse the change with 409 voice_asset_revision_conflict when the asset changed since you read it.
PATCH
/
platform
/
voice
/
audio
/
{assetId}
Update voice audio
curl --request PATCH \
--url https://api.polymorfa.com/platform/voice/audio/{assetId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expectedRevision": 2,
"name": "<string>",
"retentionDays": 1825
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expectedRevision: 2, name: '<string>', retentionDays: 1825})
};
fetch('https://api.polymorfa.com/platform/voice/audio/{assetId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/platform/voice/audio/{assetId}"
payload = {
"expectedRevision": 2,
"name": "<string>",
"retentionDays": 1825
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/platform/voice/audio/{assetId}"
payload := strings.NewReader("{\n \"expectedRevision\": 2,\n \"name\": \"<string>\",\n \"retentionDays\": 1825\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}false{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"source": "upload",
"status": "pending_upload",
"failureReason": "unsupported_format",
"originalFormat": "mp3",
"originalContentType": "<string>",
"sizeBytes": 123,
"durationMs": 123,
"contentSha256": "<string>",
"tts": {
"provider": "elevenlabs",
"voiceId": "<string>",
"model": "<string>",
"text": "<string>",
"characters": 123,
"keySource": "managed",
"credentialId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"retentionDays": 123,
"expiresAt": "2023-11-07T05:31:56Z",
"inUseCount": 123,
"revision": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"readyAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_parameter",
"message": "Correct the invalid request field.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-parameter"
}{
"error": {
"type": "authentication_error",
"code": "invalid_credential",
"message": "Supply a valid credential.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-credential"
}{
"error": {
"type": "permission_error",
"code": "voice_not_enabled",
"message": "The Voice Automation beta is not enabled for this team.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#voice-not-enabled"
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "The resource is unavailable to this caller.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#resource-not-found"
}{
"error": {
"type": "conflict_error",
"code": "voice_asset_revision_conflict",
"message": "The audio asset changed since it was read.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#voice-asset-revision-conflict"
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "An unexpected service failure occurred. Keep the request ID for support.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#internal-error"
}Authorizations
Send your team API key or project token as Authorization: Bearer <token>. The credential must have the required permissions. Project tokens can access only their own project.
Path Parameters
Identifier for the asset.
Value constraints
| Constraint | Accepted input |
|---|---|
| Format | uuid |
Body
application/json
Apply the change only if the asset still has this revision.
Value constraints
| Constraint | Accepted input |
|---|---|
| Numeric value | 1 or greater |
Required range:
x >= 1Human-readable name for this resource.
Value constraints
| Constraint | Accepted input |
|---|---|
| String length | 1 through 100 characters |
Required string length:
1 - 100Null removes automatic deletion. Retention counts from creation.
Accepted alternatives
| Alternative | Accepted input |
|---|---|
| Alternative 1 | Type: integer; Numeric value: 1 through 3650 (inclusive) |
| Alternative 2 | null |
Value constraints
| Constraint | Accepted input |
|---|---|
| Numeric value | 1 through 3650 (inclusive) |
Required range:
1 <= x <= 3650Was this page helpful?
⌘I
Update voice audio
curl --request PATCH \
--url https://api.polymorfa.com/platform/voice/audio/{assetId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expectedRevision": 2,
"name": "<string>",
"retentionDays": 1825
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expectedRevision: 2, name: '<string>', retentionDays: 1825})
};
fetch('https://api.polymorfa.com/platform/voice/audio/{assetId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/platform/voice/audio/{assetId}"
payload = {
"expectedRevision": 2,
"name": "<string>",
"retentionDays": 1825
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/platform/voice/audio/{assetId}"
payload := strings.NewReader("{\n \"expectedRevision\": 2,\n \"name\": \"<string>\",\n \"retentionDays\": 1825\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}false{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"source": "upload",
"status": "pending_upload",
"failureReason": "unsupported_format",
"originalFormat": "mp3",
"originalContentType": "<string>",
"sizeBytes": 123,
"durationMs": 123,
"contentSha256": "<string>",
"tts": {
"provider": "elevenlabs",
"voiceId": "<string>",
"model": "<string>",
"text": "<string>",
"characters": 123,
"keySource": "managed",
"credentialId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"retentionDays": 123,
"expiresAt": "2023-11-07T05:31:56Z",
"inUseCount": 123,
"revision": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"readyAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_parameter",
"message": "Correct the invalid request field.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-parameter"
}{
"error": {
"type": "authentication_error",
"code": "invalid_credential",
"message": "Supply a valid credential.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-credential"
}{
"error": {
"type": "permission_error",
"code": "voice_not_enabled",
"message": "The Voice Automation beta is not enabled for this team.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#voice-not-enabled"
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "The resource is unavailable to this caller.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#resource-not-found"
}{
"error": {
"type": "conflict_error",
"code": "voice_asset_revision_conflict",
"message": "The audio asset changed since it was read.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#voice-asset-revision-conflict"
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "An unexpected service failure occurred. Keep the request ID for support.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#internal-error"
}