> ## 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 API Key and retrieve the key details

> Validate the API key from the Authorization Bearer token and return the key details.



## OpenAPI

````yaml /api-spec/ias-public-api.yaml get /me/api-keys/current
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:
  /me/api-keys/current:
    get:
      tags:
        - me
      summary: Verify API Key and retrieve the key details
      description: >-
        Validate the API key from the Authorization Bearer token and return the
        key details.
      operationId: verifyApiKey
      responses:
        '200':
          description: Successfully verified the API key and retrieved the key details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/verifyAPIKeyResponse'
        '401':
          description: |
            - [group:**api-key**, code:**200**]: Invalid API key.
            - [group:**api-key**, code:**201**]: Expired API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrStatusMsg'
              examples:
                Invalid API key:
                  summary: Invalid API key.
                  value:
                    group: api-key
                    code: 200
                    message: Invalid API key.
        '500':
          description: >
            - [group:**api-key**, code:**1201**]: Get API key encountered DB
            error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrStatusMsg'
              examples:
                Get API key encountered DB error:
                  summary: Get API key encountered DB error.
                  value:
                    group: api-key
                    code: 1201
                    message: Get API key encountered DB error.
                    traces:
                      - DB error occurred.
      security:
        - bearerAPIKey: []
components:
  schemas:
    verifyAPIKeyResponse:
      type: object
      x-go-name: verifyAPIKeyResponse
      properties:
        key:
          $ref: '#/components/schemas/apiKeyInfo'
          type: object
        organization:
          $ref: '#/components/schemas/apiKeyOrgInfo'
          type: object
      required:
        - key
        - organization
    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
    apiKeyInfo:
      type: object
      description: Information about the API key.
      properties:
        id:
          type: string
          format: uuid
          x-go-type: uuid.UUID
          description: The unique identifier for the API key.
          example: 550e8400-e29b-41d4-a716-446655440000
        type:
          type: string
          deprecated: true
          x-go-type-skip-optional-pointer: true
          description: >
            The API key type. This field is deprecated and will be removed in a
            future version.

            Use the `scope` field instead to specify the API key's scope.
          enum:
            - ie_model
          x-go-type: ceCommonLibTypes.IasAPIKeyScope
          x-go-type-import:
            path: >-
              us-central1-go.pkg.dev/gmi-cloud-cicd/go-dev/ce-common-lib-go/pkg/types
            name: ceCommonLibTypes
          example: ie_model
        scope:
          type: string
          description: The API key scope.
          enum:
            - ie_model
            - ce_resource
          x-go-type: ceCommonLibTypes.IasAPIKeyScope
          x-go-type-import:
            path: >-
              us-central1-go.pkg.dev/gmi-cloud-cicd/go-dev/ce-common-lib-go/pkg/types
            name: ceCommonLibTypes
          example: ie_model
        owner:
          $ref: '#/components/schemas/apiKeyOwnerInfo'
          type: object
      required:
        - id
        - scope
        - owner
    apiKeyOrgInfo:
      type: object
      description: |
        The organization associated with the API key
      properties:
        id:
          type: string
          format: uuid
          x-go-type: uuid.UUID
          description: The organization ID.
          example: 066daf34-08e8-40fe-a384-4248bcff5842
      required:
        - id
    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.
    apiKeyOwnerInfo:
      type: object
      description: |
        Information about the user who owns this API key
      properties:
        id:
          type: string
          format: uuid
          x-go-type: uuid.UUID
          description: The user ID.
          example: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
      required:
        - id
  securitySchemes:
    bearerAPIKey:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        An API key used to authenticate a user and grant access to restricted
        models. It is issued by api-keys APIs.

````