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

# Get authentication context

> Returns the authenticated principal, organization, credential scope, and effective request scope. The response is derived from the verified request context and does not expose credential secrets.



## OpenAPI

````yaml https://api.onkernel.com/spec.json get /auth/context
openapi: 3.1.0
info:
  description: Developer tools and cloud infrastructure for AI agents to use web browsers
  title: Kernel API
  version: 0.1.0
servers:
  - description: API Server
    url: https://api.onkernel.com
security:
  - bearerAuth: []
tags:
  - description: Create and manage browser sessions.
    name: Browsers
  - description: Control mouse, keyboard, and screen on the browser instance.
    name: Browser Computer Controls
  - description: Execute Playwright code against the browser instance.
    name: Browser Playwright
  - description: Read, write, and manage files on the browser instance.
    name: Browser Filesystem
  - description: Execute and manage processes on the browser instance.
    name: Browser Processes
  - description: Record and manage browser session video replays.
    name: Browser Replays
  - description: Stream logs from the browser instance.
    name: Browser Logs
  - description: Stream live telemetry events from a browser session.
    name: Browser Telemetry
  - description: Create, list, retrieve, and delete browser profiles.
    name: Profiles
  - description: Create and manage proxy configurations for routing browser traffic.
    name: Proxies
  - description: Create, list, retrieve, and delete browser extensions.
    name: Extensions
  - description: Create and manage browser pools for acquiring and releasing browsers.
    name: Browser Pools
  - description: Inspect the identity and authorization context for the current request.
    name: Authentication
  - description: >-
      Create and manage auth connections for automated credential capture and
      login.
    name: Managed Auth
  - description: Create and manage credentials for authentication.
    name: Credentials
  - description: Configure external credential providers like 1Password.
    name: Credential Providers
  - description: List applications and versions.
    name: Apps
  - description: Create and manage app deployments and stream deployment events.
    name: Deployments
  - description: Invoke actions and stream or query invocation status and events.
    name: Invocations
  - description: Read and manage organization-level limits.
    name: Organization
  - description: |
      Create and manage projects for resource isolation within an organization.
      When projects are disabled for the organization, project operations return
      `404` with code `projects_disabled`.
    name: Projects
  - description: Create and manage API keys for organization and project-scoped access.
    name: API Keys
  - description: Read audit log records for the authenticated organization.
    name: Audit Logs
paths:
  /auth/context:
    get:
      tags:
        - Authentication
      summary: Get authentication context
      description: >-
        Returns the authenticated principal, organization, credential scope, and
        effective request scope. The response is derived from the verified
        request context and does not expose credential secrets.
      operationId: getAuthContext
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthContext'
          description: Authentication context for the current request
          headers:
            Cache-Control:
              schema:
                example: private, no-store
                type: string
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
components:
  schemas:
    AuthContext:
      description: The identity and authorization context resolved for the current request.
      properties:
        authentication:
          $ref: '#/components/schemas/AuthContextAuthentication'
        authorization:
          $ref: '#/components/schemas/AuthContextAuthorization'
        organization:
          $ref: '#/components/schemas/AuthContextOrganization'
        principal:
          $ref: '#/components/schemas/AuthContextPrincipal'
      required:
        - authentication
        - principal
        - organization
        - authorization
      type: object
    AuthContextAuthentication:
      properties:
        credential_id:
          description: >-
            The API key ID when authenticated with an API key; null for session
            credentials.
          type:
            - string
            - 'null'
        method:
          description: The credential format used to authenticate the request.
          enum:
            - api_key
            - jwt
          type: string
        source:
          description: The source classification resolved by authentication middleware.
          enum:
            - api_key
            - oauth
            - dashboard
          type: string
      required:
        - method
        - source
        - credential_id
      type: object
    AuthContextAuthorization:
      description: >-
        The credential's maximum scope and the effective scope selected for this
        request. Future permission data can be added without changing scope
        semantics.
      properties:
        credential_scope:
          $ref: '#/components/schemas/AuthContextScope'
        effective_scope:
          $ref: '#/components/schemas/AuthContextScope'
      required:
        - credential_scope
        - effective_scope
      type: object
    AuthContextOrganization:
      properties:
        id:
          description: The authenticated Kernel organization ID.
          type: string
      required:
        - id
      type: object
    AuthContextPrincipal:
      properties:
        id:
          description: >-
            The API key ID for API-key principals or user ID for user
            principals.
          type: string
        type:
          description: The kind of principal authenticated for the request.
          enum:
            - api_key
            - user
          type: string
      required:
        - type
        - id
      type: object
    Error:
      properties:
        code:
          description: Application-specific error code (machine-readable)
          example: bad_request
          type: string
        details:
          description: Additional error details (for multiple errors)
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
        inner_error:
          $ref: '#/components/schemas/ErrorDetail'
        message:
          description: Human-readable error description for debugging
          example: 'Missing required field: app_name'
          type: string
      required:
        - code
        - message
      type: object
    AuthContextScope:
      description: >-
        A scope within the authenticated organization. A null project_id
        represents organization-wide scope.
      properties:
        project_id:
          description: The Kernel project ID, or null when the scope is organization-wide.
          type:
            - string
            - 'null'
      required:
        - project_id
      type: object
    ErrorDetail:
      properties:
        code:
          description: Lower-level error code providing more specific detail
          example: invalid_input
          type: string
        message:
          description: Further detail about the error
          example: Provided version string is not semver compliant
          type: string
      type: object
  responses:
    Unauthorized:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Unauthorized – missing or invalid authorization token
    InternalError:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Internal Server Error
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````