Slazzer logo
Slazzer App

All-in-one AI photo editor

Get App

Grocery API

  • Ecommerce
  • Grocery Tech
  • Visual Commerce
Instantly Process Grocery Images with AI-Powered API

Enhance grocery delivery and FMCG shopping experiences with high-quality image processing. Ensure sharp, engaging product visuals for better customer engagement.

API Reference

Head
  • Server URL:
    https://api.slazzer.com/v2.0
  • Request Body:
    multipart/form-data
  • Method:
    POST
  • API:
    /grocery

Authorization

  • API-KEY :
    string
  • Your API key :
    xxxx xxxx xxxx xxxx
  • Get API Key
Parameters Request body
  • source_image_file

    Type :string ($binary)

    Required :Yes (Only one of the source_image_ parameters can be used in a single request.)

    Description :

    The source_image_file parameter allows you to upload an image of a grocery item, which will be processed by the API. The uploaded image is analyzed and optimized for e-commerce, delivery apps, and inventory systems, ensuring high-quality product representation. This enhances product visibility, making it more engaging for customers.

    Supported Format :PNG, JPG, JPEG.

    Examples :source_image_file = @/path/to/image.png

    Important : 0.50 credit will be charged for each processing.
  • scaling_mode

    Type : string

    Required : Yes

    Description :

    The scaling_mode parameter determines how the image is resized to fit the given dimensions. It controls whether the entire image fits within the specified dimensions or fills them completely.

    Possible Values:
    • fit (Default) - The image is resized to fit within the given dimensions while maintaining its aspect ratio. Empty space (padding) may appear if the aspect ratio does not match.
    • fill - The image is resized to completely fill the given dimensions, which may cause some parts of the image to be cropped if the aspect ratio does not match.

    Example : scaling_mode = fill

    Important :
    • The default value is fit, meaning the image will retain its aspect ratio and fit within the dimensions.
    • Set to fill if you want the image to fully occupy the given dimensions, even if cropping occurs.
  • bg_color_code

    Type :string

    Required :No

    Description :

    The bg_color_code parameter is used to specify a solid background color for the processed image. The color must be provided as a HEX color code.

    Supported Format :HEX color code (e.g., #72E4B3 or #B3D472)

    Examples :bg_color_code = #72E4B3

    Important : The color code must include the # symbol before the color code.
  • bg_image

    Type : string ($binary)

    Required : No

    Description :

    The bg_image parameter allows you to upload a background image for the grocery scene. When provided, the uploaded image will replace the default or existing background during processing, creating a customized scene.

    Input Format :
    • Upload a valid image file (e.g., JPEG, PNG).
    Important :
    • If you do not provide a bg_image, the system will use the default background.
    • Uploaded background images should match or complement the desired grocery scene layout.
    • 0.50 credit will be charged for each processing.
  • reference_type

    Type : string

    Required : No

    Description :

    The reference_type parameter determines how the grocery item is referenced. It controls whether the reference is based on the subject (general category) or the original (specific product).

    Possible Values:
    • subject (Default) - The grocery item is referenced by its general category rather than a specific brand or product.
    • original - The grocery item is referenced exactly as it appears in the original data, including specific product details.

    Example : reference_type = original

    Important :
    • The default value is subject, meaning the item is categorized generally.
    • Set to original if you want to use the exact product reference instead of a general category.
  • padding

    Type : int

    Required : No

    Description :

    The padding parameter allows you to add extra space around the subject before processing the image. The padding is applied in the sequence: top, right, bottom, left. If a single value is provided, it applies to all sides equally.

    Supported Formats :
    • 0% (Default) - No padding is applied.
    • 10% - Adds a 10% padding around the subject relative to its size.
    • 20px - Adds a fixed 20px padding on all sides.
    • 10px, 20px, 15px, 25px - Defines different padding values for each side: 10px top, 20px right, 15px bottom, and 25px left.
    • 10%, 20%, 15%, 25% - Defines different padding percentages relative to the subject’s size.
    Examples :
    • padding = 10% - Adds a 10% padding around the subject.
    • padding = 10px, 15px, 20px, 25px - Specifies different padding values for each side in the order: top, right, bottom, left.
    Important : The maximum allowed padding is 49% of the subject's size.
  • text_prompt

    Type : string

    Required : No

    Description :

    The text_prompt parameter provides a textual description of the desired grocery scene. The API processes this input to generate or analyze grocery-related images, such as store shelves, shopping carts, or product displays.

    Examples :
    • text_prompt = "Place the <item> on a wooden table."
    Important :
    • When you want to generate AI-background for your Grocery cataloging use these parameters.
    • Be specific about where you want to place your products.
    • 0.50 credit will be charged for each processing.
  • seed

    Type : int

    Required : No

    Description :

    The seed parameter determines the randomization seed for generating grocery-related images. By using the same seed value, you can reproduce the exact same image generation result. If no seed is provided, the system will use a random value to produce varied outputs.

    Examples :
    • seed = 12345
    Important :
    • If you want reproducible results, use the same seed value.
    • If no seed is provided, a random value is used, resulting in different outputs.
    • 0.50 credit will be charged for each processing.
  • relighting

    Type : boolean

    Required : No

    Description :

    The relighting parameter enables or disables automatic relighting adjustments to enhance the subject's illumination. It can help improve visibility and consistency in images with varying light conditions.

    Possible Values :
    • false (Default) - No relighting adjustments are applied.
    • true - Enables automatic relighting adjustments.
    • 0 - Equivalent to false.
    • 1 - Equivalent to true.
    Examples :
    • relighting = true - Enables automatic relighting.
    • relighting = 1 - Enables automatic relighting (same as true).
    • relighting = false - No relighting applied.
    • relighting = 0 - Disables relighting (same as false).
    Important :
    • Only accepts values true, false, 1, or 0.
    • By default, false is applied if no value is provided.
  • canvas_size

    Type : string

    Required : No

    Description :

    The canvas_size parameter specifies the width and height of the canvas (in pixels) for generating or analyzing grocery images. It follows the format width x height (e.g., 800x600). This controls the output size of the image.

    Input Format :
    • canvas_size = widthxheight (e.g., 800x600)
    Defaults :
    • For Playground: Defaults to 1000x1000.
    • For API: Defaults to the size of your input image.
    Important :
    • Use canvas_size to control the output dimensions of the grocery scene image.
    • If omitted, the API uses the size of your input image as the default.
    • 0.50 credit will be charged for each processing.
Response

Success

Request processed successfully!
Your request has been processed and completed. The response contains the result data or file as requested.

Binary image data

Error

Bad Request!
The request contains invalid parameters or input format. Please check the input and try again. (No credits were deducted.)

Example :
{
    "error": "Invalid input"
}

Error

Unauthorized!
Missing or invalid API key. Please provide a valid API key. (No credits were deducted.)

Example :
{
    "error": "invalid api key"
}

Error

Credits Required!
No credits remaining. Please top up your account to continue. (No credits were deducted.)

Example :
{
    "error": "No credits remaining"
}

Error

Rate Limit Exceeded!
Api rate limit crossed (No credit deducted)

Example :
{
    "error": "Api rate limit crossed"
}