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

# Get the authenticated user and workspace

> Returns the user and workspace behind your API key. `credential.scopes` lists the scopes the key holds, and `credential.defaultScopes` lists the scopes a new key gets when you create it without `scopes`. Call it first to check which key and workspace you are using.



## OpenAPI

````yaml https://monid.ai/openapi.json get /v1/auth/whoami
openapi: 3.1.0
info:
  title: Monid API
  version: 0.1.0
  description: >-
    Agentic payment platform for data. Agents use it to discover and buy data on
    demand. Authenticated routes take a Monid API key as a Bearer token. Errors
    return `{ code, message }`. List endpoints use cursor pagination.
servers:
  - url: https://api.monid.ai
    description: Production
security: []
paths:
  /v1/auth/whoami:
    get:
      tags:
        - Auth
      summary: Get the authenticated user and workspace
      description: >-
        Returns the user and workspace behind your API key. `credential.scopes`
        lists the scopes the key holds, and `credential.defaultScopes` lists the
        scopes a new key gets when you create it without `scopes`. Call it first
        to check which key and workspace you are using.
      responses:
        '200':
          description: The caller's identity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhoamiResponse'
        '401':
          description: Unauthorized. The API key is missing, invalid, expired or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Forbidden. The API key lacks the scope this operation needs, or has
            no workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            Rate limited. Wait the number of seconds in the `Retry-After`
            header, then retry. The `RateLimit-Limit`, `RateLimit-Remaining` and
            `RateLimit-Reset` headers describe the limit that applied.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - Bearer: []
components:
  schemas:
    WhoamiResponse:
      type: object
      properties:
        user:
          $ref: '#/components/schemas/AuthUser'
        workspace:
          $ref: '#/components/schemas/AuthWorkspace'
        credential:
          $ref: '#/components/schemas/AuthCredential'
        identities:
          type: array
          items:
            $ref: '#/components/schemas/IdentitySummary'
          description: >-
            External identities linked to this user (e.g. a World ID). The Clerk
            login itself is not listed.
        identityProviders:
          type: array
          items:
            $ref: '#/components/schemas/IdentityProviderAvailability'
          description: Linkable providers and whether linking is enabled.
      required:
        - user
        - credential
        - identities
        - identityProviders
    Error:
      type: object
      properties:
        code:
          type: integer
          description: HTTP status code, duplicated in the body.
          example: 400
        message:
          type: string
          description: Human-readable error description.
          example: Bad Request
        errorCode:
          type: string
          enum:
            - BAD_REQUEST
            - VALIDATION_FAILED
            - INVALID_JSON
            - INVALID_CURSOR
            - UNAUTHENTICATED
            - FORBIDDEN
            - NOT_FOUND
            - CONFLICT
            - GONE
            - PAYLOAD_TOO_LARGE
            - INTERNAL_ERROR
            - NOT_IMPLEMENTED
            - BAD_GATEWAY
            - SERVICE_UNAVAILABLE
            - WALLET_NOT_ACTIVE
            - WALLET_PROVISIONING
            - WALLET_FAILED
            - RATE_LIMITED
            - X402_WORKSPACE_RESOURCES
            - X402_WORKSPACE_ONLY
            - X402_ACCRUING_COST
            - X402_EXCEEDS_SETTLEMENT_WINDOW
            - X402_VALIDITY_WINDOW_TOO_SHORT
            - X402_UNBOUNDED_PRICE
            - X402_SETTLEMENT_FAILED
            - MPP_WORKSPACE_RESOURCES
            - MPP_WORKSPACE_ONLY
            - MPP_ACCRUING_COST
            - MPP_UNBOUNDED_PRICE
            - MPP_PAYMENT_FAILED
            - MPP_CREDENTIAL_REPLAYED
            - MPP_PROOF_REQUIRED
            - MPP_UNAVAILABLE
            - INSUFFICIENT_SCOPE
            - WALLET_INSUFFICIENT_FUNDS
            - MAX_COST_EXCEEDED
            - IDEMPOTENCY_KEY_REUSED
            - IDEMPOTENCY_KEY_IN_USE
            - IDENTITY_PROVIDER_UNKNOWN
            - IDENTITY_LINK_REQUIRES_SESSION
            - IDENTITY_LINK_STATE_INVALID
            - IDENTITY_VERIFICATION_FAILED
            - IDENTITY_ASSURANCE_INSUFFICIENT
            - IDENTITY_PROVIDER_UNAVAILABLE
            - IDENTITY_ALREADY_LINKED
            - IDENTITY_USER_ALREADY_LINKED
            - IDENTITY_LINK_RATE_LIMITED
            - IDENTITY_REQUIRED
            - PROMO_IDENTITY_REDEEMED
            - PROMO_REDEEM_REQUIRES_SESSION
            - PROMO_CODE_REDEEMED_BY_WORKSPACE
            - PROMO_CODE_REDEEMED_BY_USER
            - PROMO_CODE_EXHAUSTED
            - PROMO_NEW_ACCOUNTS_ONLY
            - WEBHOOK_REQUIRES_SESSION
            - WEBHOOK_URL_NOT_ALLOWED
            - WEBHOOK_ENDPOINT_LIMIT
            - WEBHOOK_ROTATION_LIMIT
          description: >-
            Machine-readable reason, present on every error. Either a specific
            code (for example `MAX_COST_EXCEEDED`) or the generic code of the
            HTTP status (for example `NOT_FOUND`). Treat an unknown value as the
            generic meaning of the status.
        hints:
          type: object
          additionalProperties:
            anyOf:
              - type: string
              - type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - command
                      - discover
                      - inspect
                      - run
                      - getRun
                      - stop
                      - releaseResource
                      - topup
                  command:
                    type: string
                  query:
                    type: string
                  provider:
                    type: string
                  endpoint:
                    type: string
                  runId:
                    type: string
                  resourceId:
                    type: string
                  stripe:
                    type: string
                  dashboard:
                    type: string
                  docs:
                    type: string
                  comment:
                    type: string
                required:
                  - kind
          description: >-
            Optional next actions, rendered for the calling client like
            run-response hints (e.g. the paid TinyFish version on a free-quota
            429 — spending permission required).
      required:
        - code
        - message
        - errorCode
    AuthUser:
      type: object
      properties:
        userId:
          type: string
          minLength: 1
          description: Clerk user id.
          example: user_2abcDEFghiJKLmnop
        username:
          type: string
          description: Username from Clerk (may be empty).
        email:
          type: string
          description: Primary email, when known.
          example: dev@example.com
        metadata:
          type: object
          additionalProperties: {}
          description: Free-form user metadata record.
        createdAt:
          type: string
          format: date-time
          description: Record creation time (ISO-8601).
        updatedAt:
          type: string
          format: date-time
          description: Record last-update time (ISO-8601).
      required:
        - userId
        - username
        - metadata
        - createdAt
        - updatedAt
    AuthWorkspace:
      type: object
      properties:
        workspaceId:
          type: string
          minLength: 1
          description: Workspace (Clerk organization) id.
          example: org_2abcDEFghiJKLmnop
        name:
          type: string
          description: Organization display name (may be empty).
        slug:
          type: string
          description: Organization slug (may be empty).
          example: acme-inc
        metadata:
          type: object
          additionalProperties: {}
          description: Free-form workspace metadata record.
        createdAt:
          type: string
          format: date-time
          description: Record creation time (ISO-8601).
        updatedAt:
          type: string
          format: date-time
          description: Record last-update time (ISO-8601).
      required:
        - workspaceId
        - name
        - slug
        - metadata
        - createdAt
        - updatedAt
      description: Absent when the caller is not part of a workspace.
    AuthCredential:
      type: object
      properties:
        kind:
          type: string
          enum:
            - clerk_session
            - api_key
          description: How the request was authenticated.
        scopes:
          type: array
          items:
            type: string
            enum:
              - '*'
              - runs:*
              - resources:*
              - wallet:*
              - topups:*
              - controls:*
              - api_keys:*
              - webhooks:*
              - usage:*
              - runs:create
              - runs:get
              - runs:list
              - runs:update
              - resources:read
              - resources:create
              - resources:update
              - resources:delete
              - wallet:read
              - wallet:update
              - topups:create
              - controls:read
              - controls:create
              - controls:update
              - controls:delete
              - api_keys:read
              - api_keys:create
              - api_keys:update
              - api_keys:revoke
              - webhooks:read
              - usage:read
          description: >-
            The grants this credential holds (`*` = everything) — also the MOST
            a key it mints may hold.
        defaultScopes:
          type: array
          items:
            type: string
            enum:
              - '*'
              - runs:*
              - resources:*
              - wallet:*
              - topups:*
              - controls:*
              - api_keys:*
              - webhooks:*
              - usage:*
              - runs:create
              - runs:get
              - runs:list
              - runs:update
              - resources:read
              - resources:create
              - resources:update
              - resources:delete
              - wallet:read
              - wallet:update
              - topups:create
              - controls:read
              - controls:create
              - controls:update
              - controls:delete
              - api_keys:read
              - api_keys:create
              - api_keys:update
              - api_keys:revoke
              - webhooks:read
              - usage:read
          description: >-
            What `POST /v1/api-keys` mints when this credential omits `scopes`:
            a session gets every resource except `controls`; an API key passes
            its own grants down. See `GET /v1/api-keys/scopes` for the catalog.
        fingerprint:
          type: string
          description: API-key fingerprint (= AEP `credential_id`). Absent for sessions.
        expiresAt:
          type: string
          format: date-time
          description: API-key expiry. Absent when it never expires or for sessions.
      required:
        - kind
        - scopes
        - defaultScopes
    IdentitySummary:
      type: object
      properties:
        provider:
          type: string
          enum:
            - clerk
            - aep
            - world
        verified:
          type: boolean
          description: Whether the provider vouched for this identity.
        linkedAt:
          type: string
          format: date-time
        lastVerifiedAt:
          type: string
          format: date-time
          description: Last successful (re-)verification, for OIDC identities.
      required:
        - provider
        - verified
        - linkedAt
    IdentityProviderAvailability:
      type: object
      properties:
        key:
          type: string
          enum:
            - clerk
            - aep
            - world
        enabled:
          type: boolean
          description: Whether NEW links can be started for this provider.
      required:
        - key
        - enabled
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      description: Monid API key
      x-aep-authentication-method: api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.