> ## 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.

# List the organization's model-access policys



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/llm-gateway/admin/model-access
openapi: 3.1.0
info:
  title: Barndoor.ai Public API
  description: Unified public API specification for Barndoor.ai platform
  version: 2.18.0
servers:
  - url: https://{host}
    description: Barndoor public API
    variables:
      host:
        default: platform.barndoor.ai
        description: >-
          The host serving your Barndoor deployment. Defaults to production;
          override it for another environment or a dedicated deployment.
security:
  - ApiKey: []
  - OAuth2:
      - openid
      - profile
      - email
tags:
  - name: dlp
    x-group: Data Control Center
  - name: identity
    x-group: Identity
  - name: llm-gateway
    x-group: LLM Gateway
  - name: notification
    x-group: Notifications
  - name: policy
    x-group: Policies
  - name: registry
    x-group: MCP Gateway
  - name: system-management
    x-group: Log Exports
paths:
  /api/llm-gateway/admin/model-access:
    get:
      tags:
        - llm-gateway
      summary: List the organization's model-access policys
      operationId: list_model_access
      responses:
        '200':
          description: The requested record
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WithAttribution_ModelAccessPolicy'
        '401':
          description: Missing or invalid credentials
        '403':
          description: Caller is not permitted to act on this resource in this organization
components:
  schemas:
    WithAttribution_ModelAccessPolicy:
      allOf:
        - type: object
          required:
            - id
            - org_id
            - name
            - scope_type
            - scope_ids
            - scope_values
            - policy_type
            - targets
            - traffic_type
            - enabled
          properties:
            enabled:
              type: boolean
            id:
              type: string
              format: uuid
            name:
              type: string
            org_id:
              type: string
              format: uuid
            policy_type:
              type: string
            scope_id:
              type:
                - string
                - 'null'
              format: uuid
              description: >-
                First element of [`Self::scope_ids`], kept for clients that
                predate

                multi-entity scopes (BCP-5001). Never read for matching when

                `scope_ids` is non-empty -- see [`Self::bound_ids`].
            scope_ids:
              type: array
              items:
                type: string
                format: uuid
              description: >-
                Every UUID-keyed entity (user / project / api_key / agent) the
                policy

                is bound to (BCP-5001). Empty means unbound: the policy is not
                pinned to

                a specific entity of its scope type.
            scope_type:
              type: string
            scope_value:
              type:
                - string
                - 'null'
              description: >-
                First element of [`Self::scope_values`]; same compatibility role
                as

                `scope_id`.
            scope_values:
              type: array
              items:
                type: string
              description: >-
                Every role / group name the policy is bound to (BCP-5001). Empty
                means

                unbound.
            targets:
              type: array
              items:
                $ref: '#/components/schemas/ModelAccessTarget'
            traffic_type:
              type: string
        - $ref: '#/components/schemas/ChangeAttribution'
      description: >-
        An admin-API response for an entity whose core type lives in

        `ai_governance` and so cannot carry portal-only columns.


        `TokenBudget` and `RateLimitPolicy` are read by the enforcement path on

        every request; hanging five display-only fields off them would put
        portal

        concerns in the hot path's type and force every governance consumer to

        carry them. Wrapping instead keeps the enforcement reads

        (`get_enabled_by_org` and friends) returning the bare governance type,

        while the admin reads return this.


        Both halves are `#[serde(flatten)]`, so the wire shape stays the flat

        object the portal already consumes — same choice `AdminModelPricing`
        makes.
    ModelAccessTarget:
      oneOf:
        - type: object
          description: |-
            Match by user-facing model alias (with optional trailing `*`
            wildcard) — i.e. whatever the caller put in the `model` field.

            Use this for aliases that may map to multiple providers (e.g. a
            `goto` alias fanned out across OpenAI and Anthropic): the policy
            fires whenever a request uses that alias, regardless of routing.
          required:
            - alias
            - kind
          properties:
            alias:
              type: string
            kind:
              type: string
              enum:
                - model_alias
        - type: object
          description: |-
            Match by concrete upstream model (with optional trailing `*`
            wildcard). The admin UI populates this from the distinct list of
            `upstream_model` values across all mappings, labelled with the
            provider family (e.g. `gpt-4o (openai)`). Matching evaluates
            against the resolved route's `upstream_model`, so it fires even
            when the request used a custom alias that resolves to this model.
          required:
            - model
            - kind
          properties:
            kind:
              type: string
              enum:
                - model
            model:
              type: string
        - type: object
          description: |-
            Match any model served by the given provider connection.

            Asymmetric between the two policy directions — see
            [`ModelAccessTarget::grants`]. As a *denial* this covers everything
            routed to the provider, custom aliases included. As a *grant* it
            covers the provider's own models only.
          required:
            - provider_id
            - kind
          properties:
            kind:
              type: string
              enum:
                - provider
            provider_id:
              type: string
              format: uuid
        - type: object
          description: |-
            Match the (provider, model alias) combination — used to allow/deny a
            specific model only when it goes through a specific provider.
          required:
            - provider_id
            - model
            - kind
          properties:
            kind:
              type: string
              enum:
                - provider_model
            model:
              type: string
            provider_id:
              type: string
              format: uuid
        - type: object
          description: >-
            Match every route in a named route group (BCP-3961) — the way an org

            says "the Engineering team's routes" once instead of listing aliases

            and re-editing the policy whenever a route is added.


            **This variant never reaches [`ModelAccessTarget::matches`].**

            [`ModelAccessPolicyDb::get_enabled_by_org`] — the only load path

            governance uses — expands it into one
            [`ModelAccessTarget::ModelAlias`]

            per member alias, so the request path stays a pure function over

            [`MatchContext`] with no database access. `matches`/`grants` still

            answer `false` for it as a fail-safe: if some future load path
            forgets

            to expand, a group target denies nothing and grants nothing rather
            than

            matching everything.


            `list_by_org` (the admin path) deliberately does *not* expand, so
            the

            policy editor shows "Engineering" rather than its fourteen members.
          required:
            - group_id
            - kind
          properties:
            group_id:
              type: string
              format: uuid
            kind:
              type: string
              enum:
                - route_group
      description: >-
        A single restriction target inside a [`ModelAccessPolicy`].


        Targets answer the question "*what* is being allowed/denied?" — distinct

        from `scope_type`, which answers "*who* is the policy applied to?". A

        policy's `targets` list is OR-ed when matching: a request matches the

        policy if any one of its targets matches the (provider, model) pair.


        Serialised to JSONB with a `kind` discriminator so it round-trips
        cleanly

        through the admin REST API.


        `ModelAlias` matches against the literal `model` field in the request.

        `Model` matches against the *resolved upstream model* — i.e. the
        underlying

        model the routed mapping points at. The two are distinct because the

        admin UI lets admins pick along either dimension: a `goto` alias fanned

        out across providers is best expressed with `ModelAlias`, while "block
        any

        request that ends up at gpt-4o-mini regardless of the alias used" is
        best

        expressed with `Model` (so it fires even when `goto` resolves to

        `gpt-4o-mini`).
    ChangeAttribution:
      type: object
      description: >-
        The attribution carried on an admin-configurable row, as returned to the

        portal.


        Every field is `Option` and nothing is backfilled: a row that predates
        V75

        has no truthful actor to attribute it to, and inventing one would be
        worse

        than rendering a placeholder. Rows pick up attribution on their first

        write.
      properties:
        created_by_email:
          type:
            - string
            - 'null'
        created_by_name:
          type:
            - string
            - 'null'
        created_by_user_id:
          type:
            - string
            - 'null'
          format: uuid
        last_change_note:
          type:
            - string
            - 'null'
          description: >-
            Optional free text explaining *why* the last change was made

            ("Raised for the Q3 batch job", "Vendor deprecated the old
            endpoint").


            Admin-authored and rendered in the portal, so it is untrusted input:

            length-capped here, escaped on render.
        last_modified_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When the change named by `last_modified_by_*` happened.


            Its own column rather than the row's `updated_at`, because
            `updated_at`

            is bumped by writes nobody is attributed for -- pairing the two
            would

            date a named admin's edit to a background job's clock. See the V75

            migration for the full reasoning.
        last_modified_by_email:
          type:
            - string
            - 'null'
        last_modified_by_name:
          type:
            - string
            - 'null'
        last_modified_by_user_id:
          type:
            - string
            - 'null'
          format: uuid
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      description: >-
        A Barndoor API key, sent as `Authorization: Bearer <key>`. Keys are
        prefixed `bdai_` and are opaque — do not attempt to decode one.
        Interchangeable with an OAuth 2.0 access token.
    OAuth2:
      type: oauth2
      x-issuer: https://auth.barndoor.ai/realms/barndoor
      description: >-
        An OAuth 2.0 access token from Barndoor's identity provider, sent as
        `Authorization: Bearer <token>`. Public clients must use PKCE.
        Interchangeable with an API key.
      flows:
        authorizationCode:
          authorizationUrl: >-
            https://auth.barndoor.ai/realms/barndoor/protocol/openid-connect/auth
          tokenUrl: >-
            https://auth.barndoor.ai/realms/barndoor/protocol/openid-connect/token
          scopes:
            openid: Issue an OIDC ID token identifying the caller.
            profile: Read the caller's basic profile claims.
            email: Read the caller's email address.
            offline_access: Issue a refresh token. Optional — no operation requires it.
        clientCredentials:
          tokenUrl: >-
            https://auth.barndoor.ai/realms/barndoor/protocol/openid-connect/token
          scopes:
            openid: Issue an OIDC ID token identifying the caller.
            profile: Read the caller's basic profile claims.
            email: Read the caller's email address.
            offline_access: Issue a refresh token. Optional — no operation requires it.

````

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