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

    ## Request bodies

    Resource endpoints expect the resource wrapped under its own key, e.g.
    `{"category": {"name": "Analytics"}}` rather than a bare object.
    `PUT /password` wraps in `user`. Two endpoints take their body unwrapped:
    `POST /auth`, which takes `email` and `password` at the top level, and
    `POST /consent-banners/from-template`, which takes `jurisdiction_id` —
    a selector for which template to build from, not an attribute of the
    banner it creates.

    ## Response envelopes

    Listing endpoints — including `GET /groups` and `GET /accounts` — return
    `{"pagination": {...}, "data": [...]}`. `GET /banner-templates` is the
    exception: it returns `{"data": [...]}` with no pagination, being a fixed
    catalogue rather than a collection of the account's records.
    Most single-resource endpoints
    return `{"data": {...}}`; a single group or account is returned unwrapped.
    Resource-deletion endpoints return `{"message": "..."}`; `DELETE /auth`
    returns an empty object.
  version: 1.2.0
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/ConsentResponse'
        '401':
          $ref: '#/components/responses/AccountTokenRequired'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    id:
      name: id
      in: path
      description: ID of the resource
      required: true
      schema:
        type: string
  schemas:
    ConsentResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Consent'
    Consent:
      type: object
      description: |
        A consent record, written when a visitor interacts with the consent
        banner.
      properties:
        id:
          type: string
          description: Unique identifier for the consent
        consent_banner_id:
          type:
            - string
            - 'null'
          description: ID of the consent banner the visitor saw
        uuid:
          type: string
          description: Anonymous visitor identifier generated by the widget
        url:
          type: string
          description: URL the consent was given on
        ip_address:
          type:
            - string
            - 'null'
          description: Partially masked IP address of the visitor
        ip_country:
          type:
            - string
            - 'null'
          description: Two-letter country code resolved from the visitor's IP
        ip_region:
          type:
            - string
            - 'null'
          description: Region resolved from the visitor's IP
        visitor_user_id:
          type:
            - string
            - 'null'
          description: ID of the user set by your website
        accept_type:
          type:
            - string
            - 'null'
          description: |
            How the visitor responded. Typically `all`, `custom` or `necessary`.
        accepted_categories:
          type:
            - array
            - 'null'
          items:
            type: string
          description: Slugs of the categories the visitor accepted
        rejected_categories:
          type:
            - array
            - 'null'
          items:
            type: string
          description: Slugs of the categories the visitor rejected
        accepted_services:
          type:
            - object
            - 'null'
          additionalProperties:
            type: array
            items:
              type: string
          description: Accepted services, keyed by category slug
        rejected_services:
          type:
            - object
            - 'null'
          additionalProperties:
            type: array
            items:
              type: string
          description: Rejected services, keyed by category slug
        accepted_cookies:
          type:
            - array
            - 'null'
          items:
            type: object
          description: Storage items the visitor accepted
        rejected_cookies:
          type:
            - array
            - 'null'
          items:
            type: object
          description: Storage items the visitor rejected
        device:
          type: string
          description: Device type derived from the user agent
        user_agent:
          type: string
          description: User agent of the visitor's browser
        gpc_preference:
          type:
            - boolean
            - 'null'
          description: Whether the visitor sent a Global Privacy Control signal
        do_not_sell:
          type: boolean
          description: Whether the visitor opted out of the sale of their data
        created_at:
          type: string
          format: date-time
          description: Date and time when the consent was recorded
      example:
        id: consent321
        consent_banner_id: banner123
        uuid: 8f14e45f-ea8f-4f2e-b1b0-0f1d2c3b4a59
        url: https://example.com/pricing
        ip_address: 203.0.113.XXX
        ip_country: GB
        ip_region: England
        visitor_user_id: user456
        accept_type: custom
        accepted_categories:
          - essential
          - analytics
        rejected_categories:
          - marketing
        accepted_services:
          analytics:
            - Google Analytics
        rejected_services:
          marketing:
            - Meta Pixel
        accepted_cookies: []
        rejected_cookies: []
        device: desktop
        user_agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)
        gpc_preference: false
        do_not_sell: false
        created_at: '2023-01-20T12:46:30Z'
    Error:
      type: object
      description: |
        The standard error envelope, used for authentication, authorization,
        pagination and not-found errors.
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: integer
              message:
                type: string
      example:
        errors:
          - code: 401
            message: Invalid API Key
  responses:
    AccountTokenRequired:
      description: |
        Missing or invalid API token, or a token that does not resolve to an
        account. Account-scoped endpoints accept an account token, or a user
        token whose user belongs to an account; partner tokens are rejected.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            errors:
              - code: 401
                message: API key must belong to an account
    NotFound:
      description: The record does not exist, or does not belong to the caller
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            errors:
              - code: 404
                message: Record not found
    RateLimited:
      description: |
        Too many requests. The general limit is 300 requests per 5 minutes per
        API token; the auth endpoints are throttled more tightly per IP.
      headers:
        Retry-After:
          description: Seconds until the current rate-limit window resets
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            errors:
              - code: 429
                message: Too many requests. Please retry later.
  securitySchemes:
    authorization:
      type: http
      scheme: bearer
      description: API token obtained from the login endpoint or the dashboard

````