> ## Documentation Index
> Fetch the complete documentation index at: https://cobo.com/products/agentic-wallet/manual/llms.txt
> Use this file to discover all available pages before exploring further.

# Update pact policies

> Full-replace the delegation-scoped policies of an active pact. Existing policies are removed and the new list is created atomically to avoid a window with no policies. Only the wallet owner can update policies on an active pact.



## OpenAPI

````yaml patch /api/v1/pacts/{pact_id}/policies
openapi: 3.1.0
info:
  title: Cobo Agentic Wallet Service
  description: Unified wallet engine for human and agent principals
  version: 1.3.0
servers: []
security: []
paths:
  /api/v1/pacts/{pact_id}/policies:
    patch:
      tags:
        - Pacts
      summary: Update pact policies
      description: >-
        Full-replace the delegation-scoped policies of an active pact. Existing
        policies are removed and the new list is created atomically to avoid a
        window with no policies. Only the wallet owner can update policies on an
        active pact.
      operationId: update_policies
      parameters:
        - name: pact_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: >-
              The UUID of the active pact whose policies to replace, as returned
              by the submit or list endpoints.
            title: Pact Id
          description: >-
            The UUID of the active pact whose policies to replace, as returned
            by the submit or list endpoints.
        - name: X-API-Key
          in: header
          required: false
          schema:
            title: X-Api-Key
            type: string
            nullable: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PactUpdatePoliciesRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StandardResponse_PactPublicRead_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WrappedValidationError'
components:
  schemas:
    PactUpdatePoliciesRequest:
      properties:
        policies:
          items:
            $ref: '#/components/schemas/InlinePolicyCreate'
          type: array
          title: Policies
          description: New policy list. Replaces all existing delegation policies.
      type: object
      required:
        - policies
      title: PactUpdatePoliciesRequest
      description: |-
        Request body for PATCH /pacts/{pact_id}/policies.

        Full replacement of the pact's delegation-scoped policies.
        Old policies are deleted and new ones are created atomically.
    StandardResponse_PactPublicRead_:
      properties:
        success:
          type: boolean
          title: Success
          default: true
        result:
          $ref: '#/components/schemas/PactPublicRead'
        suggestion:
          type: string
          title: Suggestion
          default: ''
        message:
          type: string
          title: Message
          default: ''
        meta:
          $ref: '#/components/schemas/PaginationMeta'
          nullable: true
      type: object
      required:
        - result
      title: StandardResponse[PactPublicRead]
    WrappedValidationError:
      title: WrappedValidationError
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
          default: false
          title: Success
        error:
          type: object
          title: Error
          required:
            - detail
          properties:
            detail:
              type: array
              title: Detail
              items:
                $ref: '#/components/schemas/ValidationError'
    InlinePolicyCreate:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        type:
          $ref: '#/components/schemas/PolicyType'
          description: >-
            Policy category. Possible values: `transfer`, `contract_call`,
            `message_sign`.
        rules:
          additionalProperties: true
          type: object
          title: Rules
          description: >-
            Policy rule configuration. Structure depends on `type`; see the
            policy rules schema for each type.
        priority:
          type: integer
          title: Priority
          description: >-
            Evaluation priority. Higher values take precedence when multiple
            policies match.
          default: 0
        is_active:
          type: boolean
          title: Is Active
          description: 'Whether this policy is active. `true`: enforced. `false`: disabled.'
          default: true
      type: object
      required:
        - name
        - type
      title: InlinePolicyCreate
      description: Inline policy payload used during delegation/pact create.
    PactPublicRead:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Pact ID.
        owner_id:
          type: string
          format: uuid
          title: Owner Id
          description: Wallet owner principal ID.
        operator_id:
          type: string
          format: uuid
          title: Operator Id
          description: Operator agent principal ID.
        operator:
          $ref: '#/components/schemas/PrincipalRead'
          description: >-
            Operator principal. Null if the principal row is missing (e.g.
            legacy data).
          nullable: true
        wallet_id:
          type: string
          format: uuid
          title: Wallet Id
          description: Target wallet ID.
        name:
          type: string
          title: Name
          description: Pact name.
        intent:
          type: string
          title: Intent
          description: Natural language intent.
        original_intent:
          title: Original Intent
          description: >-
            Raw user input that originated this pact request. For multi-turn
            conversations, messages are concatenated.
          type: string
          nullable: true
        spec:
          $ref: '#/components/schemas/PactSpec-Output'
          description: The pact specification.
        status:
          $ref: '#/components/schemas/PactStatus'
          description: Current pact status.
        approval_id:
          title: Approval Id
          description: Linked approval ID.
          type: string
          format: uuid
          nullable: true
        api_key:
          title: Api Key
          description: Pact-scoped API key. Only visible to the operator.
          type: string
          nullable: true
        activated_at:
          title: Activated At
          description: When the pact became active.
          type: string
          format: date-time
          nullable: true
        expires_at:
          title: Expires At
          description: When the pact expires.
          type: string
          format: date-time
          nullable: true
        progress_tx_count:
          type: integer
          title: Progress Tx Count
          description: Number of transactions completed under this pact.
          default: 0
        progress_usd_spent:
          type: string
          title: Progress Usd Spent
          description: >-
            Cumulative USD value of transactions executed under this pact,
            represented as a decimal string (e.g. "12.50").
          default: '0'
        is_default:
          type: boolean
          title: Is Default
          description: Whether this is the default pact created during provisioning.
          default: false
        effective_policies:
          title: Effective Policies
          description: >-
            Current effective delegation-scoped policies. Populated when
            policies have been updated after pact creation; null means
            spec.policies is still the effective set.
          items:
            additionalProperties: true
            type: object
          type: array
          nullable: true
        recipe_slugs:
          title: Recipe Slugs
          description: Slugs of recipes associated with this pact.
          items:
            type: string
          type: array
          nullable: true
        recent_txs:
          title: Recent Txs
          description: >-
            Most recent transactions (up to 5) submitted under this pact, newest
            first. Null if none.
          items:
            $ref: '#/components/schemas/RecentTxSummary'
          type: array
          nullable: true
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the pact was submitted.
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Last update timestamp.
      type: object
      required:
        - id
        - owner_id
        - operator_id
        - wallet_id
        - name
        - intent
        - spec
        - status
        - created_at
        - updated_at
      title: PactPublicRead
      description: Public pact detail response without delegation internals.
    PaginationMeta:
      properties:
        total:
          title: Total
          type: integer
          nullable: true
        offset:
          title: Offset
          type: integer
          nullable: true
        limit:
          title: Limit
          type: integer
          nullable: true
        has_more:
          title: Has More
          type: boolean
          nullable: true
        after:
          title: After
          type: string
          nullable: true
        before:
          title: Before
          type: string
          nullable: true
      type: object
      title: PaginationMeta
      description: |-
        Pagination metadata for list responses.

        Supports both legacy offset-based and cursor-based pagination.
        Cursor fields (``has_more``, ``after``, ``before``) are populated for
        cursor-paginated endpoints.  Legacy fields (``offset``, ``limit``) are
        populated when the caller uses the deprecated ``offset`` parameter.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    PolicyType:
      type: string
      enum:
        - transfer
        - contract_call
        - message_sign
      title: PolicyType
      description: |-
        Supported policy categories.

        Subset of ``caw_types.transaction.UserTransactionOperationType`` —
        values are shared so UT operation_type strings can be compared directly
        against PolicyType. Deposit is excluded because deposits are not
        policy-gated.
    PrincipalRead:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: The principal ID.
        external_id:
          type: string
          title: External Id
          description: The external identifier for this principal.
        type:
          $ref: '#/components/schemas/PrincipalType'
          description: 'The principal type. Possible values: `human`, `agent`.'
        name:
          type: string
          title: Name
          description: The display name of this principal.
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: Arbitrary key-value metadata associated with the principal.
        is_temporary:
          type: boolean
          title: Is Temporary
          description: >-
            Deprecated legacy field. Temporary-agent mode has been retired and
            this value is always `false` for newly provisioned agents.
          default: false
          deprecated: true
        owner_principal_id:
          title: Owner Principal Id
          description: >-
            The ID of the human principal that owns this agent. Only set for
            agent principals.
          type: string
          format: uuid
          nullable: true
        onboarding_session_id:
          title: Onboarding Session Id
          description: The onboarding session ID associated with this principal, if set.
          type: string
          format: uuid
          nullable: true
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The timestamp when the principal was created, in ISO 8601 format.
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: >-
            The timestamp when the principal was last updated, in ISO 8601
            format.
      type: object
      required:
        - id
        - external_id
        - type
        - name
        - created_at
        - updated_at
      title: PrincipalRead
      description: Principal response payload.
    PactSpec-Output:
      properties:
        policies:
          items:
            $ref: '#/components/schemas/InlinePolicyCreate'
          type: array
          title: Policies
          description: Policy rules constraining the operator's actions.
        completion_conditions:
          items:
            $ref: '#/components/schemas/CompletionCondition'
          type: array
          title: Completion Conditions
          description: >-
            Conditions that trigger automatic pact completion (any-of
            semantics).
        execution_plan:
          title: Execution Plan
          description: >-
            Free-form execution plan derived from the intent, in markdown
            format. Presented to the owner during approval review so they can
            understand exactly what the operator will do. Suggested sections: #
            Summary, # Contract Operations, # Risk Controls, # Schedule.
          type: string
          nullable: true
      type: object
      title: PactSpec
      description: >-
        The core pact specification — defines policies and completion
        conditions.
    PactStatus:
      type: string
      enum:
        - pending_approval
        - active
        - rejected
        - completed
        - expired
        - revoked
        - withdrawn
      title: PactStatus
      description: Pact lifecycle states.
    RecentTxSummary:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Transaction UUID.
        request_id:
          title: Request Id
          description: Client-supplied request_id, if any.
          type: string
          nullable: true
        status:
          type: string
          title: Status
          description: Transaction status label (e.g. success, processing, failed).
        operation_type:
          type: string
          title: Operation Type
          description: Operation type (e.g. transfer, contract_call).
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the transaction was submitted.
      type: object
      required:
        - id
        - status
        - operation_type
        - created_at
      title: RecentTxSummary
      description: Compact transaction record for recent-activity enrichment.
    PrincipalType:
      type: string
      enum:
        - human
        - agent
      title: PrincipalType
      description: Principal types.
    CompletionCondition:
      properties:
        type:
          $ref: '#/components/schemas/CompletionConditionType'
          description: >-
            Condition type. Possible values: `time_elapsed` (seconds since
            activation), `tx_count` (transaction count), `amount_spent` (token
            amount), `amount_spent_usd` (USD value), `manual` (no automatic
            trigger).
        threshold:
          title: Threshold
          description: >-
            Threshold value that triggers completion. Required for all types
            except `manual`. Format varies by type: integer string for
            `tx_count`, decimal string for amounts, integer seconds for
            `time_elapsed`.
          type: string
          nullable: true
      type: object
      required:
        - type
      title: CompletionCondition
      description: A single completion condition within PactSpec.
    CompletionConditionType:
      type: string
      enum:
        - time_elapsed
        - tx_count
        - amount_spent
        - amount_spent_usd
        - manual
      title: CompletionConditionType
      description: Supported pact completion condition types.

````