{"openapi":"3.1.0","info":{"title":"MakePixel API","version":"1","description":"Pixel art from a sentence. Authenticate with `Authorization: Bearer mkp_live_…` (or `mkp_test_…` for free test calls)."},"servers":[{"url":"https://makepixel.ai/api/v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"schemas":{"CreateGeneration":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"prompt":{"type":"string","minLength":1,"maxLength":2000,"description":"What to draw, in any language"},"count":{"default":1,"description":"Images to make: 1, 2, 4 or 8","anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":4},{"type":"number","const":8}]},"detail":{"default":"standard","description":"How fine the pixel art is","type":"string","enum":["simple","standard","detailed"]},"background":{"default":"transparent","description":"`transparent`: the subject alone, cropped; `keep`: the whole picture","type":"string","enum":["transparent","keep"]},"project":{"description":"A project to place the images on. Default: the key's project, or none","type":"string","pattern":"^[0-7][0-9A-HJKMNP-TV-Z]{25}$"}},"required":["prompt"],"additionalProperties":false},"Generation":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"generation"},"livemode":{"type":"boolean"},"status":{"type":"string","enum":["running","succeeded","failed","canceled"]},"credits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Credits charged, after refunds"},"refunded":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Credits refunded for images that never came"},"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"project":{"type":["string","null"]},"editor_url":{"type":"string"},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"width":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"height":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"colors":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Opaque colours used"},"palette":{"type":"array","items":{"type":"string"},"description":"The colours used, `#rrggbb`"},"png":{"type":"string","description":"The true-pixel PNG"},"files":{"type":"object","properties":{"png":{"type":"string"},"json":{"type":"string"},"aseprite":{"type":"string"},"gpl":{"type":"string"},"hex":{"type":"string"}},"required":["png","json","aseprite","gpl","hex"],"additionalProperties":false},"editor_url":{"type":"string"}},"required":["id","width","height","colors","palette","png","files"],"additionalProperties":false}},"error":{"type":"object","properties":{"reason":{"type":"string","enum":["content_refused","nothing_usable","upstream_unavailable"]}},"required":["reason"],"additionalProperties":false}},"required":["id","object","livemode","status","credits","refunded","count","project","images"],"additionalProperties":false},"Account":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"object":{"type":"string","const":"account"},"livemode":{"type":"boolean"},"available":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Credits available to spend now"},"key":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"mode":{"type":"string","enum":["live","test"]},"daily_credit_cap":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"used_today":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"resets_at":{"type":"string","description":"When `used_today` goes back to 0 (UTC midnight)"}},"required":["id","name","mode","daily_credit_cap","used_today","resets_at"],"additionalProperties":false}},"required":["object","livemode","available","key"],"additionalProperties":false},"Error":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"details":{"anyOf":[{"type":"object","properties":{"reason":{"type":"string"}},"additionalProperties":{},"description":"Most errors: `reason`, and what else that reason says"},{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"],"additionalProperties":false},"description":"A request that fails validation (400, no `reason`): one entry for each problem"}]}},"required":["code","message","request_id"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}},"paths":{"/generations":{"post":{"summary":"Create a generation","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","maxLength":64},"description":"Retry with the same key to get the same generation back, never a second charge"},{"name":"Prefer","in":"header","schema":{"type":"string","example":"wait=30"},"description":"`wait=N`: wait up to N seconds (max 60) for the result"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateGeneration"}}}},"responses":{"200":{"description":"Finished, or an idempotent replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generation"}}}},"202":{"description":"Started","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generation"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/generations/{id}":{"get":{"summary":"Get a generation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"wait","in":"query","schema":{"type":"integer","minimum":0,"maximum":60},"description":"Wait up to this many seconds while it is running"}],"responses":{"200":{"description":"The generation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generation"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/images/{id}.{format}":{"get":{"summary":"Download an image","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"format","in":"path","required":true,"schema":{"type":"string","enum":["png","json","aseprite","gpl","hex"]}},{"name":"scale","in":"query","schema":{"type":"integer","minimum":1,"maximum":16},"description":"PNG only: nearest-neighbour upscale"}],"responses":{"200":{"description":"`png`: true-pixel PNG; `json`: width, height, palette and a grid of palette indices (-1 = transparent); `aseprite`; `gpl` / `hex`: the palette"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/account":{"get":{"summary":"Credits and this key's daily use","responses":{"200":{"description":"The account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}