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

# Get a policy

> Returns a single policy by its unique identifier.



## OpenAPI

````yaml /openapi.yaml get /policies/{policyId}
openapi: 3.1.0
info:
  title: Den API
  version: 2.0.0
  description: >
    API for managing wallets with Den. This API provides programmatic access to
    all platform capabilities

    including wallet accounts, members, groups, policies, and transactions.


    ## Authentication

    All API requests require authentication via Bearer token in the
    Authorization header.


    ## Idempotency

    All mutation requests (POST, PUT, DELETE) require an X-Idempotency-Key
    header for safe retries.


    ## Two Transaction Types

    - **Account Transactions**: Value movement and contract interactions
    (governed by policies)

    - **Organization Operations**: Governance/admin changes (governed by admin
    threshold)
servers:
  - url: https://api.onchainden.com/api/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Members
    description: Manage organization members
  - name: Groups
    description: Manage member groups
  - name: Policies
    description: Manage transaction policies
  - name: Accounts
    description: Manage wallet accounts
  - name: Transactions
    description: Create and execute account transactions
  - name: Admins
    description: Manage admin configuration
  - name: AuditLogs
    description: View audit log entries
paths:
  /policies/{policyId}:
    get:
      tags:
        - Policies
      summary: Get a policy
      description: Returns a single policy by its unique identifier.
      operationId: getPolicy
      parameters:
        - name: policyId
          in: path
          required: true
          schema:
            type: string
          description: Policy ID
      responses:
        '200':
          description: Policy details
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/Policy'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      x-codeSamples:
        - lang: javascript
          label: SDK
          source: |
            const client = new DenClient({ apiKey: 'ck_live_...' });
            const policy = await client.getPolicy('pol_123');
components:
  schemas:
    Policy:
      oneOf:
        - allOf:
            - $ref: '#/components/schemas/TokenTransferPolicy'
          title: Token Transfer
        - allOf:
            - $ref: '#/components/schemas/ContractInteractionPolicy'
          title: Contract Interaction
        - allOf:
            - $ref: '#/components/schemas/AnyTransactionPolicy'
          title: Any Transaction
      discriminator:
        propertyName: transactionType
        mapping:
          TOKEN_TRANSFER:
            $ref: '#/components/schemas/TokenTransferPolicy'
          CONTRACT_INTERACTION:
            $ref: '#/components/schemas/ContractInteractionPolicy'
          ANY:
            $ref: '#/components/schemas/AnyTransactionPolicy'
    TokenTransferPolicy:
      allOf:
        - $ref: '#/components/schemas/PolicyBase'
        - type: object
          properties:
            transactionType:
              type: string
              const: TOKEN_TRANSFER
            tokenTransferCondition:
              $ref: '#/components/schemas/PolicyTokenTransferCondition'
    ContractInteractionPolicy:
      allOf:
        - $ref: '#/components/schemas/PolicyBase'
        - type: object
          properties:
            transactionType:
              type: string
              const: CONTRACT_INTERACTION
            contractInteractionCondition:
              $ref: '#/components/schemas/PolicyContractInteractionCondition'
    AnyTransactionPolicy:
      allOf:
        - $ref: '#/components/schemas/PolicyBase'
        - type: object
          properties:
            transactionType:
              type: string
              const: ANY
    Error:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    PolicyBase:
      type: object
      required:
        - id
        - name
        - type
        - transactionType
        - networkId
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          example: pol_123
        name:
          type: string
          example: Auto-approve Small Transfers
        description:
          type: string
          nullable: true
          example: Auto-approve USDC transfers under $1000
        type:
          $ref: '#/components/schemas/PolicyType'
        transactionType:
          $ref: '#/components/schemas/PolicyTransactionType'
        networkId:
          $ref: '#/components/schemas/NetworkId'
        accounts:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/PolicyAccount'
          description: >-
            Accounts this policy applies to. null = policy applies to all
            accounts
        limitation:
          $ref: '#/components/schemas/PolicyLimitation'
          nullable: true
        initiatorSetting:
          $ref: '#/components/schemas/PolicyInitiatorSetting'
        approverSetting:
          $ref: '#/components/schemas/PolicyApproverSetting'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    PolicyTokenTransferCondition:
      type: object
      nullable: true
      description: >-
        Token transfer condition with enriched token details - null values mean
        "any" (no restriction)
      properties:
        tokenAddress:
          type: string
          nullable: true
          description: Contract address of token, null = native token or any token
          pattern: ^0x[a-fA-F0-9]{40}$
          example: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
        tokenSymbol:
          type: string
          readOnly: true
          description: >-
            Token symbol (e.g., "USDC", "ETH"), enriched from token metadata.
            Response-only field.
          example: USDC
        tokenName:
          type: string
          nullable: true
          readOnly: true
          description: >-
            Full token name (e.g., "USD Coin"), enriched from token metadata.
            Response-only field.
          example: USD Coin
        tokenLogoUrl:
          type: string
          nullable: true
          readOnly: true
          description: URL to token logo image. Response-only field.
          example: https://assets.onchainden.com/tokens/usdc.png
        tokenDecimals:
          type: integer
          readOnly: true
          description: Token decimals (e.g., 6 for USDC, 18 for ETH). Response-only field.
          example: 6
        amountThreshold:
          type: string
          nullable: true
          description: Max amount in token's smallest unit (wei), null = any amount
          example: '1000000000'
        destinationAddresses:
          type: array
          items:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
          description: Allowed destinations, [] = any destination
          example: []
      example:
        tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
        tokenSymbol: USDC
        tokenName: USD Coin
        tokenLogoUrl: https://assets.onchainden.com/tokens/usdc.png
        tokenDecimals: 6
        amountThreshold: '1000000000'
        destinationAddresses: []
    PolicyContractInteractionCondition:
      type: array
      nullable: true
      items:
        $ref: '#/components/schemas/PolicyContractCondition'
      description: >-
        Contract interaction conditions. Empty array = any contract/function
        allowed
    ErrorObject:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: Human-readable error message
        details:
          $ref: '#/components/schemas/ErrorDetails'
    PolicyType:
      type: string
      enum:
        - AUTO_APPROVAL
        - MANUAL_APPROVAL
      description: |
        - AUTO_APPROVAL: Executes after initiator signature
        - MANUAL_APPROVAL: Requires approver votes
    PolicyTransactionType:
      type: string
      enum:
        - TOKEN_TRANSFER
        - CONTRACT_INTERACTION
        - ANY
    NetworkId:
      type: integer
      example: 1
      description: Network chain ID
    PolicyAccount:
      type: object
      required:
        - id
        - name
        - address
      properties:
        id:
          type: string
          example: acc_1
        name:
          type: string
          example: Treasury
        address:
          type: string
          description: On-chain address for this policy's network
          pattern: ^0x[a-fA-F0-9]{40}$
    PolicyLimitation:
      type: object
      required:
        - hours
        - initiatorScope
        - sourceAccountScope
        - destinationScope
      properties:
        hours:
          type: integer
          description: Rolling time window in hours
          example: 24
        initiatorScope:
          $ref: '#/components/schemas/PolicyLimitationScope'
        sourceAccountScope:
          $ref: '#/components/schemas/PolicyLimitationScope'
        destinationScope:
          $ref: '#/components/schemas/PolicyLimitationScope'
    PolicyInitiatorSetting:
      oneOf:
        - allOf:
            - $ref: '#/components/schemas/PolicyInitiatorSettingUser'
          title: User
        - allOf:
            - $ref: '#/components/schemas/PolicyInitiatorSettingGroup'
          title: Group
      nullable: true
      description: Who can initiate transactions. null = any organization member
      example:
        type: user
        userId: usr_123
    PolicyApproverSetting:
      oneOf:
        - allOf:
            - $ref: '#/components/schemas/PolicyApproverSettingUser'
          title: User
        - allOf:
            - $ref: '#/components/schemas/PolicyApproverSettingGroup'
          title: Group
      nullable: true
      description: >-
        Who can approve transactions. null = any organization member (for
        MANUAL_APPROVAL)
      example:
        type: group
        groupId: grp_admins
        threshold: 2
    PolicyContractCondition:
      type: object
      required:
        - contractAddress
        - allowedFunctions
      properties:
        contractAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
        allowedFunctions:
          type: array
          items:
            $ref: '#/components/schemas/PolicyFunction'
          description: >-
            Allowed functions on this contract. Empty array = any function
            allowed
          example:
            - name: swapExactTokensForTokens
              selector: '0x38ed1739'
            - name: swapTokensForExactTokens
              selector: '0x8803dbee'
    ErrorCode:
      type: string
      enum:
        - validationError
        - invalidSignature
        - unauthorized
        - forbidden
        - notFound
        - conflict
        - thresholdNotMet
        - proposalExpired
        - idempotencyConflict
        - upgradeRequired
        - rateLimited
        - internalError
      description: Machine-readable error codes
    ErrorDetails:
      type: object
      additionalProperties: true
      description: Additional error details (structure varies by error type)
      properties:
        field:
          type: string
          description: Field that caused the error (for validation errors)
        message:
          type: string
          description: Detailed message about the error
    PolicyLimitationScope:
      type: string
      enum:
        - PER_ITEM
        - ALL_ITEMS
      description: |
        - PER_ITEM: Per user/account/destination
        - ALL_ITEMS: All users/accounts/destinations share cap
    PolicyInitiatorSettingUser:
      type: object
      required:
        - type
        - userId
      properties:
        type:
          type: string
          const: user
        userId:
          type: string
          description: User ID of the initiator
          example: usr_123
    PolicyInitiatorSettingGroup:
      type: object
      required:
        - type
        - groupId
      properties:
        type:
          type: string
          const: group
        groupId:
          type: string
          description: Group ID
          example: group_123
    PolicyApproverSettingUser:
      type: object
      required:
        - type
        - userId
      properties:
        type:
          type: string
          const: user
        userId:
          type: string
          description: User ID of the approver
          example: usr_bob
    PolicyApproverSettingGroup:
      type: object
      required:
        - type
        - groupId
        - threshold
      properties:
        type:
          type: string
          const: group
        groupId:
          type: string
          description: Group ID
          example: group_123
        threshold:
          type: integer
          description: Number of votes required from group members
          example: 2
    PolicyFunction:
      type: object
      required:
        - name
        - selector
      description: A contract function with its 4-byte selector
      properties:
        name:
          type: string
          description: Function name
          example: transfer
        selector:
          type: string
          description: 4-byte function selector
          pattern: ^0x[a-fA-F0-9]{8}$
          example: '0xa9059cbb'
  responses:
    Unauthorized:
      description: API key is missing or invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: Invalid API key
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: notFound
              message: Resource not found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        API key authentication. Include your API key in the Authorization
        header.

````