from magic_hour import Client
from os import getenv
client = Client(token=getenv("API_TOKEN"))
res = client.v1.image_projects.get(id="cuid-example")import { Client } from "magic-hour";
const client = new Client({ token: process.env["API_TOKEN"]!! });
const res = await client.v1.imageProjects.get({ id: "cuid-example" });package main
import (
os "os"
sdk "github.com/magichourhq/magic-hour-go/client"
image_projects "github.com/magichourhq/magic-hour-go/resources/v1/image_projects"
)
func main() {
client := sdk.NewClient(
sdk.WithBearerAuth(os.Getenv("API_TOKEN")),
)
res, err := client.V1.ImageProjects.Get(image_projects.GetRequest{
Id: "cuid-example",
})
}let client = magic_hour::Client::default()
.with_bearer_auth(&std::env::var("API_TOKEN").unwrap());
let res = client
.v1()
.image_projects()
.get(magic_hour::resources::v1::image_projects::GetRequest {
id: "cuid-example".to_string(),
})
.await;curl --request GET \
--url https://api.magichour.ai/v1/image-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/image-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/image-projects/id")
.header("accept", "application/json")
.header("authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magichour.ai/v1/image-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",
"image_count": 1,
"type": "AI_IMAGE",
"created_at": "2023-11-07T05:31:56Z",
"enabled": true,
"credits_charged": 5,
"downloads": [
{
"url": "https://videos.magichour.ai/id/output.png",
"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 Image Details API Reference - Magic Hour Docs
Check the progress of a image 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.image_projects.get(id="cuid-example")import { Client } from "magic-hour";
const client = new Client({ token: process.env["API_TOKEN"]!! });
const res = await client.v1.imageProjects.get({ id: "cuid-example" });package main
import (
os "os"
sdk "github.com/magichourhq/magic-hour-go/client"
image_projects "github.com/magichourhq/magic-hour-go/resources/v1/image_projects"
)
func main() {
client := sdk.NewClient(
sdk.WithBearerAuth(os.Getenv("API_TOKEN")),
)
res, err := client.V1.ImageProjects.Get(image_projects.GetRequest{
Id: "cuid-example",
})
}let client = magic_hour::Client::default()
.with_bearer_auth(&std::env::var("API_TOKEN").unwrap());
let res = client
.v1()
.image_projects()
.get(magic_hour::resources::v1::image_projects::GetRequest {
id: "cuid-example".to_string(),
})
.await;curl --request GET \
--url https://api.magichour.ai/v1/image-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/image-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/image-projects/id")
.header("accept", "application/json")
.header("authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magichour.ai/v1/image-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",
"image_count": 1,
"type": "AI_IMAGE",
"created_at": "2023-11-07T05:31:56Z",
"enabled": true,
"credits_charged": 5,
"downloads": [
{
"url": "https://videos.magichour.ai/id/output.png",
"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 image project. This value is returned by all of the POST APIs that create an image.
"cuid-example"
Response
Success
Success
Unique ID of the image. Use it with the Get image Project API to fetch status and downloads.
"cuid-example"
The name of the image.
"Example Name"
The status of the image.
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; theimage.startedwebhook event fires when rendering beginscomplete- the job finished successfully; firesimage.completederror- the job failed during processing; firesimage.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"
Number of images generated
1
The type of the image project. Possible values are FACE_EDITOR, AI_IMAGE_EDITOR, GENERATIVE_FILL, AI_SELFIE, AI_HEADSHOT, AI_INFLUENCER, AI_IMAGE, AI_MEME, CLOTHES_CHANGER, BACKGROUND_REMOVER, FACE_SWAP, IMAGE_UPSCALER, IMAGE_ENHANCER, AI_GIF, QR_CODE, PHOTO_EDITOR, PHOTO_COLORIZER, IMAGE_COLOR_GRADER, HEAD_SWAP, BODY_SWAP, STORYBOARD, IMAGE_EXPANDER
"AI_IMAGE"
Whether this resource is active. If false, it is deleted.
The amount of credits deducted from your account to generate the image. We charge credits right when the request is made.
If an error occurred while generating the image(s), credits will be refunded and this field will be updated to include the refund.
5
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?