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:

PlanRequests/minConcurrent
Agency6010

Generate Image

POST /generate

Generate a new AI image from a text prompt.

Parameters

ParameterTypeDescription
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

ParameterTypeDescription
limitintegerNumber of results (max 100)
offsetintegerPagination offset
stylestringFilter 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"
}
CodeStatusDescription
UNAUTHORIZED401Invalid or missing API key
RATE_LIMITED429Too many requests
CREDITS_EXHAUSTED402No credits remaining
INVALID_PROMPT400Prompt violates content policy

Webhooks

Configure webhooks in your settings to receive notifications when: