API Documentation
Build integrations with the Poiiky Studio API. Generate AI videos, images, and audio programmatically. Manage models, track usage, and receive real-time webhook notifications.
Quick Start
Integrate the Poiiky Studio API in a few simple steps
Get API Key
Generate your API key from the Developer Dashboard
export POIIKY_API_KEY="pk_..."
Check the price
Estimate the cost before generating. Nothing is charged.
curl -X POST "https://www.poiikystudio.com/api/v1/estimate.php" \
-H "Authorization: Bearer $POIIKY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model_id": "kling-v2", "duration": 5}'
Make First Request
Create your first generation. Save the returned uuid.
curl -X POST "https://www.poiikystudio.com/api/v1/generate.php" \
-H "Authorization: Bearer $POIIKY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model_id": "kling-v2", "prompt": "A serene mountain landscape at sunset", "aspect_ratio": "16:9", "duration": 5}'
Get Results
Poll the status until it is final, then download output_files.
curl "https://www.poiikystudio.com/api/v1/status.php?id=GENERATION_UUID" \ -H "Authorization: Bearer $POIIKY_API_KEY"
Generation Lifecycle
Each generation goes through these statuses:
queued, processing, succeeded, failed, cancelled. Some image models return succeeded directly from /generate.php, so check the create response before polling.is_refunded: true. Output files may expire about 24 hours after completion, so download them promptly.Authentication
All API requests require a Bearer token in the Authorization header. Generate your API key from the Developer Dashboard.
Authorization: Bearer YOUR_API_KEY
Keep your API key secret. Never expose it in client-side code or public repositories. If compromised, revoke it immediately and generate a new one.
Base URL
All endpoints are relative to the base URL:
https://www.poiikystudio.com/api/v1/
Rate Limits
Rate limits are enforced per API key — the same limit applies to all users (anti-spam only, not a feature restriction).
| Limit | Value |
|---|---|
| Requests per minute | 30 |
| Max concurrent generations | Unlimited |
Rate limit info is returned in response headers:
X-RateLimit-Limit: 30 X-RateLimit-Remaining: 25 X-RateLimit-Reset: 1732612800
When exceeded, the API returns 429 Too Many Requests with a Retry-After header.
Error Codes
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request succeeded |
| 400 | Bad Request | Missing or invalid parameters |
| 401 | Unauthorized | Invalid or missing API key |
| 402 | Payment Required | Insufficient balance |
| 404 | Not Found | Resource does not exist |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Server Error | Internal server error |
All error responses follow this format:
{
"error": true,
"message": "Insufficient balance. Required: 5000, Available: 2000"
}
Create a new AI generation. Charges the estimated cost from your balance immediately. The generation runs asynchronously; poll the status endpoint or use webhooks for completion.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model_id | string | Yes | AI model identifier (e.g. kling-v2) |
prompt | string | No | Text prompt. Max length depends on the model (see params[].max in model detail, e.g. 20,000 / 30,000 / 100,000) |
provider | string | No | Provider override |
server | string | No | Server ID (e.g. sv15) or auto (default). Mapped to server_id for provider routing |
aspect_ratio | string | No | 16:9, 9:16, 1:1, 4:3, 3:4, 21:9, auto… |
duration | integer | No | Duration in seconds |
resolution | string | No | Output resolution: 720p, 1080p |
quality | string | No | Quality preset, e.g. standard, high |
image_url | string | No | Input image for image-to-video / image editing. Use the url from /upload.php |
image_urls | array | No | Multiple input / reference images |
last_frame_url | string | No | End frame image (first/last-frame models) |
video_url / audio_url | string | No | Input video / audio |
negative_prompt | string | No | What to avoid |
seed | integer | No | Random seed for reproducibility |
n | integer | No | Number of outputs (image models) |
with_audio | boolean | No | Generate audio with video (if supported) |
voice | string | No | Voice ID for TTS/subtitle models |
instrumental | boolean | No | Instrumental only — no vocals (music models) |
language | string | No | Language code for TTS/subtitle models |
speed | string | No | Reading speed for TTS/subtitle models |
format | string | No | Output format: mp3, wav (TTS models) |
srt | string | No | Subtitle text content (SRT format) |
subtitle_file_url | string | No | Subtitle file URL (.srt/.vtt) from /upload.php |
p_* | various | No | Model-specific params prefixed with p_ (e.g. p_voice_id, p_language_code, p_speed) |
params from /model-detail.php. Only parameters declared in the model's schema are forwarded; unrecognized fields are stripped.Code Examples
curl -X POST "https://www.poiikystudio.com/api/v1/generate.php" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model_id": "kling-v2",
"prompt": "A serene mountain landscape at sunset",
"aspect_ratio": "16:9",
"duration": 5
}'
import requests
response = requests.post(
"https://www.poiikystudio.com/api/v1/generate.php",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"model_id": "kling-v2",
"prompt": "A serene mountain landscape at sunset",
"aspect_ratio": "16:9",
"duration": 5
}
)
data = response.json()
print(data["generation"]["uuid"])
const response = await fetch(
"https://www.poiikystudio.com/api/v1/generate.php",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
model_id: "kling-v2",
prompt: "A serene mountain landscape at sunset",
aspect_ratio: "16:9",
duration: 5
})
}
);
const data = await response.json();
console.log(data.generation.uuid);
$ch = curl_init("https://www.poiikystudio.com/api/v1/generate.php");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('POIIKY_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'model_id' => 'kling-v2',
'prompt' => 'A serene mountain landscape at sunset',
'aspect_ratio' => '16:9',
'duration' => 5,
]),
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $data['generation']['uuid'];
Response
{
"success": true,
"generation": {
"id": 98765,
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"model_id": "kling-v2",
"status": "queued",
"progress": 0,
"cost": 5000,
"output_type": "video",
"created_at": "2026-11-26T10:30:00Z"
}
}
Check the current status and progress of a generation. Poll this endpoint until status is completed or failed.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Generation UUID |
Code Examples
curl "https://www.poiikystudio.com/api/v1/status.php?id=gen_abc123def456" \ -H "Authorization: Bearer YOUR_API_KEY"
response = requests.get(
"https://www.poiikystudio.com/api/v1/status.php",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"id": "gen_abc123def456"}
)
data = response.json()
print(data["data"]["status"], data["data"]["progress"])
const response = await fetch(
"https://www.poiikystudio.com/api/v1/status.php?id=gen_abc123def456",
{ headers: { "Authorization": "Bearer YOUR_API_KEY" } }
);
const { data } = await response.json();
console.log(data.status, data.progress);
Response
{
"success": true,
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "succeeded",
"progress": 100,
"output_files": ["https://cdn.poiiky.com/outputs/video_xyz.mp4"],
"error": null,
"cost": 5000
}
}
Retrieve a paginated list of your generation history. Filter by status or output type.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number (default: 1) |
limit | integer | No | Items per page, 1–100 (default: 20) |
status | string | No | queued, processing, succeeded, failed, cancelled |
output_type | string | No | video, image, audio |
Response
{
"success": true,
"data": [...],
"pagination": {
"page": 1,
"limit": 20,
"total": 150,
"total_pages": 8
}
}
Cancel a pending or processing generation. The charged cost is refunded to your balance.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
uuid | string | Yes | Generation UUID to cancel |
Response
{
"success": true,
"refunded": 5000,
"new_balance": 45000
}
Get an estimated price for a generation before committing. Useful for displaying costs in your UI.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model_id | string | Yes | AI model identifier |
provider | string | No | Provider override |
server | string | No | Server ID or auto (default) |
duration | integer | No | Duration in seconds (affects pricing for video/audio) |
resolution | string | No | Output resolution (affects pricing) |
aspect_ratio | string | No | Output aspect ratio |
p_* | various | No | Model-specific params (same as generate endpoint) |
Response
{
"success": true,
"provider_cost": 3500,
"sell_price": 5000,
"original_cost": 3500,
"discount": 0,
"currency": "VND",
"formatted": "5.000₫"
}
List all available AI models. Optionally filter by type.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | No | video, image, audio |
Code Examples
curl "https://www.poiikystudio.com/api/v1/models.php?type=video" \ -H "Authorization: Bearer YOUR_API_KEY"
response = requests.get(
"https://www.poiikystudio.com/api/v1/models.php",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"type": "video"}
)
for model in response.json()["models"]:
print(model["model_id"], model["name"])
const response = await fetch(
"https://www.poiikystudio.com/api/v1/models.php?type=video",
{ headers: { "Authorization": "Bearer YOUR_API_KEY" } }
);
const { models } = await response.json();
models.forEach(m => console.log(m.model_id, m.name));
Response
{
"success": true,
"models": [
{
"model_id": "kling-v2",
"name": "Kling v2.0",
"type": "video",
"provider": "kling",
"sell_price": 5000,
"supports": ["text-to-video", "image-to-video"]
}
],
"total": 24
}
Get detailed information about a specific model, including supported parameters, resolutions, and pricing.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model_id | string | Yes | Model identifier |
Response
{
"success": true,
"model_id": "kling-v2",
"params": {
"aspect_ratios": ["16:9", "9:16", "1:1"],
"max_duration": 10,
"resolutions": ["720p", "1080p"]
},
"pricing": { "base_cost": 3500 },
"sell_price": 5000
}
Upload a file for use with image-to-video or other generation modes. Send as multipart/form-data.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
file | file | Yes | Max 50 MB. Image: jpg, png, webp, gif · Video: mp4, mov, webm · Audio: mp3, wav, m4a |
provider | string | No | Default zova |
upload_to_provider | string | No | 1 (default) or 0 |
Response
{
"success": true,
"id": "file_xyz789",
"url": "https://cdn.poiiky.com/uploads/file_xyz789.png",
"mime_type": "image/png",
"size": 2048576
}
Get your current account balance, subscription plan, and rate limit status.
Response
{
"success": true,
"balance": 50000,
"plan": { "name": "Free" },
"rate_limit": {
"requests_per_minute": 30,
"concurrent": 0
}
}
Retrieve full account information including user profile, balance, subscription plan, and usage summary.
Response
{
"success": true,
"user": {
"id": 42,
"username": "creator",
"email": "user@example.com",
"created_at": "2026-01-15"
},
"balance": 50000,
"plan": {
"name": "Pro",
"expires_at": "2027-01-15"
},
"usage": {
"total_generations": 1250,
"this_month": 89
}
}
Get detailed usage statistics including request counts, generation totals, cost breakdown, and daily usage data.
Response
{
"success": true,
"summary": {
"total_requests": 15420,
"total_generations": 1250,
"total_cost": 6250000
},
"endpoints": {
"/generate": 1250,
"/status": 8900,
"/models": 520
},
"daily": [
{
"date": "2026-11-26",
"requests": 45,
"generations": 12,
"cost": 60000
}
]
}
Manage webhook endpoints for receiving real-time notifications about generation events.
GET List Webhooks
Returns all registered webhook endpoints for your account.
{
"success": true,
"webhooks": [
{
"id": 1,
"url": "https://yourapp.com/webhook",
"events": ["generation.succeeded"],
"active": true,
"created_at": "2026-11-20T08:00:00Z"
}
]
}
POST Create Webhook
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | HTTPS endpoint URL |
events | array | Yes | generation.succeeded, generation.failed |
secret | string | No | Custom signing secret (auto-generated if omitted) |
Code Examples
curl -X POST "https://www.poiikystudio.com/api/v1/webhooks.php" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://yourapp.com/webhook",
"events": ["generation.succeeded", "generation.failed"]
}'
response = requests.post(
"https://www.poiikystudio.com/api/v1/webhooks.php",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"url": "https://yourapp.com/webhook",
"events": ["generation.succeeded", "generation.failed"]
}
)
webhook = response.json()["webhook"]
print("Secret:", webhook["secret"])
const response = await fetch(
"https://www.poiikystudio.com/api/v1/webhooks.php",
{
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
url: "https://yourapp.com/webhook",
events: ["generation.succeeded", "generation.failed"]
})
}
);
const { webhook } = await response.json();
console.log("Secret:", webhook.secret);
Response
{
"success": true,
"webhook": {
"id": 2,
"url": "https://yourapp.com/webhook",
"events": ["generation.succeeded", "generation.failed"],
"secret": "whsec_a1b2c3d4e5f6...",
"active": true
}
}
PUT Update Webhook
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Webhook ID, in the query string: PUT /webhooks.php?id=123 |
url | string | No | New endpoint URL |
events | array | No | Updated event list |
is_active | boolean | No | Enable or disable |
description | string | No | Label |
DELETE Delete Webhook
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | In the query string: DELETE /webhooks.php?id=123 |
{
"success": true
}
Webhooks Guide
Event Types
| Event | Description |
|---|---|
generation.succeeded | A generation completed successfully with output files |
generation.failed | A generation failed due to an error |
Payload Format
Webhook payloads are sent as POST requests with Content-Type: application/json.
{
"event": "generation.succeeded",
"timestamp": 1732617135,
"data": {
"id": "gen_abc123def456",
"model_id": "kling-v2",
"status": "succeeded",
"output_files": ["https://cdn.poiiky.com/outputs/video_xyz.mp4"],
"cost": 5000
}
}
Signature Verification
Every webhook request includes an X-Poiiky-Signature header containing an HMAC-SHA256 signature. Verify it to ensure the request is authentic.
import hmac, hashlib
def verify_signature(payload_body, signature, secret):
expected = hmac.new(
secret.encode(),
payload_body,
hashlib.sha256
).hexdigest()
return hmac.compare_digest(f"sha256={expected}", signature)
const crypto = require("crypto");
function verifySignature(body, signature, secret) {
const expected = crypto
.createHmac("sha256", secret)
.update(body)
.digest("hex");
return signature === `sha256=${expected}`;
}
function verifySignature(string $rawBody, string $signature, string $signingKey): bool
{
$expected = 'sha256=' . hash_hmac('sha256', $rawBody, $signingKey);
return hash_equals($expected, $signature);
}
$raw = file_get_contents('php://input');
$ok = verifySignature($raw, $_SERVER['HTTP_X_POIIKY_SIGNATURE'] ?? '', getenv('POIIKY_WEBHOOK_SECRET'));
Retry Policy
PUT /webhooks.php?id=... and {"is_active": true}. Keep polling as a fallback for important jobs.
Full Workflow Example
Complete script: create a generation, wait for the result with retries, then download the output.
import os, time, requests
API = "https://www.poiikystudio.com/api/v1/"
HEADERS = {"Authorization": "Bearer " + os.environ["POIIKY_API_KEY"]}
FINAL = {"succeeded", "failed", "cancelled"}
def call(method, path, **kw):
for attempt in range(5):
r = requests.request(method, API + path, headers=HEADERS, timeout=60, **kw)
if r.status_code in (429, 500, 502, 503) and attempt < 4:
time.sleep(min(60, 2 ** attempt * 2))
continue
body = r.json()
if r.status_code >= 400 or body.get("error"):
err = body.get("error")
raise RuntimeError(err.get("message") if isinstance(err, dict) else body.get("message"))
return body
# Optional: image-to-video
# up = call("POST", "upload.php", files={"file": open("photo.jpg", "rb")})
gen = call("POST", "generate.php", json={
"model_id": "kling-v2",
"prompt": "A serene mountain landscape at sunset",
"aspect_ratio": "16:9",
"duration": 5,
# "image_url": up["url"],
})["generation"]
data = gen
while data["status"] not in FINAL:
time.sleep(6)
data = call("GET", "status.php", params={"id": gen["uuid"]})["data"]
print(data["status"], data["progress"])
if data["status"] == "succeeded":
for i, url in enumerate(data["output_files"]):
open(f"output_{i}.mp4", "wb").write(requests.get(url).content)
else:
print("Failed:", data.get("error"))const API = "https://www.poiikystudio.com/api/v1/";
const AUTH = { Authorization: "Bearer " + process.env.POIIKY_API_KEY };
const FINAL = ["succeeded", "failed", "cancelled"];
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function call(method, path, json) {
for (let attempt = 0; attempt < 5; attempt++) {
const res = await fetch(API + path, {
method,
headers: json ? { ...AUTH, "Content-Type": "application/json" } : AUTH,
body: json ? JSON.stringify(json) : undefined,
});
if ([429, 500, 502, 503].includes(res.status) && attempt < 4) {
await sleep(Math.min(60000, 2000 * 2 ** attempt));
continue;
}
const body = await res.json();
if (!res.ok || body.error) {
throw new Error(typeof body.error === "object" ? body.error.message : body.message);
}
return body;
}
}
const { generation } = await call("POST", "generate.php", {
model_id: "kling-v2",
prompt: "A serene mountain landscape at sunset",
aspect_ratio: "16:9",
duration: 5,
});
let data = generation;
while (!FINAL.includes(data.status)) {
await sleep(6000);
({ data } = await call("GET", "status.php?id=" + generation.uuid));
console.log(data.status, data.progress);
}
console.log(data.status === "succeeded" ? data.output_files : data.error);$api = "https://www.poiikystudio.com/api/v1/";
function poiiky(string $method, string $url, ?array $json = null): array
{
$headers = ['Authorization: Bearer ' . getenv('POIIKY_API_KEY')];
$ch = curl_init($url);
$opts = [CURLOPT_CUSTOMREQUEST => $method, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 60];
if ($json !== null) {
$headers[] = 'Content-Type: application/json';
$opts[CURLOPT_POSTFIELDS] = json_encode($json);
}
$opts[CURLOPT_HTTPHEADER] = $headers;
curl_setopt_array($ch, $opts);
$body = json_decode((string) curl_exec($ch), true) ?: [];
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($code >= 400 || !empty($body['error'])) {
throw new RuntimeException(is_array($body['error'] ?? null) ? $body['error']['message'] : ($body['message'] ?? "HTTP $code"));
}
return $body;
}
$gen = poiiky('POST', $api . 'generate.php', [
'model_id' => 'kling-v2',
'prompt' => 'A serene mountain landscape at sunset',
'aspect_ratio' => '16:9',
'duration' => 5,
])['generation'];
$data = $gen;
while (!in_array($data['status'], ['succeeded', 'failed', 'cancelled'], true)) {
sleep(6);
$data = poiiky('GET', $api . 'status.php?id=' . urlencode($gen['uuid']))['data'];
}
if ($data['status'] === 'succeeded') {
foreach ($data['output_files'] as $i => $url) {
file_put_contents("output_$i.mp4", fopen($url, 'r'));
}
} else {
echo 'Failed: ' . $data['error'];
}/upload.php first, then pass the returned url as image_url.Best Practices
Polling Strategy
- Start polling 3–5 seconds after creating
- Use 5–10 second intervals for video, 2–3 seconds for images
- Apply exponential backoff on errors
- Stop polling when status is succeeded, failed or cancelled
- Use webhooks in production, with polling as a fallback
Error Handling
- Always check the HTTP status code before reading the body
- Retry automatically on 429 and 5xx
- Do not retry 400 or 401
- Exponential backoff: 2s, 4s, 8s, max 60s
- Log every error for debugging
/generate.php after a network timeout. The first request may have succeeded and a retry would charge you twice. Check /generations.php first.File Upload Tips
- Compress images before uploading (max 50 MB)
- Formats: JPEG, PNG, WebP, GIF; MP4, MOV, WebM; MP3, WAV, M4A
- Upload once, then reuse the returned URL in generate requests
- Reference images should match the output aspect ratio
Security
- Keep the API key on your server in an environment variable
- Verify webhook signatures with a constant-time comparison
- Use HTTPS webhook URLs
FAQ
output_files.is_refunded: true.Complete API Documentation Package
Download the complete documentation to send to your AI coding assistant or development team.
Includes:- OpenAPI specification (YAML)
- Complete code examples
- Step-by-step integration guide
- Every endpoint, parameter and response
- Webhooks and signature verification
- Best practices and error handling
Changelog
Track API updates and changes.
| Version | Date | Changes |
|---|---|---|
v1.0 | 2026-11-27 | Initial public release: generations, models, uploads, account, webhooks |