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

# Verify merchant email

> Verify the email address of a merchant based on their verification token.

This endpoint allows merchants to verify their email addresses after account creation.
It is triggered when the merchant clicks on the verification link sent to their email.

Args:
    request (HttpRequest): The incoming HTTP request. The request must include a valid
        `token` as a query parameter.
    merchant_id (str): This parameter represents the merchant's unique identifier,
        also referred to as the "short_code" internally. Though renamed to `merchant_id`,
        the underlying functionality remains unchanged. It helps map merchants in the system.
    *args: Additional arguments.
    **kwargs: Additional keyword arguments.

Returns:
    Response (JSON): Returns a JSON response indicating success or failure of the email
    verification process.

    Success Response (HTTP 200):
    {
        "message": (
            "Email verified successfully. Please check your email for onboarding instructions. "
            "If you do not receive an email, please check your spam folder. If you still do not receive an email, "
            "please contact support with error code: ONBOARDING_MSG_NOT_RECEIVED."
        )
    }

    Failure Response (HTTP 400):
    {
        "error": "Invalid verification token"
    }

Key Details for Non-Technical Stakeholders:
- This API is part of the merchant onboarding process, ensuring that the merchant's
  email is verified before they can fully access the platform.
- The `merchant_id` in the URL is a placeholder that simplifies the naming convention
  for external users but internally still maps to the original "short_code".
- The email verification token must be provided by the merchant via the verification link.
- If the email is successfully verified, the merchant receives onboarding instructions via email.

Key Details for Developers:
- The `merchant_id` parameter is simply an alias for `short_code`, preserving
  backward compatibility with existing logic.
- The token is checked for validity, and if it has expired or is incorrect,
  the request is rejected with a 400 response.
- Upon successful verification, the merchant's status is updated to verified, and
  the onboarding email is sent. Errors during email dispatch are logged but do not block verification.
- Ensure the token expiration logic works properly to prevent expired tokens from being reused.



## OpenAPI

````yaml get /api/v1/merchants/{merchant_id}/verify/
openapi: 3.0.3
info:
  title: Superpool API
  version: 2.0.0
  description: >-
    Insurance infrastructure for Financial Institutions, Insurers, and
    Insurtechs
  contact:
    name: Unyte Africa LTD.
    url: https://ng.unyte.africa
    email: tech@unyte.com
servers: []
security: []
paths:
  /api/v1/merchants/{merchant_id}/verify/:
    get:
      tags:
        - Merchant
      summary: Verify merchant email
      description: >-
        Verify the email address of a merchant based on their verification
        token.


        This endpoint allows merchants to verify their email addresses after
        account creation.

        It is triggered when the merchant clicks on the verification link sent
        to their email.


        Args:
            request (HttpRequest): The incoming HTTP request. The request must include a valid
                `token` as a query parameter.
            merchant_id (str): This parameter represents the merchant's unique identifier,
                also referred to as the "short_code" internally. Though renamed to `merchant_id`,
                the underlying functionality remains unchanged. It helps map merchants in the system.
            *args: Additional arguments.
            **kwargs: Additional keyword arguments.

        Returns:
            Response (JSON): Returns a JSON response indicating success or failure of the email
            verification process.

            Success Response (HTTP 200):
            {
                "message": (
                    "Email verified successfully. Please check your email for onboarding instructions. "
                    "If you do not receive an email, please check your spam folder. If you still do not receive an email, "
                    "please contact support with error code: ONBOARDING_MSG_NOT_RECEIVED."
                )
            }

            Failure Response (HTTP 400):
            {
                "error": "Invalid verification token"
            }

        Key Details for Non-Technical Stakeholders:

        - This API is part of the merchant onboarding process, ensuring that the
        merchant's
          email is verified before they can fully access the platform.
        - The `merchant_id` in the URL is a placeholder that simplifies the
        naming convention
          for external users but internally still maps to the original "short_code".
        - The email verification token must be provided by the merchant via the
        verification link.

        - If the email is successfully verified, the merchant receives
        onboarding instructions via email.


        Key Details for Developers:

        - The `merchant_id` parameter is simply an alias for `short_code`,
        preserving
          backward compatibility with existing logic.
        - The token is checked for validity, and if it has expired or is
        incorrect,
          the request is rejected with a 400 response.
        - Upon successful verification, the merchant's status is updated to
        verified, and
          the onboarding email is sent. Errors during email dispatch are logged but do not block verification.
        - Ensure the token expiration logic works properly to prevent expired
        tokens from being reused.
      operationId: verify-merchant-email
      parameters:
        - in: path
          name: merchant_id
          schema:
            type: string
          required: true
        - in: query
          name: token
          schema:
            type: string
          description: The verification token sent to the merchant's email
      responses:
        '200':
          description: Merchant email successfully verified
        '400':
          description: Invalid verification token
      security:
        - ClientKeyAuth: []
components:
  securitySchemes:
    ClientKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````