Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.
openapi: 3.2.0
info:
title: Mochify Generate API
version: 1.0.0
description: Mochify's REST API for zero-retention image compression, PDF page extraction/splitting, and AI image generation. Images and PDFs are streamed into RAM at api.mochify.app, processed, and returned; the original bytes are never written to disk. Authenticate with an x-api-key header (dashboard-issued key) for quota tracking, or omit auth entirely for anonymous, IP-metered use on the free tier.
contact:
url: https://mochify.app/docs
servers:
- url: https://api.mochify.app
description: Production
security:
- bearerAuth: []
- apiKeyAuth: []
- {}
tags:
- name: Generate
description: Text-to-image generation (paid plans)
paths:
/v1/generate:
post:
operationId: generateImage
tags:
- Generate
summary: Generate an image from a text prompt (paid plans only)
description: No uploaded image — creates one from scratch via a configured image model (Cloudflare AI Gateway). Requires Seller, Pro, Growth, or Day Pass; costs 10 credits, charged only on success. Returns a ZIP containing the untouched model output plus one file per requested format × size.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- prompt
properties:
prompt:
type: string
maxLength: 2000
aspect:
type: string
enum:
- '1:1'
- '3:4'
- '4:3'
- '9:16'
- '16:9'
default: '1:1'
formats:
type: array
items:
type: string
enum:
- jpg
- png
- webp
- avif
- jxl
maxItems: 5
description: Empty/omitted returns the model's native format only.
sizes:
type: array
items:
type: object
properties:
width:
type: integer
maxItems: 6
description: Empty/omitted returns full resolution only.
responses:
'200':
description: ZIP containing original.<ext> plus one <width>w.<ext> per format × size.
headers:
X-Latency-Ms:
schema:
type: integer
content:
application/zip: {}
'400':
description: Missing/oversized prompt.
content:
text/plain: {}
'403':
description: Caller's plan does not include generation.
content:
text/plain: {}
'429':
description: Fewer than 10 credits remaining.
content:
text/plain: {}
'502':
description: Upstream image model unreachable, errored, or returned no usable image.
content:
text/plain: {}
'503':
description: Generation not configured server-side, or worker pool at capacity.
content:
text/plain: {}
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: 'Dashboard-issued API key sent as `Authorization: Bearer <key>`. This is the header documented on /docs and in the dashboard, and the one to prefer. A signed-in session token is accepted here too. Note: a bearer token that cannot be resolved does not fail the request, it falls through to anonymous IP-based free-tier limits, so a wrong key behaves exactly like sending no key at all. Send the key as x-api-key instead if you want an unusable key reported back to you.'
apiKeyAuth:
type: apiKey
in: header
name: x-api-key
description: The same dashboard-issued API key, sent in the x-api-key header. Used by /v1/squish, /v1/pdf, /v1/generate, /v1/checkTokens, /v1/upload/*. Unlike the bearer header, a key that cannot be resolved is reported as invalid rather than silently downgraded. If no credential is sent at all, these endpoints fall back to anonymous IP-based rate limiting on the free tier rather than rejecting the request.