Getting started

API reference

Getting started

Create a sandbox key and run your first job from this page.

Live keys spend prepaid API credits. The request shape does not change when you switch from sk_test_ to sk_live_.

See Guides for complete examples.

  1. Create an account on goonify.ai.
  2. Open the developer dashboard and create a sandbox key.
  3. Call GET /v2/models, pick a task, then POST /v2/jobs with that model id.
  4. Poll GET /v2/jobs/{id} or wait for the webhook, then download output.url.
Get API key

Authentication

Authenticated endpoints take a Bearer secret. Sandbox keys start with sk_test_. Live keys start with sk_live_.

Header
Authorization: Bearer sk_test_your_sandbox_key

Use https://api.goonify.ai. Create and poll jobs on /api/v2.

Base URL
https://api.goonify.ai

Sandbox mode

Sandbox keys are free. They validate your request and return example completed results without spending credits.

Use a sandbox key to test webhooks, polling, and errors. Use a live key for production jobs.

Official SDKs

Use the official Python or TypeScript SDK instead of writing HTTP by hand. Both wrap models, jobs, files, characters, polling, and webhook verification.

Install from the Goonify repository. Sandbox keys (sk_test_) return example media. Live keys (sk_live_) spend prepaid credits.

bash
pip install "goonify @ git+https://github.com/Goonify/goonify.git#subdirectory=sdks/python"
npm install github:Goonify/goonify#main:sdks/typescript

client.run(model, input) creates a job and waits until it completes. Failed and cancelled jobs raise GoonifyError with the public error.code.

python
from goonify import Goonify

client = Goonify()  # GOONIFY_API_KEY
job = client.run(
    "goonify/flux2",
    input={"prompt": "a woman standing in a sunlit studio, photorealistic"},
)
print(job.output.url)
typescript
import { Goonify } from '@goonify/sdk'

const client = new Goonify() // GOONIFY_API_KEY
const job = await client.run('goonify/flux2', {
  input: { prompt: 'a woman standing in a sunlit studio, photorealistic' },
})
console.log(job.output?.url)

Changelog

Recent changes to the Goonify API.

Open changelog

Models

Browse by task. Text to image, image to image, and image to video are the base models. Image presets, video presets, and tools are separate lists. Pass one of these ids to POST /v2/jobs.

Each card shows the public id, list price, and required inputs. Create a job with POST /v2/jobs.

GET /v2/models/{id}/schema is the input contract. POST /v2/models/{id}/estimate returns the same price create will charge, plus the current queue wait.

GET /v2/models?task= filters one list: t2i, i2i, t2v, i2v, image-preset, video-preset, or tool. Volume rates and refunds are on the pricing page.

GET /v2/models returns models, presets, and tools together. counts.models, counts.presets, and counts.tools are the true sizes. The length of data is the catalog size, not the model count.

0 live models

OpenAPI

Text to image

Text to image. POST /v2/jobs or POST /v2/t2i with input.prompt. Flux 2, Pony, Krea 2, Illustrious, and Z-Image do not take a photo. Seedream can take reference photos on the same model. Every model for this task is listed below with its price.

Every model

Poll GET /v2/jobs/{id} until status is completed, then download output.url. Optional seed and negative_prompt are supported on the studio image models. Sandbox keys are free and return an example result.

JSON
{
  "model": "goonify/flux2",
  "input": {
    "prompt": "a woman standing in a sunlit studio, photorealistic"
  }
}

0 models

OpenAPI

Image to image

Image to image is Flux 2 and Seedream. POST /v2/jobs or POST /v2/i2i. Flux 2 needs goonify/flux2, input.prompt, and input.image_url, at the Flux 2 text to image price. Seedream takes input.prompt plus input.image_url or input.reference_images. The hold depends on the Seedream model and the size.

Every model

POST /v2/i2i accepts the same body as POST /v2/jobs. Image presets are a different list. Flux 2 presets take a photo or a character. Pony, Krea 2, and Illustrious take a character.

JSON
{
  "model": "goonify/flux2",
  "input": {
    "prompt": "a woman standing in a sunlit studio, photorealistic",
    "image_url": "https://cdn.goonify.ai/examples/input.jpg"
  }
}

0 models

OpenAPI

Text to video

Text to video. POST /v2/jobs. Every model for this task is listed below with what to send and the price.

Every model

Wan 3.0 is priced per second of the new clip, plus the length of any reference video. The reference is not attached to the result. 480p is $0.125, 720p is $0.25, and 1080p is $0.50. A 5 second 1080p clip is $2.50. Wan 3.0 Prime is faster: 480p is $0.17, 720p is $0.35, and 1080p is $0.70 per second. Duration is 2 to 30 seconds, or -1 to let the model choose. Sound on or off is the same price. Failed jobs are refunded. You can set ratio, seed, and prompt_extend. Keyframe photos and reference media cannot be combined. Seedance lists a 5 second clip. A longer clip costs more. The finished job is billed from the tokens the clip used, and never more than the hold for that length. Sound does not change that rate. A failed Seedance job is refunded.

JSON
{
  "model": "goonify/wan-3.0",
  "input": {
    "prompt": "a woman standing in a sunlit studio, photorealistic",
    "resolution": "720p",
    "duration": 5
  }
}

A photo with no prompt is on Image to video. That page lists every image-to-video model.

0 models

OpenAPI

Image to video

Image to video. POST /v2/jobs or POST /v2/i2v. Every model for this task is listed below with what to send and the price.

Every model

POST /v2/i2v accepts the same body as POST /v2/jobs. Video presets are styled looks on their own page.

JSON
{
  "model": "goonify/wan22",
  "input": {
    "image_url": "https://cdn.goonify.ai/examples/input.jpg"
  }
}

0 models

OpenAPI

Image presets

Image presets return a styled photo. Pass input.model to pick Flux 2, Pony, Krea 2, or Illustrious. The default is Flux 2. Flux 2 takes input.image_url or input.character. Pony, Krea 2, and Illustrious take input.character. Do not send input.prompt. Six couple presets also require input.image_url_2.

On Flux 2, leave pose_ready false unless the person in the photo is already in the pose. Set it to true only when they already are. Other image models ignore pose_ready. Create with POST /v2/jobs or POST /v2/i2i and a goonify/presets id.

Flux 2 edits the photo. Leave pose_ready false unless the person is already in the pose. Set it to true only when they already are.

No presets in this group.

Loading presets…

Video presets

Video presets take a photo and return a styled clip. Send input.image_url. Do not send input.prompt.

Wan 3.0 presets are priced by length and resolution. 720p is $0.25 a second. Lengths are 10, 15, and 30 seconds. A 10 second 720p preset is $2.50. Other video presets stay a flat price. Leave pose_ready false unless the person in the photo is already in the pose. Set it to true only when they already are. Create with POST /v2/jobs or POST /v2/i2v.

Loading presets…

Tools

Tools are separate from image models, video models, and presets.

Every tool

Every tool is listed below with what it accepts. POST /v2/jobs. Faceswap also has POST /v2/faceswap. Enhance also has POST /v2/upscale.

JSON
{
  "model": "goonify/faceswap",
  "input": {
    "image_url": "https://cdn.goonify.ai/examples/input.jpg",
    "face_image_url": "https://cdn.goonify.ai/examples/input.jpg"
  }
}

0 models

OpenAPI

Create a job

Create a job with POST /v2/jobs. Pass model and input. Each guide lists every model for that task and what it accepts.

Aliases POST /v2/t2i, /v2/i2i, /v2/i2v, /v2/faceswap, and /v2/upscale accept the same body. Poll GET /v2/jobs/{id} or wait for the webhook. webhook_url and callback_url are the same callback.

Queued jobs include estimated_wait_seconds. POST /v2/jobs/{id}/cancel refunds a queued job. Processing jobs cannot be cancelled.

JSON
{
  "model": "goonify/presets/missionary",
  "input": {
    "image_url": "https://cdn.goonify.ai/examples/input.jpg"
  }
}

Upload files

If you cannot host an image, POST /v2/files. Send a multipart file field, or JSON with a public url. The response url works as image_url, face_image_url, or video_url for 24 hours.

GET /v2/files/{id} returns a freshly signed CDN link. Expired files return 404.

JSON
{
  "url": "https://cdn.goonify.ai/examples/input.jpg"
}

Characters

Create a character with goonify/create-character, then pass input.character on later jobs. Required fields are name, family (realistic or anime), and ethnicity.

Poll GET /v2/characters/{id} until status is ready. Then POST /v2/jobs with a preset or video model and input.character. Do not send image_url in the same request.

List your characters with GET /v2/characters. Delete one with DELETE /v2/characters/{id}. Generate a new preview with POST /v2/characters/{id}/regenerate. Regenerating charges the same create-character price.

Optional model picks the engine. Realistic accepts goonify/krea2 (Krea 2, the default), goonify/zit (Z-Image), goonify/flux2, and goonify/pony. Anime accepts goonify/illustrious, which is also the default. Leave model out to use that default. Regenerating without model keeps the engine you created with. The price stays $0.10.

JSON
{
  "model": "goonify/create-character",
  "input": {
    "name": "Ava",
    "family": "realistic",
    "ethnicity": "white",
    "model": "goonify/flux2",
    "appearance": {
      "hair_style": "long",
      "hair_color": "blonde",
      "eye_color": "blue"
    }
  }
}
JSON
{
  "model": "goonify/presets/missionary",
  "input": {
    "character": "char_42"
  }
}

List the catalog

GET /api/v2/models

Returns the live catalog. counts.models, counts.presets, and counts.tools are the true sizes. The length of data is not the model count. Filter with kind or task. No authentication required.

Parameters

kindstring

Optional

foundation, preset, or tool.

modalitystring

Optional

image or video.

taskstring

Optional

t2i, i2i, t2v, i2v, image-preset, video-preset, or tool. Image presets are not included in t2i. Video presets are not included in i2v.

statusstring

Optional

Only live catalog rows are returned.

Create a job

POST /api/v2/jobs

Queue a job for any live model id from GET /v2/models. Text to image needs a prompt. Image to image, video, presets, faceswap, and enhance need the matching input URLs or a character id. Create character needs name, family, and ethnicity. Sandbox keys return an example result without spending credits.

Parameters

Header parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Idempotency-Keystring

Optional

Optional unique key so retries do not create a second job.

Body parameters

modelstring

Required

Public model id from GET /v2/models. Examples: goonify/flux2, goonify/wan22, goonify/presets/missionary, goonify/create-character, goonify/faceswap, goonify/enhance.

inputobject

Required

Generation input. Use prompt for text to image. Add image_url or character for image to image, video, and presets. Create character uses name, family, and ethnicity. Faceswap also needs face_image_url. Dual-image presets need image_url_2.

webhook_urlstring

Optional

HTTPS URL called when the job completes or fails.

Retrieve a model

GET /api/v2/models/{model_id}

Returns one catalog model card: public id, price, modality, and input requirements.

Parameters

model_idstring

Required

Public model id, for example goonify/flux2.

Model input schema

GET /api/v2/models/{model_id}/schema

JSON Schema for the input object POST /v2/jobs accepts for this model.

Parameters

model_idstring

Required

Public model id, for example goonify/flux2.

Estimate a job

POST /api/v2/models/{model_id}/estimate

Returns the USD cost and current queue wait. Does not create a job or deduct credits.

Parameters

model_idstring

Required

Public model id, for example goonify/flux2.

Retrieve a job

GET /api/v2/jobs/{id}

Poll any v2 job. Completed jobs include output.url on the CDN. Accepts gen_18402 or the numeric id.

Parameters

Header parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Path parameters

idstring

Required

Job id from POST /v2/jobs, for example gen_18402.

List jobs

GET /api/v2/jobs

List your jobs, newest first. Filter by status and page with starting_after.

Parameters

Header parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Query parameters

statusstring

Optional

queued, processing, completed, failed, or cancelled.

limitinteger

Optional

Number of jobs to return. Default 20, maximum 100.

starting_afterstring

Optional

Public job id to page after, for example gen_18402.

Cancel a job

POST /api/v2/jobs/{id}/cancel

Cancel a queued job and refund credits. Jobs that are already processing cannot be cancelled.

Parameters

Header parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Path parameters

idstring

Required

Job id from POST /v2/jobs, for example gen_18402.

Upload a file

POST /api/v2/files

Host an image or video for 24 hours and get a CDN URL you can pass as image_url, face_image_url, or video_url. Send multipart field file, or JSON with a public url.

Parameters

Header parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Body parameters

urlstring

Optional

Public HTTPS image or video URL to ingest. Omit when uploading multipart file.

Retrieve a file

GET /api/v2/files/{id}

Returns file metadata and a freshly signed CDN URL. Expired files return 404.

Parameters

Header parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Path parameters

idstring

Required

File id from POST /v2/files, for example file_4f2c1a9e0b3d4e5f6a7b8c9d0e1f2a3b.

Create a character

POST /api/v2/characters

Create a reusable character. Returns a job. Poll GET /v2/characters/{id} until status is ready, then pass input.character on a later job.

Parameters

Header parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Idempotency-Keystring

Optional

Optional unique key so retries do not create a second job.

Body parameters

namestring

Required

Display name, 2 to 80 characters.

familystring

Required

realistic or anime.

ethnicitystring

Required

asian, black, white, latina, arab, indian, elf, alien, demon, or custom.

appearanceobject

Optional

Optional hair, eyes, body, and similar appearance fields.

promptstring

Optional

Optional extra appearance notes.

modelstring

Optional

Optional Create engine. Realistic: goonify/krea2 (default), goonify/zit, goonify/flux2, goonify/pony. Anime: goonify/illustrious (default).

webhook_urlstring

Optional

HTTPS URL called when the preview job completes or fails.

Retrieve a character

GET /api/v2/characters/{character_id}

Returns the character status and preview_url when ready. Pass the same id as input.character on POST /v2/jobs.

Parameters

Header parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Path parameters

character_idstring

Required

Public character id, for example char_42.

List characters

GET /api/v2/characters

List characters you own, newest first. Includes drafts still generating. Page with starting_after.

Parameters

Header parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Query parameters

limitinteger

Optional

Number of characters to return. Default 20, maximum 100.

starting_afterstring

Optional

Public character id to page after, for example char_42.

Regenerate a character

POST /api/v2/characters/{character_id}/regenerate

Queue a new preview for an existing character. Reuses the stored name, family, ethnicity, appearance, and model unless you override them. Charges the same create-character price.

Parameters

Header parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Idempotency-Keystring

Optional

Optional unique key so retries do not create a second job.

Path parameters

character_idstring

Required

Public character id, for example char_42.

Body parameters

namestring

Optional

Optional new display name, 2 to 80 characters.

familystring

Optional

Optional new family: realistic or anime.

ethnicitystring

Optional

Optional new ethnicity. Same values as create.

appearanceobject

Optional

Optional appearance overrides merged onto the existing character.

promptstring

Optional

Optional extra appearance notes.

modelstring

Optional

Optional new Create engine. Leave it out to keep the engine used at create. It must match the family.

webhook_urlstring

Optional

HTTPS URL called when the preview job completes or fails.

Delete a character

DELETE /api/v2/characters/{character_id}

Permanently delete a character you own, including its preview.

Parameters

Header parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Path parameters

character_idstring

Required

Public character id, for example char_42.

Usage summary

GET /api/v1/usage/summary

Credits balance plus today, week, and month job counts for the authenticated key.

Parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Usage history

GET /api/v1/usage/history

Recent job spend for the authenticated key.

Parameters

Authorizationstring

Required

Bearer sk_test_… or sk_live_…

Webhooks

Pass webhook_url on create. We POST the same JSON as GET /v2/jobs/{id}: id, object, status, model, input, output.url, error, and cost. Failed jobs include a stable error object.

JSON
{
  "id": "gen_18402",
  "object": "job",
  "status": "completed",
  "model": "goonify/flux2",
  "input": {
    "prompt": "a woman standing in a sunlit studio, photorealistic"
  },
  "output": {
    "url": "https://cdn.goonify.ai/results/18402/result.webp"
  },
  "error": null,
  "cost": {
    "usd": 0.06
  }
}

Every delivery includes X-Goonify-Signature: t=<unix_seconds>,v1=<hex>. The signed payload is timestamp + "." + raw body with HMAC-SHA256 and your dashboard signing secret. Reject timestamps older than 5 minutes.

python
import hmac, hashlib, time

def verify_goonify_webhook(payload: bytes, header: str, secret: str, tolerance=300):
    parts = dict(p.split("=", 1) for p in header.split(","))
    timestamp = int(parts["t"])
    expected = hmac.new(
        secret.encode(),
        f"{timestamp}.".encode() + payload,
        hashlib.sha256,
    ).hexdigest()
    if not hmac.compare_digest(expected, parts["v1"]):
        raise ValueError("invalid signature")
    if abs(time.time() - timestamp) > tolerance:
        raise ValueError("timestamp too old")

HTTP 2xx is success. Failed attempts retry after 1 second, 10 seconds, 60 seconds, 10 minutes, and 1 hour. Delivery history is on the developer dashboard.

The official SDKs expose verify_webhook in Python and verifyWebhookAsync in TypeScript.

Idempotency

Send Idempotency-Key on create endpoints so network retries do not double-charge. Keys are scoped to your API key and stored for 24 hours. Use a UUID per logical job.

  • Same key and same body: we return the original response (Idempotent-Replayed: true).
  • Same key and a different body: 409 with idempotency.conflict.
  • A request still in flight: 409 with idempotency.in_progress (retryable).

File encryption

A completed job returns output.url. That link is a viewable image or video.

The job response does not include encryption metadata. Download output.url. Never log or share your secret key.

Error codes

Error responses include error.code, a short message, and a retryable flag.

CodeMeaning
400Invalid request body or URL
401Invalid or missing API key
402Insufficient credits
403Account banned or job belongs to another key
404Job not found
409Idempotency conflict or request already in progress
429Rate limit exceeded
500Internal error

Rate limits

Limits are per API key, per minute. Sandbox keys have higher limits.

EndpointLiveSandbox
POST /v2/jobs100 / min300 / min
POST /v2/t2i, /i2i, /i2v, /faceswap, /upscale100 / min300 / min
POST /v2/jobs/{id}/cancel100 / min300 / min
POST /v2/characters100 / min300 / min
POST /v2/characters/{id}/regenerate100 / min300 / min
GET /v2/characters100 / min300 / min
GET /v2/characters/{id}600 / min1000 / min
POST /v2/files60 / min120 / min
GET /v2/jobs/{id}600 / min1000 / min
GET /v2/jobs100 / min300 / min
GET /v2/models300 / min1000 / min
GET /usage/*300 / min500 / min