Create voice audio upload
Required scope: voice:manage
Creates an audio asset and returns a URL to send the file to. Send the file with POST and the returned headers within 5 minutes, then call POST /platform/voice/audio/{assetId}/complete. MP3, WAV, OGG (Opus or Vorbis) and M4A (AAC), up to 16 MB and 10 minutes of audio.
curl --request POST \
--url https://api.polymorfa.com/platform/voice/audio \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"sizeBytes": 8388608
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', sizeBytes: 8388608})
};
fetch('https://api.polymorfa.com/platform/voice/audio', 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"
payload = {
"name": "<string>",
"sizeBytes": 8388608
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"sizeBytes\": 8388608\n}")
req, _ := http.NewRequest("POST", 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": {
"asset": {
"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"
},
"upload": {
"url": "<string>",
"method": "POST",
"headers": {},
"maxBytes": 123,
"expiresAt": "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": "gate_limit_reached",
"message": "A usage limit for this team or number was reached.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#gate-limit-reached"
}{
"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": "state_conflict",
"message": "The request conflicts with the resource state.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#state-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"
}{
"error": {
"type": "api_error",
"code": "voice_unavailable",
"message": "Voice Automation storage is not available.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#voice-unavailable"
}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.
Body
Human-readable name for this resource.
Value constraints
| Constraint | Accepted input |
|---|---|
| String length | 1 through 100 characters |
1 - 100IANA media type that matches the payload.
Allowed values
| Value | Meaning |
|---|---|
audio/mpeg | Audio/mpeg. |
audio/wav | Audio/wav. |
audio/x-wav | Audio/x wav. |
audio/ogg | Audio/ogg. |
audio/mp4 | Audio/mp4. |
audio/x-m4a | Audio/x m4a. |
Value constraints
| Constraint | Accepted input |
|---|---|
| Media type | IANA type/subtype value matching the payload, such as audio/ogg, audio/mpeg, or audio/aac |
audio/mpeg, audio/wav, audio/x-wav, audio/ogg, audio/mp4, audio/x-m4a File size in bytes, at most 16 MB.
Value constraints
| Constraint | Accepted input |
|---|---|
| Numeric value | 1 through 16777216 (inclusive) |
1 <= x <= 16777216Project that owns the asset. Required for organization keys.
Value constraints
| Constraint | Accepted input |
|---|---|
| Format | uuid |
Delete the asset automatically this many days after creation (1 to 3650). Omit to keep it until you delete it.
Value constraints
| Constraint | Accepted input |
|---|---|
| Numeric value | 1 through 3650 (inclusive) |
1 <= x <= 3650Was this page helpful?
curl --request POST \
--url https://api.polymorfa.com/platform/voice/audio \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"sizeBytes": 8388608
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', sizeBytes: 8388608})
};
fetch('https://api.polymorfa.com/platform/voice/audio', 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"
payload = {
"name": "<string>",
"sizeBytes": 8388608
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"sizeBytes\": 8388608\n}")
req, _ := http.NewRequest("POST", 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": {
"asset": {
"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"
},
"upload": {
"url": "<string>",
"method": "POST",
"headers": {},
"maxBytes": 123,
"expiresAt": "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": "gate_limit_reached",
"message": "A usage limit for this team or number was reached.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#gate-limit-reached"
}{
"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": "state_conflict",
"message": "The request conflicts with the resource state.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#state-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"
}{
"error": {
"type": "api_error",
"code": "voice_unavailable",
"message": "Voice Automation storage is not available.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#voice-unavailable"
}