Process audio

This page provides basic code samples that you can use to start processing your audio with the Async API.


Submit an audio file

To submit an .mp3 or .wav/wave file to the Async API, use the following operation:

POST https://api.symbl.ai/v1/process/audio

👍

Try our interactive examples!

We provide interactive versions of these code samples: curl, Node.js, Python

To get started with our code samples, see Set Up Your Test Environment.

ACCESS_TOKEN="<ACCESS_TOKEN>"
CONVERSATION_NAME="<NAME>"
FILE_PATH="<FILE>"
TYPE="<TYPE>"

curl \
  --url "https://api.symbl.ai/v1/process/audio?name=$CONVERSATION_NAME" \
  --header "Content-Type: $TYPE" \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --data-binary "@$FILE_PATH"
import fetch from 'node-fetch';
import fs from 'fs';
import qs from 'qs';

const accessToken = '<ACCESS_TOKEN>';
const filePath = '<FILE>';
const symblaiParams = {
  'name': '<NAME>'
}
const contentType = '<TYPE>';

const fetchResponse = await fetch(`https://api.symbl.ai/v1/process/audio?${qs.stringify(symblaiParams)}`, {
  method: 'post',
  body: fs.createReadStream(filePath),
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': contentType,
  }
});

const responseBody = await fetchResponse.json();

console.log(responseBody);
import os
import requests

access_token = "<ACCESS_TOKEN>"
file_path = "<FILE>"
symblai_params = {
  "name": "<NAME>"
}
content_type = "<TYPE>"

headers = {
  "Authorization": "Bearer " + access_token,
  "Content-Type": content_type
}

with open(file_path, "rb") as file:
  request_body = file.read()

response = requests.request(
  method="POST", 
  url="https://api.symbl.ai/v1/process/audio",
  params=symblai_params,
  headers=headers,
  data=request_body
)

print(response.json())

Where:

  • <ACCESS_TOKEN> is a valid API access token.
  • <FILE> is the local path to the audio file that you want to submit to the Async API.
  • <NAME> is the name of the conversation. If no name is provided, the Async API sets the name to the conversation ID. For curl, because the name is a query parameter, this value must be URL encoded. For example, the URL-encoded format of Business Meeting 2022-01-01 is Business%20Meeting%202022-01-01.
  • <TYPE> is the type of audio file. Valid values are audio/mp3, audio/mpeg, audio/wav, and audio/wave. If your audio file does not match one of the listed types, remove the Content-Type header.

For additional reference information, see Submit audio (File).

To learn more about the optional parameters that you can apply to your request, see Async Feature Reference.


Submit an audio URL

To submit an audio URL to the Async API, use the following operation:

POST https://api.symbl.ai/v1/process/audio/url

👍

Try our interactive examples!

We provide interactive versions of these code samples: curl, Node.js, Python

To get started with our code samples, see Set Up Your Test Environment.

ACCESS_TOKEN="<ACCESS_TOKEN>"
CONVERSATION_NAME="<NAME>"
FILE_URL="<URL>"

curl \
  --url "https://api.symbl.ai/v1/process/audio/url" \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --data '{
    "name": "'"$CONVERSATION_NAME"'",
    "url": "'"$FILE_URL"'"
  }'
import fetch from 'node-fetch';

const accessToken = '<ACCESS_TOKEN>';
const symblaiParams = {
  'name': '<NAME>',
  'url': '<URL>'
}

const fetchResponse = await fetch('https://api.symbl.ai/v1/process/audio/url', {
  method: 'post',
  body: JSON.stringify(symblaiParams),
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': 'application/json'
  }
});

const responseBody = await fetchResponse.json();

console.log(responseBody);
import requests

access_token = "<ACCESS_TOKEN>"
symblai_params = {
  "name": "<NAME>",
  "url": "<URL>"
}

headers = {
  "Authorization": "Bearer " + access_token,
  "Content-Type": "application/json"
}

response = requests.request(
  method="POST", 
  url="https://api.symbl.ai/v1/process/audio/url",
  headers=headers,
  json=symblai_params
)

print(response.json())

Where:

  • <ACCESS_TOKEN> is a valid API access token.
  • <NAME> is the name of the conversation. For example, Business Meeting 2022-01-01. If no name is provided, the Async API sets the name to the conversation ID.
  • <URL> is a direct URL to a supported audio file. For example:
https://www.example.com/files/example_audio.mp3

For additional reference information, see Submit audio (URL).

To learn more about the optional parameters that you can apply to your request, see Async Feature Reference.


Append an audio file

After you process a conversation with the Symbl.ai APIs, you can use the Async API to add additional content to the conversation. For example, you can use the Async API to collect a series of recordings with one customer under one conversation ID.

👍

Try our interactive examples!

We provide interactive versions of these code samples: curl, Node.js, Python

To get started with our code samples, see Set Up Your Test Environment.

ACCESS_TOKEN="<ACCESS_TOKEN>"
CONVERSATION_ID="<CONVERSATION_ID>"
CONVERSATION_NAME="<NAME>"
FILE_PATH="<FILE>"
TYPE="<TYPE>"

curl --request PUT \
  --url "https://api.symbl.ai/v1/process/audio/$CONVERSATION_ID?name=$CONVERSATION_NAME" \
  --header "Content-Type: $TYPE" \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --data-binary "@$FILE_PATH"
import fetch from 'node-fetch';
import fs from 'fs';
import qs from 'qs';

const accessToken = '<ACCESS_TOKEN>';
const conversationId = '<CONVERSATION_ID>';
const filePath = '<FILE>';
const symblaiParams = {
  'name': '<NAME>'
}
const contentType = '<TYPE>';

const fetchResponse = await fetch(`https://api.symbl.ai/v1/process/audio/${conversationId}?${qs.stringify(symblaiParams)}`, {
  method: 'put',
  body: fs.createReadStream(filePath),
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': contentType,
  }
});

const responseBody = await fetchResponse.json();

console.log(responseBody);
import requests

access_token = "<ACCESS_TOKEN>"
conversation_id = "<CONVERSATION_ID>"
file_path = "<FILE>"
symblai_params = {
  "name": "<NAME>"
}
content_type = "<TYPE>"

headers = {
  "Authorization": "Bearer " + access_token,
  "Content-Type": content_type
}

with open(file_path, "rb") as file:
  request_body = file.read()

response = requests.request(
  method="PUT", 
  url="https://api.symbl.ai/v1/process/audio/" + conversation_id,
  params=symblai_params,
  headers=headers,
  data=request_body
)

print(response.json())

Where:

  • <ACCESS_TOKEN> is a valid API access token.
  • <CONVERSATION_ID> is the ID of a conversation that you previously processed.
  • <FILE> is the local path to the audio file that you want to submit to the Async API.
  • <NAME> is the name of the conversation. If no name is provided, the Async API sets the name to the conversation ID. For curl, because the name is a query parameter, this value must be URL encoded. For example, the URL-encoded format of Business Meeting 2022-01-01 is Business%20Meeting%202022-01-01.
  • <TYPE> is the type of audio file. Valid values are audio/mp3, audio/mpeg, audio/wav, and audio/wave. If your audio file does not match one of the listed types, remove the Content-Type header.

For additional reference information, see Append audio (File).

To learn more about the optional parameters that you can apply to your request, see Async Feature Reference.


Append an audio URL

👍

Try our interactive examples!

We provide interactive versions of these code samples: curl, Node.js, Python

To get started with our code samples, see Set Up Your Test Environment.

ACCESS_TOKEN="<ACCESS_TOKEN>"
CONVERSATION_ID="<CONVERSATION_ID>"
CONVERSATION_NAME="<NAME>"
FILE_URL="<URL>"

curl --request PUT \
  --url "https://api.symbl.ai/v1/process/audio/url/$CONVERSATION_ID" \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --data '{
    "name": "'"$CONVERSATION_NAME"'",
    "url": "'"$FILE_URL"'"
  }'
import fetch from 'node-fetch';

const accessToken = '<ACCESS_TOKEN>';
const conversationId = '<CONVERSATION_ID>';
const symblaiParams = {
  'name': '<NAME>',
  'url': '<URL>'
}

const fetchResponse = await fetch(`https://api.symbl.ai/v1/process/audio/url/${conversationId}`, {
  method: 'put',
  body: JSON.stringify(symblaiParams),
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': 'application/json'
  }
});

const responseBody = await fetchResponse.json();

console.log(responseBody);
import requests

access_token = "<ACCESS_TOKEN>"
conversation_id = "<CONVERSATION_ID>"
symblai_params = {
  "name": "<NAME>",
  "url": "<URL>"
}

headers = {
  "Authorization": "Bearer " + access_token,
  "Content-Type": "application/json"
}

response = requests.request(
  method="PUT", 
  url="https://api.symbl.ai/v1/process/audio/url/" + conversation_id,
  headers=headers,
  json=symblai_params
)

print(response.json())

Where:

  • <ACCESS_TOKEN> is a valid API access token.
  • <CONVERSATION_ID> is the ID of a conversation that you previously processed.
  • <NAME> is the name of the conversation. If no name is provided, the Async API sets the name to the conversation ID. For curl, because the name is a query parameter, this value must be URL encoded. For example, the URL-encoded format of Business Meeting 2022-01-01 is Business%20Meeting%202022-01-01.
  • <URL> is a direct URL to a supported audio file. For example:
https://www.example.com/files/example_audio.mp3

For additional reference information, see Append audio (URL).

To learn more about the optional parameters that you can apply to your request, see Async Feature Reference.


Response

The Async API returns a common response for all submit and append requests. The following table describes the fields in the response.

FieldDescription
conversationIdThe unique identifier of a conversation that is submitted to the Async API. The conversation ID is critical for generating Conversation Intelligence.
jobIdThe unique identifier of the processing job. The job ID can be used to get the status of the job.

Example response

The following is an example of the common response for submit and append requests to the Async API.

{
  conversationId: '5784375198220288',
  jobId: 'cf4a68fe-225a-4946-9819-d961d7a31058'
}