> ## 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.

# Get consent

> Get consent by ID



## OpenAPI

````yaml get /consents/{id}
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/{id}:
    get:
      tags:
        - Consents
      summary: Get consent
      description: Get consent by ID
      operationId: getConsent
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: Consent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Consent'
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    id:
      name: id
      in: path
      description: ID of the resource
      required: true
      schema:
        type: string
  schemas:
    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
    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

````