api
AI Diffusion

Documentation

Endpoint

POST https://api.i-as.dev/api/ai/diffusion


Request

Headers

Ensure that you include the appropriate headers, such as:

  • Content-Type: application/json

Request Body

Provide a JSON object with the following structure:

{
  "keyword": "string or url_image"
}
Field Type Description
keyword string A keyword describing the image to generate or a valid image URL.

Response

The response will return a JSON object containing a list of generated images and their details.

Response Format

{
  "images": [
    {
      "id": "string",
      "srcSmall": "url",
      "srcMedium": "url",
      "prompt": "string",
      "width": "value",
      "height": "value"
    }
    // More data
  ]
}
Field Type Description
id string A unique identifier for the generated image.
srcSmall url URL for the small version of the generated image.
srcMedium url URL for the medium version of the generated image.
prompt string The keyword or prompt used for generating the image.
width value The width of the generated image in pixels.
height value The height of the generated image in pixels.

Example

Request

POST https://api.i-as.dev/api/ai/diffusion
Content-Type: application/json

{
  "keyword": "sunset over the mountains"
}

Response

{
  "images": [
    {
      "id": "123456",
      "srcSmall": "https://example.com/images/small/123456.jpg",
      "srcMedium": "https://example.com/images/medium/123456.jpg",
      "prompt": "sunset over the mountains",
      "width": 800,
      "height": 600
    }
  ]
}

Error Handling

Possible Errors

Error Code Message Description
400 Invalid Request The request body is missing or incorrectly formatted.
500 Internal Server Error An error occurred on the server while processing.

Error Response Format

{
  "error": {
    "code": "400",
    "message": "Invalid Request"
  }
}

Notes

  • Ensure the keyword value is meaningful to generate accurate and relevant images.
  • URLs in srcSmall and srcMedium can be used to fetch and display the images in your application.