---
updatedAt: 2025-03-02T09:37:51.000Z
agentTools:
  projectIndex: https://docs.writesonic.com/llms.txt
---

# Generate Image

<b> Generate images that will make your content stand out from the crowd. </b>

# OpenAPI definition

```json
{
  "openapi": "3.0.2",
  "info": {
    "title": "Writesonic Docs",
    "description": "This is the documentation for Writesonic's API. To be able to test the API, please register an account and request an api key at [Writesonic](https://writesonic.com). <br/> Please check out the tutorials section for more information<br/> <ul> <li> [Find your API key](../docs/Find%20Api%20Key) </li> <li>[Test an endpoint](../docs/Test%20An%20Endpoint)</li></ul> <p> Writesonic API has been upgraded to V2(beta) version. [Click here to read V2 docs (beta)](../api-docs/v2.html) <br/> Note - as all APIs are backwards-compatible, old endpoints will not be impacted by this change. </p> For any queries write us to at support@writesonic.com",
    "contact": {
      "email": "support@writesonic.com"
    },
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.writesonic.com",
      "description": "Production"
    }
  ],
  "paths": {
    "/v1/business/photosonic/generate-image": {
      "post": {
        "tags": [
          "PhotoSonic Business"
        ],
        "summary": "Generate Image",
        "description": "\n\n<b> Generate images that will make your content stand out from the crowd. </b>\n\n",
        "operationId": "generate_image_v1_business_photosonic_generate_image_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InputBusinessGenerateImages"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutputPhotosonicBusinessCopy"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "title": "HTTPValidationError",
        "type": "object",
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            }
          }
        },
        "example": null
      },
      "InputBusinessGenerateImages": {
        "title": "InputBusinessGenerateImages",
        "required": [
          "prompt"
        ],
        "type": "object",
        "properties": {
          "prompt": {
            "title": "Prompt",
            "maxLength": 500,
            "minLength": 2,
            "type": "string"
          },
          "num_images": {
            "title": "Num Images",
            "type": "integer",
            "default": 2
          },
          "image_width": {
            "title": "Image Width",
            "type": "integer",
            "default": 512
          },
          "image_height": {
            "title": "Image Height",
            "type": "integer",
            "default": 512
          }
        },
        "example": null
      },
      "OutputPhotosonicBusinessCopy": {
        "title": "OutputPhotosonicBusinessCopy",
        "required": [
          "images"
        ],
        "type": "object",
        "properties": {
          "images": {
            "title": "Images",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "example": null
      },
      "ValidationError": {
        "title": "ValidationError",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "type": "object",
        "properties": {
          "loc": {
            "title": "Location",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "example": null
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-KEY"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```