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

# Get User Info

> Returns identity information for the user associated with a Barndoor API key.

Pass your API key (beginning with `bdai_`) in the JSON request body — no `Authorization` header is required.
Generate an API key from the Barndoor dashboard at **Settings → API Tokens**.

This endpoint is useful for verifying which user and organization a token belongs to,
especially when managing multiple test accounts or debugging authentication.




## OpenAPI

````yaml POST /api/identity/userinfo
openapi: 3.1.0
info:
  title: Barndoor Platform API
  version: 1.0.0
  description: >
    REST API for the Barndoor Platform - manage MCP servers, OAuth connections,
    and proxy MCP requests.


    ## Authentication


    All endpoints require a JWT Bearer token obtained through Barndoor's

    OAuth 2.0 authorization-code flow with PKCE. The SDK handles the OAuth

    flow automatically using interactive login.


    ## MCP Integration


    The `/mcp/{mcp_server_name}` endpoints provide streaming proxy access to
    third-party MCP servers

    (Salesforce, Notion, Slack, etc.) with automatic authentication and session
    management.
  contact:
    name: Barndoor Support
    url: https://barndoor.ai
servers:
  - url: https://{organization_id}.platform.barndoor.ai
    description: Trial (Production)
    variables:
      organization_id:
        description: Your organization identifier
        default: your-org
  - url: https://{organization_id}.platform.barndoor.ai
    description: Enterprise (Production)
    variables:
      organization_id:
        description: Your organization identifier
        default: your-org
  - url: https://{organization_id}.platform.barndooruat.com
    description: Enterprise (Production)
    variables:
      organization_id:
        description: Your organization identifier
        default: your-org
  - url: https://{organization_id}.platform.barndoordev.com
    description: Enterprise (Production)
    variables:
      organization_id:
        description: Your organization identifier
        default: your-org
security:
  - BearerAuth: []
tags:
  - name: Servers
    description: Manage MCP server instances
  - name: Connections
    description: Manage OAuth connections to MCP servers
  - name: Policies
    description: Manage access control policies for agents and servers
  - name: Agents
    description: Manage AI agent registrations
  - name: MCP Proxy
    description: Proxy requests to MCP servers
  - name: Identity
    description: Retrieve identity information for the authenticated user
paths:
  /api/identity/userinfo:
    post:
      tags:
        - Identity
      summary: Get current user info
      description: >
        Returns identity information for the user associated with a Barndoor API
        key.


        Pass your API key (beginning with `bdai_`) in the JSON request body — no
        `Authorization` header is required.

        Generate an API key from the Barndoor dashboard at **Settings → API
        Tokens**.


        This endpoint is useful for verifying which user and organization a
        token belongs to,

        especially when managing multiple test accounts or debugging
        authentication.
      operationId: getUserInfo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserInfoRequest'
      responses:
        '200':
          description: Identity information for the authenticated user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserInfoResponse'
        '401':
          description: Unauthorized — the provided token does not exist or has been revoked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security: []
components:
  schemas:
    UserInfoRequest:
      type: object
      required:
        - token
      properties:
        token:
          type: string
          description: >-
            Your Barndoor API key (begins with `bdai_`). Generate one at
            Settings → API Tokens in the dashboard.
          example: bdai_xxxxxxxxxxxxxxxxxxxxxxxx
      title: UserInfoRequest
    UserInfoResponse:
      type: object
      required:
        - id
        - organization_id
        - organization_name
        - organization_display_name
        - name
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the authenticated user.
          example: 5e52dac4-bd2a-426b-b4ba-d32d995ecada
        organization_id:
          type: string
          format: uuid
          description: Unique identifier for the user's organization.
          example: cf586077-cab2-4574-a2f2-32d48e8d34e4
        organization_name:
          type: string
          description: URL-friendly slug identifier for the organization.
          example: blush-chickadee
        organization_display_name:
          type: string
          description: Human-readable display name of the organization.
          example: Acme Corp
        name:
          type: string
          description: Display name of the authenticated user.
          example: Jane Smith
        account_status:
          type: string
          enum:
            - trial
            - paid
          description: Current account tier.
          example: trial
          default: trial
      title: UserInfoResponse
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          description: Error type identifier
          example: ServerNotFound
        message:
          type: string
          description: Human-readable error message
          example: Server with ID '123' not found
        details:
          type: object
          description: Additional error details
          additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        JWT token obtained through Barndoor's OAuth 2.0 authorization-code

        flow with PKCE.


        The token should be included in the Authorization header:

        `Authorization: Bearer <your-jwt-token>`


        Use the Barndoor SDK's `loginInteractive()` function to obtain tokens
        automatically.

````