Skip to main content
POST
Generate an image

Authorizations

Authorization
string
header
required

Create a NoMask API key at https://nomask.ai/api/keys. Keep it private; enter only your own key when sending a request.

Headers

Idempotency-Key
string

Optional duplicate protection for 24 hours. A reused accepted key returns 409; image bytes are not cached for replay.

Required string length: 1 - 255
Pattern: ^[!-~]+$

Body

Reference images must be PNG, JPEG or WebP; decoded references total at most 25 MiB. JSON body limit is 40 MiB. Each image must be at most 16384 pixels per side and 40 million pixels.

model
string
required

Current public image model ID from GET /models.

Required string length: 1 - 150
Example:

"your-image-model-id"

prompt
string
required

Nonempty UTF-8 prompt, within this model's limits.max_prompt_characters.

Minimum string length: 1
Example:

"A quiet mountain lake at sunrise"

n
enum<integer>
default:1

One output image.

Available options:
1
response_format
enum<string>
default:b64_json

Images are returned inline; hosted URL responses are unavailable.

Available options:
b64_json
resolution
string

An advertised tier from limits.supported_resolutions. Omit to use the model default.

aspect_ratio
string

An advertised value from limits.supported_aspect_ratios. Omit to use the model default.

size
string
default:auto

Alias accepting auto, an advertised resolution tier, or WIDTHxHEIGHT that maps to a supported tier and aspect ratio. Conflicting explicit options are rejected; exact pixel dimensions are not guaranteed.

output_format
enum<string>
default:png

Output format. jpeg is normalized to jpg.

Available options:
png,
jpg,
jpeg,
webp
format
enum<string>

Alias used when output_format is absent.

Available options:
png,
jpg,
jpeg,
webp
stream
enum<boolean>
default:false

Images return completed JSON only.

Available options:
false
user
string

Accepted for client compatibility; it does not affect image generation.

image

Single reference data URL or a list. Use either image or images, never both.

Pattern: ^data:image/(png|jpeg|webp);base64,
Example:

"data:image/png;base64,BASE64_IMAGE_BYTES"

images

Reference data URL(s). The model controls the minimum and maximum count.

Pattern: ^data:image/(png|jpeg|webp);base64,
Example:

"data:image/png;base64,BASE64_IMAGE_BYTES"

Response

Successful response. Example values are illustrative.

created
integer<int64>
required

Unix timestamp.

request_id
string
required

Matches the X-Request-Id header.

model
string
required

Public image model ID.

data
object[]
required
Required array length: 1 element
usage
object
required
nomask
object
required