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

# Notify Certificate Code

> Report a certificate code as sent to a recipient or activated by them.

Called by the external agent that distributes codes:

>>> POST /certificate-codes/HAIQU2026HAVEFUN00/notify
>>> {"status": "sent", "user_email": "participant@example.com"}

Repeating a notification is not an error — the first ``sent_at`` /
``activated_at`` timestamp is kept, and only the recipient is refreshed.

``activated`` requires a ``user_email`` that belongs to an existing Haiqu
user; the code is linked to that user. ``sent`` accepts any recipient,
including none.

Args:
    code (str): The certificate code (case-insensitive).
    notification (CertificateCodeNotifyModel): Reported status and the email the
        code was sent to / activated by (required for ``activated``).

Returns:
    CertificateCodeModel: The updated code.

Raises:
    HTTPException: Raised with ``404`` when the code does not exist or when
        ``activated`` names an email with no Haiqu user, or with ``409`` when
        the reported status would undo a later one.



## OpenAPI

````yaml https://api.haiqu.ai/openapi.json post /certificate-codes/{code}/notify
openapi: 3.1.0
info:
  title: Haiqu API
  summary: Haiqu RESTful API service.
  description: Cloud service providing the access to Haiqu cloud runtime
  contact:
    name: Haiqu Inc.
    url: https://haiqu.ai/
    email: info@haiqu.ai
  version: 1.5.0
servers: []
security: []
paths:
  /certificate-codes/{code}/notify:
    post:
      summary: Notify Certificate Code
      description: >-
        Report a certificate code as sent to a recipient or activated by them.


        Called by the external agent that distributes codes:


        >>> POST /certificate-codes/HAIQU2026HAVEFUN00/notify

        >>> {"status": "sent", "user_email": "participant@example.com"}


        Repeating a notification is not an error — the first ``sent_at`` /

        ``activated_at`` timestamp is kept, and only the recipient is refreshed.


        ``activated`` requires a ``user_email`` that belongs to an existing
        Haiqu

        user; the code is linked to that user. ``sent`` accepts any recipient,

        including none.


        Args:
            code (str): The certificate code (case-insensitive).
            notification (CertificateCodeNotifyModel): Reported status and the email the
                code was sent to / activated by (required for ``activated``).

        Returns:
            CertificateCodeModel: The updated code.

        Raises:
            HTTPException: Raised with ``404`` when the code does not exist or when
                ``activated`` names an email with no Haiqu user, or with ``409`` when
                the reported status would undo a later one.
      operationId: notify_certificate_code_certificate_codes__code__notify_post
      parameters:
        - name: code
          in: path
          required: true
          schema:
            type: string
            title: Code
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CertificateCodeNotifyModel'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CertificateCodeModel'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyQuery: []
        - APIKeyHeader: []
components:
  schemas:
    CertificateCodeNotifyModel:
      properties:
        status:
          $ref: '#/components/schemas/CertificateCodeStatus'
        user_email:
          anyOf:
            - type: string
            - type: 'null'
          title: User Email
      type: object
      required:
        - status
      title: CertificateCodeNotifyModel
      description: |-
        Data model used by an external agent to report a certificate code as
        sent to a recipient or activated by them.
    CertificateCodeModel:
      properties:
        code:
          type: string
          title: Code
        credits:
          type: integer
          title: Credits
        status:
          $ref: '#/components/schemas/CertificateCodeStatus'
        sent_to:
          anyOf:
            - type: string
            - type: 'null'
          title: Sent To
        user_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: User Id
        created_at:
          type: string
          format: date-time
          title: Created At
        sent_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Sent At
        activated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Activated At
      type: object
      required:
        - code
        - credits
        - status
        - sent_to
        - user_id
        - created_at
        - sent_at
        - activated_at
      title: CertificateCodeModel
      description: The Pydantic model for a certificate code stored in the DB.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CertificateCodeStatus:
      type: string
      enum:
        - created
        - sent
        - activated
      title: CertificateCodeStatus
      description: Lifecycle of a certificate (invitation) code.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyQuery:
      type: apiKey
      in: query
      name: HAIQU_API_KEY
    APIKeyHeader:
      type: apiKey
      in: header
      name: authorization

````