Generate Customized AI Content
curl --request POST \
--url https://api.tryhamsa.com/v1/jobs/ai-content/custom \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"aiParts": [
{
"aiPart": "<string>",
"prompt": "<string>"
}
],
"webhookUrl": "<string>",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
}
}
'import requests
url = "https://api.tryhamsa.com/v1/jobs/ai-content/custom"
payload = {
"aiParts": [
{
"aiPart": "<string>",
"prompt": "<string>"
}
],
"webhookUrl": "<string>",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
}
}
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({
aiParts: [{aiPart: '<string>', prompt: '<string>'}],
webhookUrl: '<string>',
webhookAuth: {authKey: 'Token', authSecret: 'Secret'}
})
};
fetch('https://api.tryhamsa.com/v1/jobs/ai-content/custom', 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/v1/jobs/ai-content/custom",
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([
'aiParts' => [
[
'aiPart' => '<string>',
'prompt' => '<string>'
]
],
'webhookUrl' => '<string>',
'webhookAuth' => [
'authKey' => 'Token',
'authSecret' => 'Secret'
]
]),
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/v1/jobs/ai-content/custom"
payload := strings.NewReader("{\n \"aiParts\": [\n {\n \"aiPart\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n ],\n \"webhookUrl\": \"<string>\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n }\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/v1/jobs/ai-content/custom")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"aiParts\": [\n {\n \"aiPart\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n ],\n \"webhookUrl\": \"<string>\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/jobs/ai-content/custom")
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 \"aiParts\": [\n {\n \"aiPart\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n ],\n \"webhookUrl\": \"<string>\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"message": "success",
"data": {
"id": "<string>",
"title": "<string>",
"model": "<string>",
"type": "AI_CONTENT",
"processingType": "<string>",
"webhookUrl": "<string>",
"totalCost": 123,
"usageTime": "<string>",
"mediaUrl": "<string>",
"jobResponse": null,
"relevantJobId": "<string>",
"apiKeyId": "<string>",
"billingId": "<string>",
"userId": "<string>",
"systemModelKey": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}AI Docs Routes
Create Customized AI Content Route
Generates AI content based on the specified transcription job ID and parameters.
POST
/
v1
/
jobs
/
ai-content
/
custom
Generate Customized AI Content
curl --request POST \
--url https://api.tryhamsa.com/v1/jobs/ai-content/custom \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"aiParts": [
{
"aiPart": "<string>",
"prompt": "<string>"
}
],
"webhookUrl": "<string>",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
}
}
'import requests
url = "https://api.tryhamsa.com/v1/jobs/ai-content/custom"
payload = {
"aiParts": [
{
"aiPart": "<string>",
"prompt": "<string>"
}
],
"webhookUrl": "<string>",
"webhookAuth": {
"authKey": "Token",
"authSecret": "Secret"
}
}
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({
aiParts: [{aiPart: '<string>', prompt: '<string>'}],
webhookUrl: '<string>',
webhookAuth: {authKey: 'Token', authSecret: 'Secret'}
})
};
fetch('https://api.tryhamsa.com/v1/jobs/ai-content/custom', 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/v1/jobs/ai-content/custom",
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([
'aiParts' => [
[
'aiPart' => '<string>',
'prompt' => '<string>'
]
],
'webhookUrl' => '<string>',
'webhookAuth' => [
'authKey' => 'Token',
'authSecret' => 'Secret'
]
]),
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/v1/jobs/ai-content/custom"
payload := strings.NewReader("{\n \"aiParts\": [\n {\n \"aiPart\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n ],\n \"webhookUrl\": \"<string>\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n }\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/v1/jobs/ai-content/custom")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"aiParts\": [\n {\n \"aiPart\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n ],\n \"webhookUrl\": \"<string>\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/jobs/ai-content/custom")
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 \"aiParts\": [\n {\n \"aiPart\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n ],\n \"webhookUrl\": \"<string>\",\n \"webhookAuth\": {\n \"authKey\": \"Token\",\n \"authSecret\": \"Secret\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"message": "success",
"data": {
"id": "<string>",
"title": "<string>",
"model": "<string>",
"type": "AI_CONTENT",
"processingType": "<string>",
"webhookUrl": "<string>",
"totalCost": 123,
"usageTime": "<string>",
"mediaUrl": "<string>",
"jobResponse": null,
"relevantJobId": "<string>",
"apiKeyId": "<string>",
"billingId": "<string>",
"userId": "<string>",
"systemModelKey": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Authorizations
Pass the API key in the Authorization header, You need to put Token keyword before the API key. e.g. 'Authorization: Token '
Query Parameters
Body
application/json
Parameters for generating AI content.
The AI parts to generate content for. AI parts array should have at least one AI part object, with an aiPart (title), the language to return the content for the part in, and the prompt to use.
Show child attributes
Show child attributes
Authorization header to be sent in this format: Authorization: [authKey] [authSecret]
Show child attributes
Show child attributes
Was this page helpful?
⌘I