CodingMantra LogoCodingMantra
PortfolioServicesPricingContact
  1. Home
  2. API Documentation
  3. Image Generation API

Image Generation API

Endpoints for programmatically creating images with our AI tools.

GET
/api/image/product-photography-prompts

Retrieve a list of all available pre-defined scene instructions for the Product Photography endpoint.

Example Request

curl -X GET 'https://codingmantra.com/api/image/product-photography-prompts'

Example Response

{
  "data": [
    {
      "id": "minimalist-white",
      "title": "E-commerce White Background",
      "categoryId": "studio-minimalist",
      "categoryTitle": "Studio & Minimalist",
      "demoImageUrl": "https://..."
    },
    // ... more prompts
  ]
}

POST
/api/image/product-photography

Generate a professional product photograph by placing your product in a custom scene.

Request Body

Note: Either `promptId` or `scenePrompt` is required.

FieldTypeDescription
productImagesArray of ObjectsRequired. An array of product image objects. Each object must have either a `dataUrl` (a Base64 data URI) or a `url` (a public https URL pointing to a JPEG, PNG, or WEBP image). Also supports an optional `label` string and an optional `prompt` string.
promptIdstringOptional. The ID of a pre-defined scene instruction. Use this for curated scenes. Get available IDs from the `/api/image/product-photography-prompts` endpoint.
scenePromptstringOptional. A text description of the desired background or scene. Can be used alone or as an addition to a `promptId`.
logoImagestringOptional. A public https URL of a logo to place on the image.
overlayTextstringOptional. Short text to overlay prominently on the image.
marketingTextstringOptional. More detailed marketing text or slogan.
aspectRatiostringOptional. The desired output aspect ratio. Can be `'1:1'` (Square), `'16:9'` (Landscape), or `'9:16'` (Portrait). Default: `'1:1'`.
outputResultstringOptional. The desired output format. Can be `'base64'` (default) to receive a data URI, or `'url'` to receive hosted image URLs.

Example Request (with promptId)

curl -X POST 'https://codingmantra.com/api/image/product-photography' \
     -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer YOUR_API_KEY' \
     -d '{
          "productImages": [
            { "url": "https://example.com/my-product.png", "label": "bottle" }
          ],
          "promptId": "rustic-wood-table",
          "scenePrompt": "with grapes and cheese",
          "logoImage": "https://example.com/my-logo.png",
          "aspectRatio": "16:9",
          "outputResult": "url"
        }'

Example Response (outputResult: 'url')

{
  "data": {
    "imageUrl": "https://storage.googleapis.com/...",
    "thumbnailUrl": "https://storage.googleapis.com/..."
  }
}

Example Response (outputResult: 'base64')

{
  "data": {
    "photoDataUri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
  }
}

On This Page

GET PromptsPOST Product Photography
CodingMantra LogoCodingMantra

Providing business solutions for small and medium-sized businesses and helping them to grow.

X / TwitterLinkedInInstagramFacebookGitHub

Company

  • About Us
  • Services
  • Products
  • Portfolio
  • Pricing
  • Blog
  • API Docs
  • Contact Us

Top Tools

  • All Tools
  • Image Tools
  • Digital Marketing
  • Financial Tools
  • SEO Tools

Legal

  • Privacy Policy
  • Terms & Conditions
  • Return Policy
  • Sitemap

© 2025 CodingMantra. All Rights Reserved.