Skip to main content
Version: 1.0.0

Create a new clip (async)

Creates a new clip asynchronously. This endpoint expects valid JSON with a data attribute that represents the Clip resource. We also support callback urls, where you can define a service that will recieve a POST request when the clip has been completed. The voice attribute must be the UUID of a voice that you have access to. To find your voices, please see the endpoint to list all voices associated to your account.

The optional output_format parameter will change the output format of the generated audio. The options are mp3 or wav (default).

The optional precision parameter will change the precision (bit depth) of the WAV output. By default, the parameter is set to PCM_32 therefore generating a 32-bit WAV file. A developer can choose from PCM_16, PCM_24, and PCM_32.

HTTP Request

POST https://app.resemble.ai/api/v1/projects/<project_uuid>/clips

URL ParameterDescription
project_uuidThe uuid of the project to fetch
JSON Body ParameterDescription
dataA clip resource to generate (see Clip Resource page)
callback_uriThe URL that Resemble will POST back to with the synthesized audio.
output_formatOptions: wav (default), mp3
precisionOnly applies if output_format is wav. Options: PCM_16, PCM_24, PCM_32 (default).
tip
webhook.site is a great development tool for testing callbacks. :::

HTTP Response

{
"status": "OK",
"id": <clip_id>,
"project_id": <project_id>
}

HTTP Callback Response

The callback request will send a POST request to the callback URI provided. It will include a body of JSON:

{
"id": <id>,
"project_id": <project_id>,
"url": <url to audio - expires after 1 hour>,
"audio_timestamps": {
"graph_chars": <string[]>,
"graph_times": <float[[]]>,
"phon_chars": <string[]>,
"phon_times": <float[[]]>
},
"issues": ["<issues will only be present if there were synthesis issues>"]
}

Examples

Make sure you replace YOUR_API_TOKEN with your own! :::

cURL

curl --location --request POST 'https://app.resemble.ai/api/v1/projects/<project_uuid>/clips' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"data": {
"body": <text or ssml to synthesize>,
"voice": <voice uuid>,
"title": <title of clip>
},
"precision": "PCM_16|PCM_24|PCM_32 (default)",
"output_format": "mp3|wav (default)",
"callback_uri": <your callback uri>
}'

Python

import requests

url = "https://app.resemble.ai/api/v1/projects/<project_uuid>/clips"
headers = {
'Authorization': 'Token token=YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
data = {
'data': {
'title': 'Episode 1',
'body': 'Welcome to episode 1! This is everything about curries.',
'voice': '2b5f4ff3'
},
"callback_uri": "https://mycall.back/service"
}

response = requests.post(url, headers=headers, json=data)