from magic_hour import Client
from os import getenv
client = Client(token=getenv("API_TOKEN"))
res = client.v1.audio_projects.get(id="cuid-example")import { Client } from "magic-hour";
const client = new Client({ token: process.env["API_TOKEN"]!! });
const res = await client.v1.audioProjects.get({ id: "cuid-example" });package main
import (
os "os"
sdk "github.com/magichourhq/magic-hour-go/client"
audio_projects "github.com/magichourhq/magic-hour-go/resources/v1/audio_projects"
)
func main() {
client := sdk.NewClient(
sdk.WithBearerAuth(os.Getenv("API_TOKEN")),
)
res, err := client.V1.AudioProjects.Get(audio_projects.GetRequest{
Id: "cuid-example",
})
}let client = magic_hour::Client::default()
.with_bearer_auth(&std::env::var("API_TOKEN").unwrap());
let res = client
.v1()
.audio_projects()
.get(magic_hour::resources::v1::audio_projects::GetRequest {
id: "cuid-example".to_string(),
})
.await;curl --request GET \
--url https://api.magichour.ai/v1/audio-projects/id \
--header 'accept: application/json' \
--header 'authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.magichour.ai/v1/audio-projects/id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.magichour.ai/v1/audio-projects/id")
.header("accept", "application/json")
.header("authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magichour.ai/v1/audio-projects/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "cuid-example",
"name": "Example Name",
"status": "complete",
"type": "VOICE_GENERATOR",
"created_at": "2023-11-07T05:31:56Z",
"enabled": true,
"credits_charged": 2,
"downloads": [
{
"url": "https://videos.magichour.ai/id/output.wav",
"expires_at": "2024-10-19T05:16:19.027Z"
}
],
"error": null
}{
"code": "invalid_request",
"message": "<string>"
}{
"code": "unauthorized",
"message": "<string>"
}{
"code": "insufficient_credits",
"message": "<string>"
}{
"code": "not_found",
"message": "<string>"
}{
"code": "internal_server_error",
"message": "<string>"
}Get Audio Details API Reference - Magic Hour Docs
Check the progress of a audio project. The downloads field is populated after a successful render.
Statuses
queued— waiting to startrendering— in progresscomplete— ready; seedownloadserror— a failure occurred (seeerror)canceled— user canceleddraft— not used
from magic_hour import Client
from os import getenv
client = Client(token=getenv("API_TOKEN"))
res = client.v1.audio_projects.get(id="cuid-example")import { Client } from "magic-hour";
const client = new Client({ token: process.env["API_TOKEN"]!! });
const res = await client.v1.audioProjects.get({ id: "cuid-example" });package main
import (
os "os"
sdk "github.com/magichourhq/magic-hour-go/client"
audio_projects "github.com/magichourhq/magic-hour-go/resources/v1/audio_projects"
)
func main() {
client := sdk.NewClient(
sdk.WithBearerAuth(os.Getenv("API_TOKEN")),
)
res, err := client.V1.AudioProjects.Get(audio_projects.GetRequest{
Id: "cuid-example",
})
}let client = magic_hour::Client::default()
.with_bearer_auth(&std::env::var("API_TOKEN").unwrap());
let res = client
.v1()
.audio_projects()
.get(magic_hour::resources::v1::audio_projects::GetRequest {
id: "cuid-example".to_string(),
})
.await;curl --request GET \
--url https://api.magichour.ai/v1/audio-projects/id \
--header 'accept: application/json' \
--header 'authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.magichour.ai/v1/audio-projects/id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.magichour.ai/v1/audio-projects/id")
.header("accept", "application/json")
.header("authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magichour.ai/v1/audio-projects/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "cuid-example",
"name": "Example Name",
"status": "complete",
"type": "VOICE_GENERATOR",
"created_at": "2023-11-07T05:31:56Z",
"enabled": true,
"credits_charged": 2,
"downloads": [
{
"url": "https://videos.magichour.ai/id/output.wav",
"expires_at": "2024-10-19T05:16:19.027Z"
}
],
"error": null
}{
"code": "invalid_request",
"message": "<string>"
}{
"code": "unauthorized",
"message": "<string>"
}{
"code": "insufficient_credits",
"message": "<string>"
}{
"code": "not_found",
"message": "<string>"
}{
"code": "internal_server_error",
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <api_key>, where <api_key> is your API key. To get your API key, go to Developer Hub and click "Create new API Key".
Path Parameters
Unique ID of the audio project. This value is returned by all of the POST APIs that create an audio.
"cuid-example"
Response
Success
Success
Unique ID of the audio. Use it with the Get audio Project API to fetch status and downloads.
"cuid-example"
The name of the audio.
"Example Name"
The status of the audio.
draft- the project was created but has not been submitted for renderingqueued- the job is waiting for an available serverrendering- the job is being processed; theaudio.startedwebhook event fires when rendering beginscomplete- the job finished successfully; firesaudio.completederror- the job failed during processing; firesaudio.erroredcanceled- the job was manually canceled (for example from the Magic Hour web app)
Note: rendering, complete, and error have matching webhook events; canceled does not - a canceled job emits no webhook event, so poll this endpoint to detect cancellation.
draft, queued, rendering, complete, error, canceled "complete"
The type of the audio project. Possible values are AUDIO_TRANSLATOR, VOICE_GENERATOR, VOICE_CHANGER, VOICE_CLONER, VIDEO_TO_AUDIO, MUSIC_GENERATOR, SOUND_EFFECT_GENERATOR
"VOICE_GENERATOR"
Whether this resource is active. If false, it is deleted.
The amount of credits deducted from your account to generate the audio. We charge credits right when the request is made.
If an error occurred while generating the audio, credits will be refunded and this field will be updated to include the refund.
2
Show child attributes
Show child attributes
In the case of an error, this object will contain the error encountered during video render
Show child attributes
Show child attributes
null
Was this page helpful?