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

# Update the current marketing opt in or opt out for a profile. This will generate an activity.

> The current opt in or opt out status can be determined by looking at activities or using the GET request
on this endpoint.
If there is an activity of type "marketing_opt_in" and no "marketing_opt_out" after that, the profile
is opted in.




## OpenAPI

````yaml /openapi/chat-client.yaml post /profiles/{id}/marketing-opt-in
openapi: 3.0.3
info:
  version: 1.0.0
  title: HealviChat Client API
servers:
  - url: https://{tenant_domain}/third-party/v1
    variables:
      tenant_domain:
        default: your-tenant.onhealvi.com
        description: Your tenant domain
security:
  - bearerAuth: []
paths:
  /profiles/{id}/marketing-opt-in:
    post:
      tags:
        - profiles
      summary: >-
        Update the current marketing opt in or opt out for a profile. This will
        generate an activity.
      description: >
        The current opt in or opt out status can be determined by looking at
        activities or using the GET request

        on this endpoint.

        If there is an activity of type "marketing_opt_in" and no
        "marketing_opt_out" after that, the profile

        is opted in.
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                opt_in:
                  description: >
                    If a profile is not currently opted in and this field is
                    true, the profile will be opted in.

                    If a profile is already opted in and this field is true,
                    nothing will change.

                    Same applies to setting this field to false and therefore
                    opting out.
                  type: boolean
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Profile'
components:
  schemas:
    Profile:
      description: >
        Profile data of a customer. A profile can have many customers. A
        customer belongs to one profile.

        Can be used to connect a real person with multiple messengers (aka
        customers) to one profile.
      type: object
      properties:
        id:
          type: integer
        salutation:
          type: string
          enum:
            - formal_male
            - formal_female
            - informal
        name:
          type: string
          example: John Doe
        gender:
          type: string
          enum:
            - undisclosed
            - male
            - female
            - diverse
        blocked:
          type: boolean
          description: If a profile is blocked, receiving messages will be disabled.
        date_of_birth:
          type: string
          format: date
          nullable: true
          example: '1970-01-01'
        phone_number:
          description: Phone number in international format.
          type: string
          nullable: true
          example: '+4915224367929'
        email:
          type: string
          format: email
          nullable: true
        address:
          type: string
          nullable: true
        custom_1:
          description: >-
            One of five custom fields. Names of custom fields can be configured
            via settings.
          type: string
          nullable: true
        custom_2:
          type: string
          nullable: true
        custom_3:
          type: string
          nullable: true
        custom_4:
          type: string
          nullable: true
        custom_5:
          type: string
          nullable: true
        created_at:
          description: Datetime when profile was created.
          type: string
          format: date-time
          nullable: true
          example: '2023-01-01T12:00:00Z'
        updated_at:
          description: Datetime when profile was last updated.
          type: string
          format: date-time
          nullable: true
          example: '2023-01-01T12:00:00Z'
        customers:
          type: array
          items:
            $ref: '#/components/schemas/Customer'
    Customer:
      description: |
        Represents a customer using a messenger service.
        A person with a phone number registered on WhatsApp is a customer.
      type: object
      properties:
        id:
          type: integer
        channel:
          $ref: '#/components/schemas/Channel'
        display_id:
          type: string
          description: An unique identifier within a channel.
          example: 4915223567929
        canonical_id:
          type: string
          nullable: true
          description: >
            Additional ID that identifies the customer. Currently used for
            WhatsApp.

            In WhatsApp, the display_id is either the phone number or the
            username.

            The canonical_id is always the BSUID (see WhatsApp usernames
            documentation).

            For other channels, the canonical_id is not used.
          example: DE.abc123
        name:
          type: string
          description: Name received from channel.
          example: John Doe
        username:
          type: string
          nullable: true
          description: Self given username. See WhatsApp usernames.
          example: john_doe
        profile:
          $ref: '#/components/schemas/ProfileSummary'
        conversations:
          description: Not always included.
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
    Channel:
      description: Type of messenger service.
      type: string
      enum:
        - bridge
        - whatsapp
        - facebook
        - widget
    ProfileSummary:
      description: >
        Profile data of a customer, without the nested list of other customers
        on the same profile.

        Used when embedding a profile inside a customer, to avoid re-embedding
        the customer itself.
      type: object
      properties:
        id:
          type: integer
        salutation:
          type: string
          enum:
            - formal_male
            - formal_female
            - informal
        name:
          type: string
          example: John Doe
        gender:
          type: string
          enum:
            - undisclosed
            - male
            - female
            - diverse
        blocked:
          type: boolean
          description: If a profile is blocked, receiving messages will be disabled.
        date_of_birth:
          type: string
          format: date
          nullable: true
          example: '1970-01-01'
        phone_number:
          description: Phone number in international format.
          type: string
          nullable: true
          example: '+4915224367929'
        email:
          type: string
          format: email
          nullable: true
        address:
          type: string
          nullable: true
        custom_1:
          description: >-
            One of five custom fields. Names of custom fields can be configured
            via settings.
          type: string
          nullable: true
        custom_2:
          type: string
          nullable: true
        custom_3:
          type: string
          nullable: true
        custom_4:
          type: string
          nullable: true
        custom_5:
          type: string
          nullable: true
        created_at:
          description: Datetime when profile was created.
          type: string
          format: date-time
          nullable: true
          example: '2023-01-01T12:00:00Z'
        updated_at:
          description: Datetime when profile was last updated.
          type: string
          format: date-time
          nullable: true
          example: '2023-01-01T12:00:00Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````