LongCat-Image API Documentation

LongCat-Image check status - Request Code

POST https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result HTTP/1.1 Host: gateway-falai-automate.appypie.workers.dev Ocp-Apim-Subscription-Key: your-subscription-key-here Content-Type: application/json { "request_id": "XXXXXXXXXXXXX" }
import requests url = "https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result" headers = { "Ocp-Apim-Subscription-Key": "your-subscription-key-here", "Content-Type": "application/json" } data = { "request_id": "XXXXXXXXXXXXX" } response = requests.post(url, json=data, headers=headers) print(response.json())
const url = 'https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result'; const headers = { 'Ocp-Apim-Subscription-Key': 'your-subscription-key-here', 'Content-Type': 'application/json' }; const body = { request_id: 'XXXXXXXXXXXXX' }; fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(body) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
curl -X POST https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result \ -H "Ocp-Apim-Subscription-Key: your-subscription-key-here" \ -H "Content-Type: application/json" \ -d '{ "request_id": "XXXXXXXXXXXXX" }'
import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; public class Main { public static void main(String[] args) throws Exception { String url = "https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result"; String json = """ { "request_id": "XXXXXXXXXXXXX" } """; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .timeout(Duration.ofSeconds(10)) .header("Ocp-Apim-Subscription-Key", "your-subscription-key-here") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
<?php $url = 'https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result'; $data = json_encode([ 'request_id' => 'XXXXXXXXXXXXX' ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Ocp-Apim-Subscription-Key: your-subscription-key-here', 'Content-Type: application/json' ]); $response = curl_exec($ch); curl_close($ch); echo $response; ?>

Output

Successful API response:

{ "status": "processing", "progress": 0.3, "request_id": "XXXXXXXXXXXXX" }

Request Body - LongCat-Image check status

Parameters for /longcat-image-request-result:

ParameterRequiredTypeDescription
request_idYesstringUnique identifier of the image generation request to check status for.

Example Request - LongCat-Image check status

JSON
{ "request_id": "XXXXXXXXXXXXX" }

Response - LongCat-Image check status

JSON
{ "status": "completed", "progress": 1.0, "request_id": "XXXXXXXXXXXXX", "result_url": "https://storage.pixazo.ai/results/XXXXXXXXXXXXX.png", "created_at": "2024-06-15T10:30:00Z", "duration_seconds": 42, "model_version": "longcat-v1.2" }

Retrieving Image Result and URL

After submitting your request, use this endpoint to check status and retrieve results.

Endpoint

POST https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result

Request Body

{ "request_id": "XXXXXXXXXXXXX" }

Example Success Response

{ "status": "completed", "progress": 1.0, "request_id": "XXXXXXXXXXXXX", "result_url": "https://storage.pixazo.ai/results/XXXXXXXXXXXXX.png", "created_at": "2024-06-15T10:30:00Z", "duration_seconds": 42, "model_version": "longcat-v1.2" }

Example Processing Response

{ "status": "processing", "progress": 0.45, "request_id": "XXXXXXXXXXXXX" }

HTTP Example

POST https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result HTTP/1.1 Host: gateway-falai-automate.appypie.workers.dev Ocp-Apim-Subscription-Key: your-subscription-key-here Content-Type: application/json { "request_id": "XXXXXXXXXXXXX" }

Python Example

import requests url = "https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result" headers = { "Ocp-Apim-Subscription-Key": "your-subscription-key-here", "Content-Type": "application/json" } data = { "request_id": "XXXXXXXXXXXXX" } response = requests.post(url, json=data, headers=headers) print(response.json())

JavaScript Example

const url = 'https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result'; const headers = { 'Ocp-Apim-Subscription-Key': 'your-subscription-key-here', 'Content-Type': 'application/json' }; const body = { request_id: 'XXXXXXXXXXXXX' }; fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(body) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));

cURL Example

curl -X POST https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result \ -H "Ocp-Apim-Subscription-Key: your-subscription-key-here" \ -H "Content-Type: application/json" \ -d '{ "request_id": "XXXXXXXXXXXXX" }'

Java Example

import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; public class Main { public static void main(String[] args) throws Exception { String url = "https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result"; String json = """ { "request_id": "XXXXXXXXXXXXX" } """; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .timeout(Duration.ofSeconds(10)) .header("Ocp-Apim-Subscription-Key", "your-subscription-key-here") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }

PHP Example

<?php $url = 'https://gateway-falai-automate.appypie.workers.dev/longcat-image-request-result'; $data = json_encode([ 'request_id' => 'XXXXXXXXXXXXX' ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Ocp-Apim-Subscription-Key: your-subscription-key-here', 'Content-Type: application/json' ]); $response = curl_exec($ch); curl_close($ch); echo $response; ?>

Request Headers

HeaderDescription
Ocp-Apim-Subscription-KeyRequired subscription key for API access.
Content-TypeMust be set to application/json for request body.

Response Handling

The LongCat-Image returns specific HTTP status codes and response bodies to indicate the success or failure of a request. Developers should implement error handling in their applications to manage these responses effectively.

Common Status Codes and Responses

Status CodeDescriptionResponse Body
200Success - The request was successfully processed.{ "success": true, ... }
Bad Request - The request contains invalid parameters or missing fields.{ "error": "Invalid request parameters" }
401Unauthorized - The provided subscription key is missing or invalid.{ "error": "Invalid or missing authentication" }
403Forbidden - The subscription does not have access to this API or action.{ "error": "Access denied for this operation" }
404Not Found - The requested resource or endpoint could not be found.{ "error": "Endpoint not found" }
Too Many Requests - The request rate limit has been exceeded.{ "error": "Rate limit exceeded, please retry later" }
500Internal Server Error - An unexpected error occurred on the server.{ "error": "An unexpected error occurred, please try again later" }

Example Error Response

{ "error": "Invalid parameters" }