Create Job
curl --request POST \
--url https://api.tryhamsa.com/v2/jobs \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "TRANSCRIPTION",
"apiKey": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"mediaUrl": "https://example.com/audio.mp3",
"title": "Meeting Notes",
"language": "ar",
"processingType": "async",
"webhookUrl": "https://webhook.site/123"
}
'import requests
url = "https://api.tryhamsa.com/v2/jobs"
payload = {
"type": "TRANSCRIPTION",
"apiKey": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"mediaUrl": "https://example.com/audio.mp3",
"title": "Meeting Notes",
"language": "ar",
"processingType": "async",
"webhookUrl": "https://webhook.site/123"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'TRANSCRIPTION',
apiKey: 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
mediaUrl: 'https://example.com/audio.mp3',
title: 'Meeting Notes',
language: 'ar',
processingType: 'async',
webhookUrl: 'https://webhook.site/123'
})
};
fetch('https://api.tryhamsa.com/v2/jobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryhamsa.com/v2/jobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'TRANSCRIPTION',
'apiKey' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'mediaUrl' => 'https://example.com/audio.mp3',
'title' => 'Meeting Notes',
'language' => 'ar',
'processingType' => 'async',
'webhookUrl' => 'https://webhook.site/123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v2/jobs"
payload := strings.NewReader("{\n \"type\": \"TRANSCRIPTION\",\n \"apiKey\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"mediaUrl\": \"https://example.com/audio.mp3\",\n \"title\": \"Meeting Notes\",\n \"language\": \"ar\",\n \"processingType\": \"async\",\n \"webhookUrl\": \"https://webhook.site/123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.tryhamsa.com/v2/jobs")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"TRANSCRIPTION\",\n \"apiKey\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"mediaUrl\": \"https://example.com/audio.mp3\",\n \"title\": \"Meeting Notes\",\n \"language\": \"ar\",\n \"processingType\": \"async\",\n \"webhookUrl\": \"https://webhook.site/123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"TRANSCRIPTION\",\n \"apiKey\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"mediaUrl\": \"https://example.com/audio.mp3\",\n \"title\": \"Meeting Notes\",\n \"language\": \"ar\",\n \"processingType\": \"async\",\n \"webhookUrl\": \"https://webhook.site/123\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Transcription started, you will receive en email when it's ready",
"messageKey": "OPERATION_SUCCESSFUL",
"data": {
"jobId": "ed9b5601-f731-441a-8500-d9fc7610ef8f"
}
}{
"code": 9400,
"message": "The Media Url field is required!",
"messageKey": "FieldMustBeString"
}{
"success": false,
"code": 500,
"message": "Internal server error"
}Speech-to-Text Routes
Create Speech to Text
Create a transcription job.
POST
/
v2
/
jobs
Create Job
curl --request POST \
--url https://api.tryhamsa.com/v2/jobs \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "TRANSCRIPTION",
"apiKey": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"mediaUrl": "https://example.com/audio.mp3",
"title": "Meeting Notes",
"language": "ar",
"processingType": "async",
"webhookUrl": "https://webhook.site/123"
}
'import requests
url = "https://api.tryhamsa.com/v2/jobs"
payload = {
"type": "TRANSCRIPTION",
"apiKey": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"mediaUrl": "https://example.com/audio.mp3",
"title": "Meeting Notes",
"language": "ar",
"processingType": "async",
"webhookUrl": "https://webhook.site/123"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'TRANSCRIPTION',
apiKey: 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
mediaUrl: 'https://example.com/audio.mp3',
title: 'Meeting Notes',
language: 'ar',
processingType: 'async',
webhookUrl: 'https://webhook.site/123'
})
};
fetch('https://api.tryhamsa.com/v2/jobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryhamsa.com/v2/jobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'TRANSCRIPTION',
'apiKey' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'mediaUrl' => 'https://example.com/audio.mp3',
'title' => 'Meeting Notes',
'language' => 'ar',
'processingType' => 'async',
'webhookUrl' => 'https://webhook.site/123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v2/jobs"
payload := strings.NewReader("{\n \"type\": \"TRANSCRIPTION\",\n \"apiKey\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"mediaUrl\": \"https://example.com/audio.mp3\",\n \"title\": \"Meeting Notes\",\n \"language\": \"ar\",\n \"processingType\": \"async\",\n \"webhookUrl\": \"https://webhook.site/123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}HttpResponse<String> response = Unirest.post("https://api.tryhamsa.com/v2/jobs")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"TRANSCRIPTION\",\n \"apiKey\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"mediaUrl\": \"https://example.com/audio.mp3\",\n \"title\": \"Meeting Notes\",\n \"language\": \"ar\",\n \"processingType\": \"async\",\n \"webhookUrl\": \"https://webhook.site/123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v2/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"TRANSCRIPTION\",\n \"apiKey\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\n \"mediaUrl\": \"https://example.com/audio.mp3\",\n \"title\": \"Meeting Notes\",\n \"language\": \"ar\",\n \"processingType\": \"async\",\n \"webhookUrl\": \"https://webhook.site/123\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Transcription started, you will receive en email when it's ready",
"messageKey": "OPERATION_SUCCESSFUL",
"data": {
"jobId": "ed9b5601-f731-441a-8500-d9fc7610ef8f"
}
}{
"code": 9400,
"message": "The Media Url field is required!",
"messageKey": "FieldMustBeString"
}{
"success": false,
"code": 500,
"message": "Internal server error"
}Authorizations
Pass the API key in the Authorization header, You need to put Token keyword before the API key. e.g. 'Authorization: Token '
Body
application/json
Request body containing the job payload
Available options:
TRANSCRIPTION Example:
"TRANSCRIPTION"
Example:
"f47ac10b-58cc-4372-a567-0e02b2c3d479"
Minimum string length:
1Example:
"https://example.com/audio.mp3"
Minimum string length:
1Example:
"Meeting Notes"
Language code for the media being transcribed
Available options:
ar, en Example:
"ar"
Available options:
async, sync Example:
"async"
Minimum string length:
1Example:
"https://webhook.site/123"
Show child attributes
Show child attributes
Was this page helpful?
⌘I