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

# List consents

> List all consents



## OpenAPI

````yaml get /consents
openapi: 3.1.0
info:
  title: CookieChimp API
  description: API for CookieChimp.com
  version: 1.0.1
servers:
  - url: https://cookiechimp.com/api/v1
security:
  - authorization: []
paths:
  /consents:
    get:
      tags:
        - Consents
      summary: List consents
      description: List all consents
      operationId: listConsents
      parameters:
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/order'
        - name: session_id
          in: query
          description: ID of the session to filter by
          required: false
          schema:
            type: string
        - name: user_id
          in: query
          description: ID of the user to filter by
          required: false
          schema:
            type: string
      responses:
        '200':
          description: List of consents
          content:
            application/json:
              schema:
                type: object
                properties:
                  pagination:
                    $ref: '#/components/schemas/ConsentPagination'
                    type: object
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Consent'
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    limit:
      name: limit
      in: query
      description: Number of resources to return
      required: false
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 20
    offset:
      name: offset
      in: query
      description: Number of resources to skip
      required: false
      schema:
        type: integer
        minimum: 0
        default: 0
    sort:
      name: sort
      in: query
      description: Field to sort by
      required: false
      schema:
        type: string
    order:
      name: order
      in: query
      description: Sort order
      required: false
      schema:
        type: string
        enum:
          - asc
          - desc
  schemas:
    ConsentPagination:
      allOf:
        - $ref: '#/components/schemas/BasePagination'
      example:
        prev_url: /api/v1/consents?page=
        next_url: /api/v1/consents?page=2
        count: 4
        page: 1
        prev: null
        next: 2
    Consent:
      type: object
      allOf:
        - $ref: '#/components/schemas/ConsentWrite'
      properties:
        id:
          type: string
          description: Unique identifier for the consent
        session_id:
          type: string
          description: ID of the session
        created_at:
          type: string
          format: date-time
          description: Date and time when the consent was created
      example:
        id: consent321
        session_id: sess123
        user_id: user456
        user_preferences:
          accept_type: all
          accepted_categories:
            - cat1
            - cat2
          rejected_categories:
            - cat3
            - cat4
          accepted_services:
            company1:
              - cookie1
              - cookie2
          rejected_services: {}
        created_at: '2023-01-20T12:46:30Z'
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
      example:
        error:
          code: 400
          message: Invalid request
    BasePagination:
      type: object
      properties:
        prev_url:
          type: string
          description: Path to get previous page
        next_url:
          type: string
          description: Path to get next page
        count:
          type: integer
          description: Total number of pages
        page:
          type: integer
          description: Current page
        prev:
          type: integer
          description: Previous page number
        next:
          type: integer
          description: Next page number
    ConsentWrite:
      type: object
      properties:
        user_id:
          type: string
          description: ID of the user set by your website
        user_preferences:
          type: object
          properties:
            accept_type:
              type: string
              enum:
                - all
                - custom
                - necessary
            accepted_categories:
              type: array
              items:
                type: string
            rejected_categories:
              type: array
              items:
                type: string
            accepted_services:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
            rejected_services:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
      required:
        - user_preferences
  securitySchemes:
    authorization:
      type: http
      scheme: bearer
      description: API token obtained from the login endpoint or the dashboard

````