{"openapi":"3.1.0","info":{"title":"Magnt Image API","version":"1.0.0","summary":"Generate or edit one image per request.","description":"Send a prompt and up to 3 inline photos, get one WebP image back as raw bytes or base64 JSON. Each request stands alone: no history, no stored images, no polling. Each image spends 1 credit from the Magnt plan that owns the key. 30 requests an hour per account.","contact":{"name":"Magnt support","url":"https://magnt.app/support"},"termsOfService":"https://magnt.app/terms"},"externalDocs":{"description":"API reference","url":"https://magnt.app/image-api/reference"},"servers":[{"url":"https://magnt.app/api/v1"}],"security":[{"bearerAuth":[]}],"paths":{"/images/generations":{"post":{"operationId":"createImage","summary":"Generate or edit an image","description":"Leave images empty to generate from the prompt. Attach photos to edit them and say what should change and what should stay. Send the photos again for each new edit.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationRequest"}}}},"responses":{"200":{"description":"One generated image.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationResponse"}},"image/webp":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid JSON, fields, image or prompt.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The account needs a plan or a top-up.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Request or output too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Content-Type must be application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"No image came back. Rework the prompt or inputs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited. Wait, then retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Generation failed. Try again later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Model temporarily unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"Generation interrupted after 180 seconds. It may still finish; don't resubmit straight away.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/models":{"get":{"operationId":"listModels","summary":"List available models","description":"Public, no key needed. An empty list means no model is available right now.","security":[],"responses":{"200":{"description":"Models you can call right now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelList"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"A Magnt API key (mgnt_ followed by 64 hex characters) from https://magnt.app/developers. Keep it on the server."}},"schemas":{"GenerationRequest":{"type":"object","additionalProperties":false,"required":["prompt"],"properties":{"prompt":{"type":"string","minLength":1,"maxLength":4000,"description":"What to make or change."},"model":{"type":"string","default":"magnt-image-1","description":"A model ID from GET /models."},"images":{"type":"array","maxItems":3,"default":[],"description":"Base64 data URLs (PNG, JPEG or WebP), each up to 2 MiB decoded. Remote URLs are not accepted.","items":{"type":"string","pattern":"^data:image/(png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$"}},"aspect_ratio":{"type":"string","enum":["1:1","4:5","3:2","2:3","16:9","9:16"],"default":"1:1"},"resolution":{"type":"string","enum":["1K","2K"],"default":"1K"},"response_format":{"type":"string","enum":["b64_json","image"],"default":"b64_json","description":"image returns raw WebP bytes. b64_json returns JSON with the image encoded."}}},"GenerationResponse":{"type":"object","required":["created","model","data"],"properties":{"created":{"type":"integer","description":"Unix timestamp in seconds."},"model":{"type":"string"},"data":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"object","required":["b64_json","mime_type","width","height"],"properties":{"b64_json":{"type":"string"},"mime_type":{"type":"string","const":"image/webp"},"width":{"type":"integer"},"height":{"type":"integer"}}}}}},"ModelList":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"aspect_ratios":{"type":"array","items":{"type":"string"}},"resolutions":{"type":"array","items":{"type":"string"}},"max_input_images":{"type":"integer"},"output_format":{"type":"string"}}}}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","description":"Stable machine-readable code, such as rate_limited or allowance_required."},"message":{"type":"string"}}}}}}}}