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

# Verify a trust rule

> Checks a trust rule's condition and audience without creating it.

> [!NOTE]
>
> [Workload identity federation](https://docs.baseten.co/organization/workload-identity.md) is in **Private Preview**.


## OpenAPI

````yaml post /v1/access/trust_rules/verify
openapi: 3.1.0
info:
  description: REST API for management of Baseten resources
  title: Baseten management API
  version: 1.0.0
servers:
  - url: https://api.baseten.co
security:
  - BearerAuth: []
paths:
  /v1/access/trust_rules/verify:
    post:
      summary: Checks a trust rule's condition and audience
      description: >-
        Runs the checks that creating or updating a trust rule runs on its
        condition and audience, without saving anything: that the condition
        compiles and pins the claims the identity provider requires. A failed
        check returns 200 with `valid` false and the reason.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VerifyAccessTrustRuleRequestV1'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VerificationV1'
      x-codeSamples:
        - lang: bash
          source: |-
            curl --request POST \
            --url https://api.baseten.co/v1/access/trust_rules/verify \
            --header "Authorization: Bearer $BASETEN_API_KEY" \
            --data '{
              "identity_provider_id": "abcd1234",
              "condition": "claims.repository_owner_id == '12345' && claims.sub == 'repo:acme/models:ref:refs/heads/main'",
              "audience": "https://api.baseten.co"
            }'
        - lang: python
          source: |-
            import requests
            import os
            API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
            url = "https://api.baseten.co/v1/access/trust_rules/verify"

            headers = {"Authorization": f"Bearer {API_KEY}"}

            response = requests.request(
                "POST",
                url,
                headers=headers,
                json={'identity_provider_id': 'abcd1234', 'condition': "claims.repository_owner_id == '12345' && claims.sub == 'repo:acme/models:ref:refs/heads/main'", 'audience': 'https://api.baseten.co'}
            )

            print(response.text)
components:
  schemas:
    VerifyAccessTrustRuleRequestV1:
      additionalProperties: false
      description: >-
        Request to check a trust rule's condition and audience before saving
        them.
      properties:
        identity_provider_id:
          description: >-
            The identity provider the rule is for, which decides the claims it
            must pin
          title: Identity Provider Id
          type: string
        condition:
          description: >-
            A CEL expression over the token's `claims` that must evaluate to
            true. It must pin a specific `claims.sub` in a top-level `&&`
            clause, plus any provider-required checks. Up to 4,096 characters.
          examples:
            - >-
              claims.repository_owner_id == '12345' &&
              claims.sub.startsWith('repo:acme/models:') && claims.ref ==
              'refs/heads/main'
          title: Condition
          type: string
        audience:
          description: >-
            The token's `aud` must equal this, or contain it when `aud` is a
            list. Up to 1,024 characters.
          title: Audience
          type: string
      required:
        - identity_provider_id
        - condition
        - audience
      title: VerifyAccessTrustRuleRequestV1
      type: object
    VerificationV1:
      description: Whether a create request would pass the checks the server runs on it.
      properties:
        valid:
          description: Whether the input passes every check
          title: Valid
          type: boolean
        error:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Why the input fails, as creating it would report. Null when it's
            valid.
          title: Error
      required:
        - valid
      title: VerificationV1
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````