# List Offers Groups

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v3/offers/grouped:
    get:
      summary: List Offers Groups
      deprecated: false
      description: >-
        Returns numbers of offers grouped by given attribute.


        ## Query Parameters


        | Parameter            | Type      | Default    |
        Description                                                                                                                     
        |

        |----------------------|-----------|------------|----------------------------------------------------------------------------------------------------------------------------------|

        | group_by             | enum      | null       | (required) Specifies
        attribute by which the offers should be grouped. See: [Grouping
        attributes](api-3511088-groups#grouping-attributes)
        |                                                                                                                                                                             
        |

        | scope                | enum      | `standard` | When present, only
        offers from given [scope](doc-341649#scoping) will be
        returned                                                                                                                     
        |

        | types                | string[]  | null       | When present, only
        offers of given [types](doc-341695#offers-types) will be
        returned                                                                                                              
        |

        | per_page             | integer   | 100        | Number of results to
        be returned per request (100 is the
        maximum)                                                                                                                                                                                       
        |

        | page_no              | integer   | 1          | Number of results
        page                                                                                                                                                                                                                                  
        |

        | sort_by              | string    | "name"     | What attribute should
        results be sorted by? Supported attributes are: `["name",
        "usable_since", "usable_until", "visible_since", "visible_until",
        "created_at", "updated_at",
        "archived_at"]`                                                           
        |

        | sort_direction       | string    | "asc"      | Direction of sorting:
        "asc" or
        "desc"                                                                                                                                                                                                                   
        |

        | collection_ids       | integer[] | null       | When present, only
        offers belonging to at least one of given collections will be
        returned                                                                                                                                                               
        |

        | store_ids            | integer[] | null       | When present, only
        offers belonging to at at least one of given store_id will be
        returned                                                                                                                                                               
        |

        | status               | enum      | null       | When present, only
        offers with this status will be returned. See:
        [statuses](doc-341695#offers-statuses)                                                                                          
        |

        | campaign_id          | integer   | null       | When present, only
        offers with this campaign_id will be
        returned                                                                                                                                                                                        
        |

        | audience_id          | integer   | null       | When present, only
        offers with this audience_id will be
        returned                                                                                                                                                                                        
        |

        | search               | string    | null       | When present, only
        offers that match the query string will be
        returned                                                                                                                                                                                  
        |

        | extras               | object    | null       | When present, only
        offers that match given values will be returned. See:
        below                                                                                                                                                                          
        |

        | ids                  | integer[] | null       | When present, only
        offers having one of provided IDs will be
        returned                                                                                                                                                                                   
        |

        | without_collection   | boolean   | false      | When present, only
        offers without collections will be
        returned                                                                                                                                                                                          
        |

        | without_audience_id  | boolean   | false      | When present, only
        offers without audiences will be
        returned                                                                                                                                                                                            
        |

        | without_campaign_id  | boolean   | false      | When present, only
        offers without campaigns will be
        returned                                                                                                                                                                                            
        |

        | without_store        | boolean   | false      | When present, only
        offers without store will be
        returned                                                                                                                                                                                                
        |

        | with_archived        | boolean   | false      | When present, also
        archived offers will be
        returned                                                                                                                                                                                                     
        |

        | only_archived        | boolean   | false      | When present, only
        archived offers will be
        returned                                                                                                                                                                                                     
        |

        | visible_since_after  | datetime  | null       | When present, only
        offers with greater visible_since will be
        returned                                                                                                                                                                                   
        |

        | visible_since_before | datetime  | null       | When present, only
        offers with lesser visible_since will be
        returned                                                                                                                                                                                    
        |

        | visible_until_after  | datetime  | null       | When present, only
        offers with greater visible_until will be
        returned                                                                                                                                                                                   
        |

        | visible_until_before | datetime  | null       | When present, only
        offers with lesser visible_until will be
        returned                                                                                                                                                                                    
        |

        | usable_since_after   | datetime  | null       | When present, only
        offers with greater usable_since will be
        returned                                                                                                                                                                                    
        |

        | usable_since_before  | datetime  | null       | When present, only
        offers with lesser usable_since will be
        returned                                                                                                                                                                                     
        |

        | usable_until_before  | datetime  | null       | When present, only
        offers with lesser usable_until will be
        returned                                                                                                                                                                                     
        |


        ### Grouping attributes


        | Attribute    | Description                                   |

        |--------------|-----------------------------------------------|

        | collection   | Groups by collection                          |

        | store_id     | Groups by store                               |

        | audience_id  | Groups by audience_id                         |

        | created_at   | Groups by creation day                        |

        | usable_since | Groups by date when offer starts to be usable |

        | campaign_id  | Groups by campaign_id                         |


        ## Response Body


        | Key                    | Type    |
        Description                                                            |

        |------------------------|---------|------------------------------------------------------------------------|

        | groups                 | object 
        |                                                                       
        |

        | groups[].name          | string  | Name of
        group                                                          |

        | groups[].offers_count  | integer | Number of offers within
        group                                          |

        | groups[].collection_id | integer | ID of collection (present only for
        'collection' as grouping attribute) |


        ## Example


        ```shell

        curl \

        "https://api.mpc.placewise.com/v3/infinity-mall/offers/grouped?group_by=collection"
        \
            -H 'content-type: application/json' \
            -H 'x-client-authorization: B7t9U9tsoWsGhrv2ouUoSqpM' \
            -H 'x-product-name: default' \
            -H 'x-user-agent: CURL manual test'
        ```


        When successful, returns numbers of offers grouped by collection.


        ```json

        {
          "groups": [
            {
              "name": "Birthday",
              "offers_count": 2,
              "collection_id": 1000396
            },
            {
              "name": "Great deals",
              "offers_count": 1,
              "collection_id": 1000664
            }
          ]
        }

        ```
      tags:
        - API Reference/Management API/Offers/Offers
      parameters:
        - name: Content-Type
          in: header
          description: '[Details](doc-341635)'
          required: true
          example: application/json
          schema:
            type: string
            default: application/json
            const: application/json
        - name: X-User-Agent
          in: header
          description: Arbitrary identifier of your client. [Details](doc-341635)
          required: true
          example: '{{X_USER_AGENT}}'
          schema:
            type: string
            default: '{{X_USER_AGENT}}'
        - name: X-Product-Name
          in: header
          description: API Product for API context. [Details](doc-341635)
          required: true
          example: '{{PRODUCT_NAME}}'
          schema:
            type: string
            default: '{{PRODUCT_NAME}}'
        - name: X-Loyalty-Club-Slug
          in: header
          description: LoyaltyClub for API context. [Details](doc-342138)
          required: false
          example: '{{LOYALTY_CLUB_SLUG}}'
          schema:
            type: string
            default: '{{LOYALTY_CLUB_SLUG}}'
        - name: X-Customer
          in: header
          description: Customer for API context.  [Details](doc-342139)
          required: false
          example: '{{CUSTOMER_ID}}'
          schema:
            type: string
            default: '{{CUSTOMER_ID}}'
        - name: Authorization
          in: header
          description: '[Member](doc-342129) or [User](doc-342130) Authorization.'
          required: false
          example: Bearer {{_OAUTH_TOKEN}}
          schema:
            type: string
            default: Bearer {{_OAUTH_TOKEN}}
        - name: X-Client-Authorization
          in: header
          description: '[Token](doc-342128) Authorization.'
          example: '{{API_TOKEN}}'
          schema:
            type: string
            default: '{{API_TOKEN}}'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
          headers: {}
          x-apidog-name: Success
      security: []
      x-apidog-folder: API Reference/Management API/Offers/Offers
      x-apidog-status: pending
      x-run-in-apidog: https://app.eu.apidog.com/web/project/346351/apis/api-3511089-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.mpc.dev.placewise.com
    description: Staging
security: []

```