> ## Documentation Index
> Fetch the complete documentation index at: https://docs.glood.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Automatic Recommendations

> Get automatic recommendations powered using LLMs

Each product carries `trending_rank` and `sales_rank` — shop-wide ranks refreshed daily; see the field reference.

```json 200 theme={null}
{
  "status": "ok",
  "serve_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "pagination": {
    "cursor": null
  },
  "products": [
    {
      "product_id": 9311227838783,
      "title": "Classic Cotton T-Shirt",
      "handle": "classic-cotton-t-shirt",
      "price": 1025,
      "compare_at_price": null,
      "tags": "cotton,casual,bestseller",
      "product_type": "T-Shirts",
      "vendor": "BrandName",
      "image": {
        "id": "gid://shopify/ProductImage/123456",
        "url": "https://cdn.shopify.com/s/files/1/example/products/t-shirt.jpg",
        "altText": "Classic Cotton T-Shirt",
        "width": 1600,
        "height": 1600
      },
      "options": [
        {
          "id": 123,
          "name": "Title",
          "position": 1,
          "values": ["Default Title"]
        }
      ],
      "variants": [
        {
          "variant_id": 48328566276415,
          "title": "Default Title",
          "display_name": "Classic Cotton T-Shirt - Default Title",
          "price": "1025.00",
          "compare_at_price": null,
          "sku": "",
          "position": 1,
          "is_in_stock": true,
          "available_for_sale": true,
          "sellable_online_quantity": 50,
          "selected_options": [
            {
              "name": "Title",
              "value": "Default Title"
            }
          ]
        }
      ],
      "metafields": [],
      "trending_rank": 3,
      "sales_rank": 7
    }
  ]
}
```

```json 400 theme={null}
{
  "errors": [
    {
      "message": "\"product_ids\" is required",
      "path": ["product_ids"],
      "type": "any.required",
      "context": {
        "label": "product_ids",
        "key": "product_ids"
      }
    }
  ]
}
```


## OpenAPI

````yaml POST /api/storefront/v3/headless/recommendations/automatic
openapi: 3.0.1
info:
  title: Glood.AI API Reference
  description: Glood.AI API Reference
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://storefront.glood.ai
security:
  - bearerAuth: []
paths:
  /api/storefront/v3/headless/recommendations/automatic:
    post:
      description: Get automatic recommendations powered using LLMs
      parameters:
        - name: x-shop
          in: header
          description: Shopify store URL
          required: true
          schema:
            type: string
            example: shop.myshopify.com
      requestBody:
        description: Request body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutomaticRecommendationsRequest'
      responses:
        '200':
          description: Recommendations
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomaticRecommendationsResponse'
              example:
                status: ok
                serve_id: 3c90c3cc-0d44-4b50-8888-8dd25736052a
                pagination:
                  cursor: null
                products:
                  - product_id: 9311227838783
                    title: Classic Cotton T-Shirt
                    handle: classic-cotton-t-shirt
                    price: 1025
                    compare_at_price: null
                    tags: cotton,casual,bestseller
                    product_type: T-Shirts
                    vendor: BrandName
                    image:
                      id: gid://shopify/ProductImage/123456
                      url: >-
                        https://cdn.shopify.com/s/files/1/example/products/t-shirt.jpg
                      altText: Classic Cotton T-Shirt
                      width: 1600
                      height: 1600
                    options:
                      - id: 123
                        name: Title
                        position: 1
                        values:
                          - Default Title
                    variants:
                      - variant_id: 48328566276415
                        title: Default Title
                        display_name: Classic Cotton T-Shirt - Default Title
                        price: '1025.00'
                        compare_at_price: null
                        sku: ''
                        position: 1
                        is_in_stock: true
                        available_for_sale: true
                        sellable_online_quantity: 50
                        selected_options:
                          - name: Title
                            value: Default Title
                    metafields: []
                    trending_rank: 3
                    sales_rank: 7
        '400':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomaticRecommendationsError'
components:
  schemas:
    AutomaticRecommendationsRequest:
      type: object
      required:
        - product_ids
        - recommendation_type
        - view
      properties:
        product_ids:
          type: array
          items:
            type: integer
          description: List of product IDs to get recommendations for
        recommendation_type:
          type: string
          description: Type of recommendations to retrieve
          enum:
            - similar_products
        view:
          type: string
          description: Context where recommendations will be displayed
          enum:
            - product_details
            - product_ids
        filter:
          type: object
          properties:
            variants:
              type: object
              properties:
                options:
                  type: array
                  items:
                    type: object
                    required:
                      - name
                      - value
                    properties:
                      name:
                        type: string
                        description: Option name
                      value:
                        type: string
                        description: Option value
                is_in_stock:
                  type: boolean
                  description: Filter by in-stock status
                sku:
                  type: array
                  items:
                    type: string
                  description: Filter by SKU
                available_for_sale:
                  type: boolean
                  description: Filter by availability for sale
            tags:
              type: array
              items:
                type: string
              description: Filter by product tags
            vendors:
              type: array
              items:
                type: string
              description: Filter by product vendors
            metafields:
              type: array
              items:
                type: object
                required:
                  - namespace
                  - key
                  - value
                properties:
                  namespace:
                    type: string
                    description: Metafield namespace
                  key:
                    type: string
                    description: Metafield key
                  value:
                    type: string
                    description: Metafield value
              description: Filter by product metafields
        pagination:
          type: object
          properties:
            cursor:
              type: string
              description: Cursor for pagination
            limit:
              type: integer
              description: >-
                Number of results to return per page. Minimum is 1 and maximum
                is 50
              minimum: 1
              maximum: 50
        publication_ids:
          type: array
          items:
            oneOf:
              - type: string
                pattern: ^[0-9]+$
              - type: integer
          maxItems: 50
          description: >-
            Optional. Numeric Shopify publication (sales channel) ids. When
            present, only products published on at least one of these channels
            are returned and the default "published to the Online Store" gate is
            replaced by this filter; market and B2B filters still apply. A
            single id may be sent without the array wrapper. Each id must be one
            the merchant enabled under Settings → Sales channels; unknown ids
            return 400. The id is the numeric tail of
            gid://shopify/Publication/<id>.
          example:
            - '30085840999'
    AutomaticRecommendationsResponse:
      type: object
      properties:
        status:
          type: string
          description: Status of the response
          enum:
            - ok
        serve_id:
          type: string
          description: Unique identifier for this recommendation serve
        pagination:
          type: object
          properties:
            cursor:
              type: string
              description: Cursor for pagination
        products:
          type: array
          items:
            $ref: '#/components/schemas/HeadlessRecommendedProduct'
      example:
        status: ok
        serve_id: 3c90c3cc-0d44-4b50-8888-8dd25736052a
        pagination:
          cursor: null
        products:
          - product_id: 9311227838783
            title: Classic Cotton T-Shirt
            handle: classic-cotton-t-shirt
            price: 1025
            compare_at_price: null
            tags: cotton,casual,bestseller
            product_type: T-Shirts
            vendor: BrandName
            image:
              id: gid://shopify/ProductImage/123456
              url: https://cdn.shopify.com/s/files/1/example/products/t-shirt.jpg
              altText: Classic Cotton T-Shirt
              width: 1600
              height: 1600
            options:
              - id: 123
                name: Title
                position: 1
                values:
                  - Default Title
            variants:
              - variant_id: 48328566276415
                title: Default Title
                display_name: Classic Cotton T-Shirt - Default Title
                price: '1025.00'
                compare_at_price: null
                sku: ''
                position: 1
                is_in_stock: true
                available_for_sale: true
                sellable_online_quantity: 50
                selected_options:
                  - name: Title
                    value: Default Title
            metafields: []
            trending_rank: 3
            sales_rank: 7
    AutomaticRecommendationsError:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
                description: Human readable error message
              path:
                type: array
                items:
                  type: string
                description: Path to the field that caused the error
              type:
                type: string
                description: Type of validation error
              context:
                type: object
                properties:
                  limit:
                    type: number
                    description: Maximum allowed value
                  value:
                    type: number
                    description: Actual value provided
                  label:
                    type: string
                    description: Field label
                  key:
                    type: string
                    description: Field key
    HeadlessRecommendedProduct:
      type: object
      properties:
        product_id:
          type: integer
          description: Shopify product ID
        title:
          type: string
          description: Product title (only when view = product_details)
        handle:
          type: string
          description: Product URL handle (only when view = product_details)
        price:
          type: number
          description: Product price (only when view = product_details)
        compare_at_price:
          type: number
          nullable: true
          description: Original price before discount (only when view = product_details)
        image:
          type: object
          description: Product featured image (only when view = product_details)
          properties:
            id:
              type: string
            url:
              type: string
            altText:
              type: string
              nullable: true
            width:
              type: integer
            height:
              type: integer
        tags:
          type: string
          description: Comma-separated product tags (only when view = product_details)
        options:
          type: array
          description: Product options (only when view = product_details)
          items:
            type: object
            properties:
              id:
                type: integer
              name:
                type: string
              position:
                type: integer
              values:
                type: array
                items:
                  type: string
        variants:
          type: array
          description: Product variants (only when view = product_details)
          items:
            type: object
            properties:
              variant_id:
                type: integer
                description: Shopify variant ID
              title:
                type: string
              display_name:
                type: string
              price:
                type: string
                description: Price as string with decimals
              compare_at_price:
                type: string
                nullable: true
              sku:
                type: string
              position:
                type: integer
              is_in_stock:
                type: boolean
              available_for_sale:
                type: boolean
              sellable_online_quantity:
                type: integer
              selected_options:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    value:
                      type: string
              image:
                type: object
                nullable: true
                description: Variant image, when the variant has its own
                properties:
                  id:
                    type: string
                  url:
                    type: string
                  altText:
                    type: string
                    nullable: true
                  width:
                    type: integer
                  height:
                    type: integer
        metafields:
          type: array
          description: Product metafields (only when view = product_details)
          items:
            type: object
        product_type:
          type: string
          description: Product type (only when view = product_details)
        vendor:
          type: string
          description: Product vendor (only when view = product_details)
        trending_rank:
          type: integer
          nullable: true
          minimum: 1
          description: >-
            Position among the shop's products by trending score: units sold and
            revenue over the last 30 days, weighted toward recent days and
            adjusted for week-over-week growth — the same score that orders
            trending recommendations. 1 is the top trending product. `null` when
            the product had no sales in the last 30 days. Refreshed daily.
            Shop-wide: `publication_ids` filters which products are returned but
            does not change ranks (recommendations).
        sales_rank:
          type: integer
          nullable: true
          minimum: 1
          description: >-
            Position among the shop's products by revenue over the last 30 days;
            ties go to the product with more units sold. 1 is the top seller.
            `null` when the product had no sales in the last 30 days. Refreshed
            daily. Shop-wide: `publication_ids` filters which products are
            returned but does not change ranks (recommendations).
      description: >-
        A recommended product. With `view: product_ids` only `product_id` is
        present.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.