Create a batch
This endpoint creates a batch in a project.
HTTP Request
POST https://app.resemble.ai/api/v2/projects/<project_uuid>/batch
URL Parameters | Type | Description |
---|---|---|
project_uuid | string | UUID of the project to which the clip should belong |
JSON Body | Type | Description |
---|---|---|
body | string[] or string[string[]] | An array of strings where each string is content to be synthesized (this can be raw text or ssml) or an array of arrays where each element in the nested array conforms to the shape of ["title", "ssml"]. Max size of each element in the batch is 3,000 characters excluding ssml tags. Max size of the array is 1,000. |
voice_uuid | string | UUID of the voice to use for synthesizing |
callback_uri | (optional, see description) string | The URL to POST the result of the batch to. |
precision | (optional) one of the following values: PCM_32 , PCM_24 , PCM_16 , or MULAW | The audio bit depth of generated audio |
sample_rate | (optional) one of the following values: 8000 , 16000 , 22050 or 44100 | The sample rate (Hz) of the generated audio |
output_format | (optional) one of the following values: wav or mp3 | The format of the generated audio |
HTTP Response
{
"success": true,
"item": {
"uuid": <string>,
"body": Array<Array<string, string>>,
"voice_uuid": <string>,
"total_count": <number>,
"completed_count": <number>,
"failed_count": <number>,
"created_at": <UTC Date>,
"updated_at": <UTC Date>
}
}
HTTP Callback
The callback request will send a POST request to the callback URI provided. It will include a body of JSON:
{
"uuid": <string>,
"body": Array<Array<string, string>>,
"voice_uuid": <string>,
"total_count": <number>,
"completed_count": <number>,
"failed_count": <number>,
"clips": Array<Clip>,
"created_at": <UTC Date>,
"updated_at": <UTC Date>
}
Examples
Example where clips do not specify a title
NodeJS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { Resemble } from '@resemble/node'
Resemble.setApiKey('YOUR_API_TOKEN')
const projectUuid = '..'
const voiceUuid = '..'
// you can pass an additional options object as the last parameter with following structure. each option is optional
// refer https://docs.app.resemble.ai/docs/generate_speech/action_synthesize/resource_batch/create for more info
// const options = {
// callbackUri: <CALLBACK_URI>
// precision: 'PCM_32' | 'PCM_24' | 'PCM_16' | 'MULAW'
// sampleRate: 8000 | 16000 | 22050 | 44100
// outputFormat: 'wav' | 'mp3'
// }
const res = await Resemble.v2.batch.create(
projectUuid,
voiceUuid,
['Content A', 'Content B', 'Content C'],
options
)
Example where each clip specifies a title
NodeJS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { Resemble } from '@resemble/node'
Resemble.setApiKey('YOUR_API_TOKEN')
const projectUuid = '..'
const voiceUuid = '..'
// you can pass an additional options object as the last parameter with following structure. each option is optional
// refer https://docs.app.resemble.ai/docs/generate_speech/action_synthesize/resource_batch/create for more info
// const options = {
// callbackUri: <CALLBACK_URI>
// precision: 'PCM_32' | 'PCM_24' | 'PCM_16' | 'MULAW'
// sampleRate: 8000 | 16000 | 22050 | 44100
// outputFormat: 'wav' | 'mp3'
// }
const res = await Resemble.v2.batch.create(
projectUuid,
voiceUuid,
[["Title A", "Content A"], ["Title B", "Content B"], ["Title C", "Content C"]],
options
)
Try it out
API Key:
Project UUID:
JSON Body: