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

# Inspect the current API key

> Return metadata about the API key currently being used: id, name, environment, scopes, IP allowlist, last-used timestamp and expiration. Useful for verifying key configuration without storing it client-side.



## OpenAPI

````yaml GET /v1/auth/self
openapi: 3.1.0
info:
  title: YuvexPay API
  description: >-
    The YuvexPay API allows you to accept payments, process withdrawals, manage
    products and customers programmatically. All API access is over HTTPS and
    uses JSON request/response bodies.
  version: 1.0.0
  contact:
    name: YuvexPay Support
    email: support@yuvexpay.com
    url: https://docs.yuvexpay.com
servers:
  - url: https://api.yuvexpay.com
    description: >-
      Same base URL serves both sandbox and production. Send a `ypk_test_*` key
      for sandbox or a `ypk_live_*` key for production.
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: Inspect the API key in use
  - name: Payments
    description: Create and manage payments
  - name: Withdrawals
    description: Create and manage withdrawals
  - name: Products
    description: Manage product catalog
  - name: Customers
    description: Manage customer records
  - name: Documents
    description: Generate receipts and statements
  - name: Balance
    description: Inspect the current account balance
paths:
  /v1/auth/self:
    get:
      tags:
        - Authentication
      summary: Inspect the current API key
      description: >-
        Return metadata about the API key currently being used: id, name,
        environment, scopes, IP allowlist, last-used timestamp and expiration.
        Useful for verifying key configuration without storing it client-side.
      operationId: getApiKeySelf
      responses:
        '200':
          description: API key metadata.
          content:
            application/json:
              schema:
                type: object
                properties:
                  apiKey:
                    $ref: '#/components/schemas/ApiKeySelf'
              example:
                apiKey:
                  id: 5d0f8b6e-3a02-4f5b-9e1c-7c6a4a1b8c9d
                  name: Backend integration
                  description: null
                  environment: PRODUCTION
                  prefix: ypk_live_ab12cd34ef
                  scopes:
                    - payments:write
                    - payments:read
                    - withdrawals:write
                    - withdrawals:read
                  ipAllowlist:
                    - 203.0.113.10
                  rateLimitPerMinute: 600
                  expiresAt: null
                  lastUsedAt: '2026-05-03T14:21:08.443Z'
                  createdAt: '2026-04-12T09:00:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    ApiKeySelf:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Internal API key id.
        name:
          type: string
          description: Human-readable name set in the dashboard.
        description:
          type: string
          nullable: true
        environment:
          type: string
          enum:
            - SANDBOX
            - PRODUCTION
          description: Environment the key is bound to.
        prefix:
          type: string
          description: The non-secret prefix of the key (`ypk_<env>_<kid>`). Safe to log.
        scopes:
          type: array
          items:
            type: string
          description: Permissions granted to the key.
        ipAllowlist:
          type: array
          items:
            type: string
          description: List of allowed IPs/CIDRs. Empty means no restriction.
        rateLimitPerMinute:
          type: integer
          nullable: true
          description: >-
            Per-key rate limit in requests per minute, or null for the account
            default.
        expiresAt:
          type: string
          format: date-time
          nullable: true
          description: Expiration timestamp, or null if the key does not expire.
        lastUsedAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code.
            message:
              type: string
              description: Human-readable error message.
            details:
              type: object
              description: Additional error context.
  responses:
    Unauthorized:
      description: Missing or invalid authentication token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: INVALID_API_KEY
              message: Invalid or revoked API key
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        YuvexPay API key. Include as `Authorization: Bearer
        ypk_<env>_<kid>_<secret>` where `<env>` is `test` (sandbox) or `live`
        (production). Create and manage keys in the dashboard under **Settings >
        API Keys**.

````