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

# Verify user's email and complete user registration.

> Confirms the user's email address and finalizes the the account creation process.

Upon successful verification:
- If `organization` was provided during signup, the new organization will be created and the user will become its owner.
- If `invitationKey` was provided during signup, the user joins the invited organization.




## OpenAPI

````yaml /api-spec/ias-public-api.yaml post /users/email-verification
openapi: 3.0.3
info:
  title: IAM Service API
  description: APIs for IAM Service.
  version: 2.4.0
servers:
  - url: https://console.gmicloud.ai/api/v1
    description: IAM Service API
security: []
paths:
  /users/email-verification:
    post:
      tags:
        - users
      summary: Verify user's email and complete user registration.
      description: >
        Confirms the user's email address and finalizes the the account creation
        process.


        Upon successful verification:

        - If `organization` was provided during signup, the new organization
        will be created and the user will become its owner.

        - If `invitationKey` was provided during signup, the user joins the
        invited organization.
      operationId: emailVerification
      requestBody:
        description: The request body for email verification
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/emailVerificationRequest'
      responses:
        '201':
          description: User email successfully verified and user account is created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/emailVerificationResponse'
        '400':
          description: >
            - [group:**request**, code:**0**]: Invalid field in the request
            body.

            - [group:**request**, code:**1**]: The request body is required.

            - [group:**user**, code:**408**]: Invalid otpCode.

            - [group:**user**, code:**409**]: Expired otpCode.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrStatusMsg'
              examples:
                Invalid field in the request body:
                  summary: Invalid field in the request body.
                  value:
                    group: request
                    code: 0
                    validationDetail:
                      - field: email
                        expression: required
                        originalValue: ''
                        reason: This field is required.
        '401':
          description: |
            - [group:**user**, code:**406**]: Invalid email verification token.
            - [group:**user**, code:**407**]: Expired email verification token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrStatusMsg'
              examples:
                Invalid email verification token:
                  summary: Invalid email verification token.
                  value:
                    group: user
                    code: 406
                    message: Invalid email verification token.
        '404':
          description: |
            - [group:**organization**, code:**2**]: Organization does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrStatusMsg'
              examples:
                Organization does not exist:
                  summary: Organization does not exist.
                  value:
                    group: organization
                    code: 2
                    message: Organization does not exist.
        '500':
          description: >
            - [group:**invitation**, code:**201**]: Get invitation encountered
            error.

            - [group:**organization**, code:**1000**]: Create organization
            encountered DB error.

            - [group:**organization**, code:**1001**]: Create organization
            grouping policy encountered error.

            - [group:**organization**, code:**1201**]: Get organization
            encountered DB error.

            - [group:**session**, code:**200**]: Failed to create auth token.

            - [group:**session**, code:**201**]: Failed to save auth token data.

            - [group:**user**, code:**401**]: Get user email verification data
            encountered error.

            - [group:**user**, code:**403**]: Save user email verification data
            encountered error.

            - [group:**user**, code:**1000**]: Create user encountered DB error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrStatusMsg'
              examples:
                Get user email verification data encountered error:
                  summary: Get user email verification data encountered error.
                  value:
                    group: user
                    code: 401
                    message: Get user email verification data encountered error.
                    traces:
                      - error occurred.
      security:
        - bearerEmailVerificationToken: []
components:
  schemas:
    emailVerificationRequest:
      type: object
      x-go-name: emailVerificationRequest
      properties:
        otpCode:
          type: string
          description: >
            A one-time passcode (OTP) provided by the user for email
            verification.

            - Must be a numeric code.
          example: 321673
          x-oapi-codegen-extra-tags:
            binding: required,numeric
          x-go-type-skip-optional-pointer: true
      required:
        - otpCode
    emailVerificationResponse:
      type: object
      x-go-name: emailVerificationResponse
      properties:
        id:
          type: string
          format: uuid
          x-go-type: uuid.UUID
          description: The user's ID.
          example: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
        authToken:
          type: string
          description: >-
            A temporary token issued after the signup step. This token is used
            in the create session API to exchange for access and refresh tokens.
          example: eyJhbGciOiJIUzI1NiIsInR...
      required:
        - id
        - authToken
    ErrStatusMsg:
      type: object
      properties:
        group:
          type: string
          description: >-
            API function group\n -Will be "request" if there are invalid request
            parameters.
          x-oapi-codegen-extra-tags:
            binding: required
        code:
          type: integer
          description: The substatus error code for the API response.
          x-oapi-codegen-extra-tags:
            binding: required
        message:
          type: string
          description: The substatus error Message for API response.
          x-go-type-skip-optional-pointer: true
        traces:
          type: array
          items:
            type: string
          description: The original error messages.
          x-go-type-skip-optional-pointer: true
        validationDetail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationDetail'
          description: >-
            Returned when there are invalid request
            paremeters(group="request")\n List of invalid fields and the reason
            of error.
          x-go-type-skip-optional-pointer: true
      example:
        group: request
        code: 0
        validationDetail:
          - field: email
            expression: required
            originalValue: ''
            reason: This field is required.
      required:
        - group
        - code
    ValidationDetail:
      type: object
      properties:
        field:
          type: string
          description: The field of the request data.
          x-go-type-skip-optional-pointer: true
        expression:
          type: string
          description: The form of violation.
          x-go-type-skip-optional-pointer: true
        argument:
          type: string
          description: The number or data to support the expression.
          x-go-type-skip-optional-pointer: true
        originalValue:
          description: The original value from the request.
          x-go-type-skip-optional-pointer: true
        reason:
          type: string
          description: The reason for the validation error.
          x-go-type-skip-optional-pointer: true
      example:
        - field: fieldXXX
          expression: required
          originalValue: ''
          reason: This field is required.
  securitySchemes:
    bearerEmailVerificationToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        A token used to verify the validity of an email address.

        It must be included in the Authorization header when verifying the email
        address.

````