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

# Create or update the user engagement status on any challenge's action

> An engagement refers to the active participation of a user in a given challenge.

This API allows to create and update the list of engaged or already done actions.

Updating an action engagement doesn't change the engagement date.




## OpenAPI

````yaml /api-reference/green-actions.yaml put /sites/{site-id}/challenges/{challenge-id}/engagement
openapi: 3.0.1
info:
  title: Challenges lifecycle
  description: >
    This API manages the lifecycles of the challenges, the actions and the user
    engagements.
  termsOfService: ''
  version: 1.0.x
servers:
  - url: https://api.home.datanumia.com/api/v1
security: []
paths:
  /sites/{site-id}/challenges/{challenge-id}/engagement:
    put:
      tags:
        - Challenge's engagement
      summary: Create or update the user engagement status on any challenge's action
      description: >
        An engagement refers to the active participation of a user in a given
        challenge.


        This API allows to create and update the list of engaged or already done
        actions.


        Updating an action engagement doesn't change the engagement date.
      operationId: putEngagement
      parameters:
        - name: site-id
          in: path
          description: The site identifier
          required: true
          schema:
            type: string
        - name: challenge-id
          in: path
          description: The challenge identifier
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PutEngagementRequest'
        required: true
      responses:
        '204':
          description: OK, No Content
          content: {}
        '400':
          description: Functional Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
        '500':
          description: Technical Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
components:
  schemas:
    PutEngagementRequest:
      type: object
      properties:
        status:
          type: string
          description: The engagement status
          example: ENGAGED
          enum:
            - ENGAGED
            - REMOVED_CONSENT
            - MANUALLY_DISENGAGED
        disengagementDate:
          type: string
          description: The disengagement date, format YYYY-MM-DD
          example: '2023-12-31'
        actions:
          minItems: 0
          type: array
          items:
            $ref: '#/components/schemas/ActionEngagement'
        beginDate:
          type: string
          description: The engagement begin date, format YYYY-MM-DD
          example: '2024-01-01'
          nullable: true
        endDate:
          type: string
          description: The engagement end date, format YYYY-MM-DD
          example: '2024-01-01'
          nullable: true
    ProblemDetail:
      required:
        - type
        - status
      properties:
        type:
          type: object
        title:
          type: string
          description: The problem title
        status:
          type: integer
          description: The problem status
        detail:
          type: string
          description: The problem detail
        instance:
          type: object
          description: The problem instance. By default, the request path
        properties:
          type: object
          description: A generic map of properties
      description: Representation for an RFC 7807 problem detail
    ActionEngagement:
      required:
        - actionId
        - status
      type: object
      properties:
        actionId:
          type: string
          description: The action identifier
          example: HEATING_DROP_2C
        status:
          type: string
          description: The action status
          enum:
            - ALREADY_DONE
            - ENGAGED
      description: The challenge's actions

````