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

# Record contact consent

> Requires contacts:write, a current administrator and the Customer CDP plan feature. Evidence is bound to the contact's current email or phone address. expected_version prevents overwriting newer evidence; a WhatsApp marketing revocation also updates the durable broadcast suppression.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v2/accounts/{accountId}/contacts/{contactId}/consent
openapi: 3.0.3
info:
  contact:
    name: HueChat support
    email: support@huechat.ai
    url: https://huechat.ai/contact
  description: >-
    Account-scoped REST API for HueChat: conversations, messages, contacts,
    Customer CDP, Sales CRM, forms, appointments, inboxes, teams, agents, AI
    agents and knowledge, WhatsApp templates and broadcasts, workflows and chat
    menus. Authenticate with account-scoped API keys; every route is scoped to
    your own account.
  license:
    name: Proprietary
    url: https://huechat.ai/terms
  termsOfService: https://huechat.ai/terms
  title: HueChat API
  version: 2.0.0
servers:
  - url: https://app.huechat.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Agents
    description: The human agents on your account and their availability.
  - name: AI Agents
    description: >-
      Assistants you build to answer customers on their own: persona, language,
      guardrails, tools and a knowledge base, published to inboxes, replying in
      Arabic or English until they hand off to a human. Create, publish, test,
      monitor quality and roll back versions.
  - name: Broadcasts
    description: >-
      Send a WhatsApp template to a list of contacts from a CSV or saved
      audience, with scheduling, pause and resume, and delivery reports.
  - name: Chat Menus
    description: >-
      Numbered or button-driven menus a customer sees at the start of a
      conversation.
  - name: Conversations
    description: >-
      A conversation is one thread between a contact and your team on one
      channel, with status, assignee, team, labels, priority and custom
      attributes. List, filter, search, assign, resolve and annotate them.
  - name: Forms
    description: >-
      Form management, assets, delivery, respondent sessions, submissions,
      scheduling, reports and AI-assisted authoring in one group.
  - name: Inboxes
    description: >-
      Connected channels: a WhatsApp Business number, an Instagram or Messenger
      page, an email address or a website live-chat widget. Inboxes decide where
      a conversation comes from and who can see it.
  - name: Knowledge
    description: >-
      Documents, web pages and text that ground an AI agent's answers. Upload,
      point at a URL or paste text; HueChat indexes it and the agent cites it.
  - name: Messages
    description: >-
      Everything said inside a conversation: text, attachments, WhatsApp
      templates and interactive replies. Sending through the API delivers on the
      conversation's channel and shows in the inbox like any agent reply.
  - name: Sales CRM
    description: >-
      Deals, leads, companies, quotes, products, price books, tasks, pipelines
      and Sales reporting.
  - name: Teams
    description: Groups of agents used for assignment and reporting.
  - name: Templates
    description: >-
      Pre-approved WhatsApp message formats required by Meta for
      business-initiated messages. Create, sync from Meta, AI-generate,
      test-send and read analytics.
  - name: Workflows
    description: >-
      Automation flows built from triggers and steps: route, tag, reply, wait,
      hand off. Create, publish, version and toggle.
  - name: Customer CDP
    description: >-
      Contacts, unified customer profiles, audiences, preferences, membership
      and journeys.
paths:
  /api/v2/accounts/{accountId}/contacts/{contactId}/consent:
    post:
      tags:
        - Customer CDP
      summary: Record contact consent
      description: >-
        Requires contacts:write, a current administrator and the Customer CDP
        plan feature. Evidence is bound to the contact's current email or phone
        address. expected_version prevents overwriting newer evidence; a
        WhatsApp marketing revocation also updates the durable broadcast
        suppression.
      parameters:
        - description: HueChat account ID
          name: accountId
          in: path
          required: true
          schema:
            type: integer
        - description: Contact ID
          name: contactId
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/huechat.CDPConsentAPIRequest'
        description: Consent evidence
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
        '429':
          description: Too Many Requests
          headers:
            Retry-After:
              description: 60 seconds before retrying after the API key quota is exceeded
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
      security:
        - bearerAuth: []
components:
  schemas:
    huechat.CDPConsentAPIRequest:
      type: object
      properties:
        channel:
          type: string
          enum:
            - whatsapp
            - email
          example: whatsapp
        evidence:
          type: string
          example: Consent recorded in CRM form 8842
        expected_version:
          type: integer
          example: 0
        purpose:
          type: string
          enum:
            - marketing
            - service
          example: marketing
        status:
          type: string
          enum:
            - granted
            - revoked
            - unknown
          example: granted
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your personal access token where supported, or a scoped API key (`hc_…`)
        created inside HueChat at Account → Developer API. Send it as
        `Authorization: Bearer <token>`.

````