POST https://api.kodisc.com/generate/image

Body

Required

  • apiKey (string): API key generated via the Kodisc Dev dashboard.
  • prompt (string): Prompt used to generate the image.

Body must be FormData in order to work.

Response

  • success (boolean): Whether the request succeeded or not. It can fail due to multiple factors including invalid API key, insufficient credits, failed video generation (rare, also will not charge API key for a failed request)
  • error (string?): Error message if success is false.
  • image (string?): If the request succeeded, this is the URL of the generated image on Kodisc’s CDN.
  • code (string?): If the request succeeded, this is the code used to generate the image.

Example

TypeScript
const body = new FormData();
body.append("apiKey", "kodisc_xxxx");
body.append("prompt", "Draw the function x^2");

const response = await fetch("https://api.kodisc.com/generate/image", {
    method: "POST",
    body
});
const json = (await response.json()) as {
    success: boolean;
    error?: string;
    image?: string;
    code?: string;
};