Create AI Generation Task
FreshPOSTPOST https://api.creatify.ai/api/ai_generation/Create a new AI generation task. The available models and their input parameters can be discovered via the schema endpoint.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID from the schema endpoint |
inputs | object | Yes | Input parameters matching the model's schema |
Headers
| Header | Type | Required | Description |
|---|---|---|---|
X-API-ID | string | Yes | Your Creatify API ID |
X-API-KEY | string | Yes | Your Creatify API key |
Content-Type | string | Yes | application/json |
Example Request
bash
curl -X POST 'https://api.creatify.ai/api/ai_generation/' \
-H 'X-API-ID: your-api-id' \
-H 'X-API-KEY: your-api-key' \
-H 'Content-Type: application/json' \
-d '{
"model": "image-gen-v1",
"inputs": {
"prompt": "A sleek modern smartphone on a marble surface with soft studio lighting",
"aspect_ratio": "1:1",
"style": "photorealistic"
}
}'Response
json
{
"id": "gen-001",
"status": "pending",
"model": "image-gen-v1",
"inputs": {
"prompt": "A sleek modern smartphone on a marble surface with soft studio lighting",
"aspect_ratio": "1:1",
"style": "photorealistic"
},
"created_at": "2024-01-15T10:30:00Z"
}Status Codes
| Code | Description |
|---|---|
201 | Task created successfully |
400 | Bad request -- invalid model or input parameters |
401 | Unauthorized -- invalid API credentials |
402 | Insufficient credits |
429 | Rate limit exceeded |
500 | Internal server error |
TIP
Check the schema endpoint first to see available models and their required inputs. Different models have different parameter requirements.