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

# Get User Grievances

> Get all grievances for a specific user with pagination support

Retrieves all grievances associated with a specific user, with support for pagination. This endpoint allows you to fetch either all grievances for a user or paginate through them using the query parameters.

## Pagination

The endpoint supports the following query parameters for pagination:

* `fetch_all` (boolean): When set to `true`, returns all grievances for the user without pagination. Default is `false`.
* `page` (integer): The page number to retrieve. Default is 1.
* `size` (integer): Number of grievances per page. Default is 10, maximum is 100.

## Response

The response includes:

* `status`: Operation status
* `total`: Total number of grievances for the user
* `page`: Current page number
* `size`: Number of items per page
* `grievances`: Array of grievance objects with complete details

If the user is not found, a 404 error is returned.


## OpenAPI

````yaml GET /grievances/user/{user_id}
openapi: 3.1.0
info:
  title: CPGRAMS Simulation API
  description: >-
    An API that simulates the Centralized Public Grievance Redress and
    Monitoring System (CPGRAMS) in India
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://grm-api.vercel.app
security:
  - bearerAuth: []
externalDocs:
  description: API Documentation
  url: https://grm-api.vercel.app/docs
paths:
  /grievances/user/{user_id}:
    get:
      description: Get all grievances for a specific user with pagination support
      parameters:
        - name: user_id
          in: path
          description: ID of the user whose grievances to fetch
          required: true
          schema:
            type: string
        - name: fetch_all
          in: query
          description: Whether to fetch all grievances or paginate
          required: false
          schema:
            type: boolean
            default: false
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
        - name: size
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 100
      responses:
        '200':
          description: List of user grievances
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserGrievancesResponse'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    UserGrievancesResponse:
      type: object
      properties:
        status:
          type: string
          description: Status of the operation
        total:
          type: integer
          description: Total number of grievances for this user
        page:
          type: integer
          description: Current page number
        size:
          type: integer
          description: Number of items per page
        grievances:
          type: array
          items:
            $ref: '#/components/schemas/Grievance'
          description: List of grievances for the user
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    Grievance:
      allOf:
        - $ref: '#/components/schemas/GrievanceBase'
        - type: object
          required:
            - id
            - user_id
            - status
            - created_at
          properties:
            id:
              description: Unique identifier for the grievance
              type: string
            user_id:
              description: ID of the user who submitted the grievance
              type: string
            status:
              description: Current status of the grievance
              type: string
              enum:
                - Active
                - Pending
                - Closed with resolution
                - Closed without resolution
                - Tender Issued
              default: Pending
            created_at:
              description: Timestamp when the grievance was created
              type: string
              format: date-time
            updated_at:
              description: Timestamp when the grievance was last updated
              type: string
              format: date-time
            resolution_notes:
              description: Notes on the resolution of the grievance
              type: string
            grievance_received_date:
              description: Date when the grievance was received
              type: string
              format: date-time
            grievance_closing_date:
              description: Date when the grievance was closed
              type: string
              format: date-time
            organisation_closing_date:
              description: Date when the organisation closed the grievance
              type: string
              format: date-time
            org_status_date:
              description: Date of the last status update by the organisation
              type: string
              format: date-time
            reported_as_covid19_case_date:
              description: Date when the grievance was reported as a COVID-19 case
              type: string
              format: date-time
            covid19_category:
              description: COVID-19 related category if applicable
              type: string
            reformed_flag:
              description: Flag indicating if the grievance is part of reformed process
              type: boolean
              default: false
            reformed_top_level_category:
              description: Top level category in the reformed classification
              type: string
            reformed_last_level_category:
              description: Last level category in the reformed classification
              type: string
            forwarded_to_subordinate:
              description: Flag indicating if the grievance was forwarded to a subordinate
              type: boolean
              default: false
            forwarded_to_subordinate_details:
              description: Details about forwarding to subordinate
              type: string
            rating:
              description: User rating of the grievance resolution
              type: integer
            feedback:
              description: User feedback on the grievance resolution
              type: string
            satisfaction_level:
              description: User satisfaction level with the resolution
              type: string
            final_reply:
              description: Final reply to the grievance
              type: string
            appeal_no:
              description: Appeal number if the grievance was appealed
              type: string
            appeal_date:
              description: Date when the appeal was filed
              type: string
              format: date-time
            appeal_reason:
              description: Reason for the appeal
              type: string
            appeal_closing_date:
              description: Date when the appeal was closed
              type: string
              format: date-time
            appeal_closing_remarks:
              description: Remarks on the closing of the appeal
              type: string
            organisation_grievance_receive_date:
              description: Date when the organisation received the grievance
              type: string
              format: date-time
            organisation_grievance_close_date:
              description: Date when the organisation closed the grievance
              type: string
              format: date-time
            officers_forwarding_grievance:
              description: Officers who forwarded the grievance
              type: string
            date_of_receiving:
              description: Date when the grievance was received
              type: string
              format: date-time
            officer_closed_by:
              description: Officer who closed the grievance
              type: string
            final_status:
              description: Final status of the grievance
              type: string
            classified_category:
              description: Classified category of the grievance
              type: string
            formatted_fields:
              description: Formatted fields for the grievance
              type: string
            follow_up_questions:
              description: Follow-up questions for the grievance
              type: array
              items:
                type: string
            missing_information:
              description: Flag indicating if there is missing information
              type: boolean
            is_correct_category:
              description: Flag indicating if the category is correct
              type: boolean
            category_data:
              description: Additional category data
              type: object
    GrievanceBase:
      required:
        - title
        - category
        - description
      type: object
      properties:
        title:
          description: Title of the grievance
          type: string
        category:
          description: Category of the grievance
          type: string
        description:
          description: Detailed description of the grievance
          type: string
        priority:
          description: 'Priority level: low, medium, high, critical'
          type: string
          default: medium
        cpgrams_category:
          description: CPGRAMS category of the grievance
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````