API Documentation
The ONI18 API allows you to integrate AI image generation into your applications. Available on Agency plans.
Introduction
Base URL for all API requests:
https://api.oni18.com/v1
All requests must include your API key and return JSON responses.
Authentication
Include your API key in the Authorization header:
Authorization: Bearer your_api_key_here
You can generate API keys from your Settings page.
Rate Limits
API rate limits depend on your plan:
| Plan | Requests/min | Concurrent |
|---|---|---|
| Agency | 60 | 10 |
Generate Image
POST /generate
Generate a new AI image from a text prompt.
Parameters
| Parameter | Type | Description |
|---|---|---|
prompt required |
string | Text description of the image to generate |
style |
string | Style preset: glamour, lifestyle, promo, artistic, minimal, bold |
aspect_ratio |
string | Image ratio: 1:1, 4:5, 9:16, 16:9 |
face_model_id |
integer | ID of face model to use (optional) |
Request Example
curl -X POST https://api.oni18.com/v1/generate \ -H "Authorization: Bearer your_api_key" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Professional photo in a modern office", "style": "lifestyle", "aspect_ratio": "4:5" }'
Response
{
"success": true,
"id": 12345,
"image_url": "https://cdn.oni18.com/gen/abc123.jpg",
"generation_time": 4.2,
"credits_remaining": 495
}
List Generations
GET /generations
Retrieve a list of your generated images.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
limit | integer | Number of results (max 100) |
offset | integer | Pagination offset |
style | string | Filter by style |
Face Models
GET /models
List your trained face models.
POST /models
Create a new face model (multipart/form-data with photos).
DELETE /models/{id}
Delete a face model.
Error Handling
Errors return appropriate HTTP status codes with JSON details:
{
"success": false,
"error": "Insufficient credits",
"code": "CREDITS_EXHAUSTED"
}
| Code | Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Invalid or missing API key |
RATE_LIMITED | 429 | Too many requests |
CREDITS_EXHAUSTED | 402 | No credits remaining |
INVALID_PROMPT | 400 | Prompt violates content policy |
Webhooks
Configure webhooks in your settings to receive notifications when:
- Image generation completes
- Face model training finishes
- Credits are running low