Documentation
Get Image Operation
Get Image Operation
Using the API to get the operation of an image
When you call the API to generate a graphic, you will want to poll the operation to check if it is completed.
/api/v1/get-image-operation
import axios from "axios";
interface Graphic {
id: string;
type: string;
status: string;
prompt: string;
previewUrl: string;
fullUrl: string;
vectorFullUrlWithBG: string;
}
interface Response {
success: boolean;
data: {
status: string;
images: Graphic[];
};
}
const baseUrl = new URL("/api/v1/get-image-operation", window.location.origin);
baseUrl.searchParams.set("operationId", "1234567890");
const response = await axios.get<Response>(baseUrl.toString(), {
headers: {
"x-api-key": "Bearer <your-token>"
}
});
const { data } = response.data;
console.log(data);