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

# List Accessible Subjects

> Returns all subjects the tenant can access via active grants from other tenants,
including the latest snapshot header for each (if `read_latest` scope is held).

The **calling principal** must have `allow_counterparty_access: true` on their
principal access record. This flag defaults to `false` and must be explicitly
enabled by a human `account_admin` via `PUT /v1/tenants/{tenant_id}/principals/{principal_id}`.
Principals without the flag receive 403 even if the tenant holds active grants.


Returns all subjects the tenant can access via active grants from other tenants.

## Per-principal flag required

The calling principal must have `allow_counterparty_access: true` set on their
principal access record. This flag is `false` by default and must be explicitly
enabled by a human `account_admin` using
[Add or Update Principal](/api-reference/tenants/upsert-member).

Principals without the flag receive `403 Forbidden` even if the tenant holds
active grants. This is a per-principal gate — granting counterparty access to
the tenant does not automatically grant it to all principals within that tenant.

## Enabling the flag

```bash theme={null}
curl -X PUT https://tally-platform-api-iikaevm4pq-ue.a.run.app/v1/tenants/{tenant_id}/principals/{principal_id} \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "allow_counterparty_access": true }'
```

The token used here must belong to a **human** `account_admin`. Service account
and AI agent callers are rejected with `422` regardless of their tenancy role.


## OpenAPI

````yaml GET /v1/tenants/{tenant_id}/accessible-subjects
openapi: 3.1.0
info:
  title: Tally Platform API
  version: '1.0'
  description: >
    The Tally Platform API is a versioned REST API for managing business
    identity

    state, counterparty access grants, and refresh workflows.


    All tenant-scoped endpoints require an `Authorization: Bearer <token>`
    header

    containing a valid Firebase Auth JWT. Tokens are issued by Google Identity

    Platform (GCIP) after sign-in at your environment's app domain.


    **Base URLs**

    | Environment | URL |

    |-------------|-----|

    | Staging | `https://tally-platform-api-xwka6vu2kq-ue.a.run.app` |

    | Production | `https://tally-platform-api-iikaevm4pq-ue.a.run.app` |
  contact:
    email: support@tallychannel.com
servers:
  - url: https://tally-platform-api-xwka6vu2kq-ue.a.run.app
    description: Staging
  - url: https://tally-platform-api-iikaevm4pq-ue.a.run.app
    description: Production
security:
  - BearerAuth: []
tags:
  - name: System
    description: Health checks and service metadata. No authentication required.
  - name: Tenants
    description: Tenant creation and member management.
  - name: Grants
    description: >-
      Access grant lifecycle — create, list, revoke. Controls which counterparty
      tenants can read which subjects.
  - name: Identity State
    description: >-
      Initial snapshot creation. Writes the first versioned state record for a
      subject.
  - name: Snapshots
    description: >-
      Read identity state — latest, history, by ID, export, chain proof, and
      diff.
  - name: Updates
    description: Propose and apply RFC 6902 patch updates to create new snapshot versions.
  - name: Transfer Offers
    description: Consensual `tenant_owner` role transfer handshake between principals.
  - name: Refresh Requests
    description: >-
      Counterparty-initiated requests for attribute updates or snapshot
      confirmation.
  - name: Webhooks
    description: Webhook subscription management and secret rotation.
paths:
  /v1/tenants/{tenant_id}/accessible-subjects:
    get:
      tags:
        - Grants
      summary: List accessible subjects
      description: >
        Returns all subjects the tenant can access via active grants from other
        tenants,

        including the latest snapshot header for each (if `read_latest` scope is
        held).


        The **calling principal** must have `allow_counterparty_access: true` on
        their

        principal access record. This flag defaults to `false` and must be
        explicitly

        enabled by a human `account_admin` via `PUT
        /v1/tenants/{tenant_id}/principals/{principal_id}`.

        Principals without the flag receive 403 even if the tenant holds active
        grants.
      operationId: listAccessibleSubjects
      parameters:
        - $ref: '#/components/parameters/tenant_id'
      responses:
        '200':
          description: Accessible subject list.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/AccessibleSubject'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  parameters:
    tenant_id:
      name: tenant_id
      in: path
      required: true
      schema:
        type: string
      description: Tenant identifier.
      example: tally-staging
  schemas:
    AccessibleSubject:
      type: object
      properties:
        subject_type:
          type: string
        subject_id:
          type: string
        granted_by_tenant_id:
          type: string
        scopes:
          type: array
          items:
            type: string
        latest_snapshot:
          $ref: '#/components/schemas/SnapshotHeader'
          nullable: true
    SnapshotHeader:
      type: object
      description: Lightweight snapshot metadata without the full envelope.
      properties:
        snapshot_id:
          type: string
          format: uuid
        snapshot_version:
          type: integer
        generated_at:
          type: string
          format: date-time
        envelope_hash:
          type: string
          nullable: true
          description: >-
            SHA-256 (RFC 8785 JCS) of the full envelope. Null if not yet
            computed.
        prev_hash:
          type: string
          nullable: true
          description: Hash of the preceding snapshot envelope, for chain linkage.
        subject:
          type: object
          properties:
            subject_type:
              type: string
            subject_id:
              type: string
      required:
        - snapshot_id
        - snapshot_version
        - generated_at
    ErrorEnvelope:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code.
              example: validation_error
            message:
              type: string
              description: Human-readable error message.
              example: Request body failed schema validation.
            details:
              type: array
              items:
                $ref: '#/components/schemas/ErrorDetail'
            request_id:
              type: string
              description: Request ID for tracing. Injected server-side.
              example: req_01j2k3m4n5
          required:
            - code
            - message
      required:
        - error
    ErrorDetail:
      type: object
      properties:
        path:
          type: string
          description: JSON Pointer to the field that caused the error.
          example: /subject_id
        message:
          type: string
          example: subject_id is required.
        code:
          type: string
          example: invalid_type
      required:
        - path
        - message
  responses:
    Unauthorized:
      description: Missing or invalid Bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            error:
              code: unauthorized
              message: Authentication required.
    Forbidden:
      description: Authenticated but insufficient role or missing grant.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            error:
              code: forbidden
              message: Owner or grant required.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        Firebase Auth JWT issued by Google Identity Platform.
        Obtain a token by signing in at your app domain and calling
        `firebase.auth().currentUser.getIdToken()`.

````