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

# updatePolicy

> Updates an existing sponsorship policy based on the provided information.

Example values you can use to demo the API:

```json theme={null}
{
    "id": "1",
    "walletAddress": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
    "name": "Sample Policy",
    "description": "This is a sample policy modified",
    "isPublic": true,
    "isEnabled": true,
    "isApplicableToAllNetworks": false,
    "enabledChains": [
        80002
    ],
    "supportedEPVersions": ["EPV_06", "EPV_07"],
    "isPerpetual": false,
    "startTime": "2024-06-26T00:40:00.000Z",
    "endTime": "2024-06-27T23:59:59.999Z",
    "globalMaximumApplicable": true,
    "globalMaximumUsd": 6000,
    "globalMaximumNative": 2000,
    "globalMaximumOpCount": 1000,
    "perUserMaximumApplicable": true,
    "perUserMaximumUsd": 100,
    "perUserMaximumNative": 200,
    "perUserMaximumOpCount": 50,
    "perOpMaximumApplicable": true,
    "perOpMaximumUsd": 10,
    "perOpMaximumNative": 20
}
```

Example response:

```json theme={null}
{
    "createdAt": "2024-06-30T17:39:26.938Z",
    "updatedAt": "2024-06-30T17:39:26.939Z",
    "id": 5,
    "walletAddress": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
    "name": "Sample Policy",
    "description": "This is a sample policy",
    "isPublic": true,
    "isEnabled": true,
    "isApplicableToAllNetworks": false,
    "enabledChains": [
        80002
    ],
    "supportedEPVersions": [
        "EPV_06",
        "EPV_07"
    ],
    "isPerpetual": false,
    "startTime": "2024-06-26T00:40:00.000Z",
    "endTime": "2024-06-27T23:59:59.999Z",
    "globalMaximumApplicable": true,
    "globalMaximumUsd": "5000.0000",
    "globalMaximumNative": "1000.000000000000000000",
    "globalMaximumOpCount": 1000,
    "perUserMaximumApplicable": true,
    "perUserMaximumUsd": "100.0000",
    "perUserMaximumNative": "200.000000000000000000",
    "perUserMaximumOpCount": 50,
    "perOpMaximumApplicable": true,
    "perOpMaximumUsd": "10.0000",
    "perOpMaximumNative": "20.000000000000000000",
    "addressAllowList": null,
    "addressBlockList": null
}
```


## OpenAPI

````yaml arka put /updatePolicy
openapi: 3.0.3
info:
  title: Etherspot Arka Paymaster API
  version: 3.1.3
servers:
  - url: https://rpc.etherspot.io/paymaster
security: []
tags:
  - name: Arka
    externalDocs:
      description: Find out more about Arka
      url: https://etherspot.fyi/arka
externalDocs:
  description: Find out more about Arka
  url: https://etherspot.fyi/arka
paths:
  /updatePolicy:
    put:
      summary: updatePolicy
      description: >-
        Updates an existing sponsorship policy based on the provided
        information.
      parameters:
        - in: header
          name: apikey
          required: true
          schema:
            type: string
          description: API key for authentication
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSponsorshipPolicyRequest'
      responses:
        '200':
          description: Successfully updated the sponsorship policy
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateSponsorshipPolicyResponse'
        '400':
          description: >-
            Bad Request - Invalid sponsorship policy ID or API key does not
            exist for the wallet address
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: >-
                      Invalid sponsorship policy ID or API key does not exist
                      for the wallet address
        '401':
          description: Not Authorized - Wallet address does not match for the API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Wallet address does not match for the API key
        '403':
          description: Forbidden - Sponsorship policy is disabled
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Sponsorship policy is disabled
        '404':
          description: Not Found - Sponsorship policy not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Sponsorship policy not found
        '500':
          description: Internal Server Error - Failed to update sponsorship policy
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Failed to update sponsorship policy
components:
  schemas:
    UpdateSponsorshipPolicyRequest:
      type: object
      properties:
        id:
          type: integer
          description: ID of the policy
        walletAddress:
          type: string
          description: The wallet address associated with the API key
        name:
          type: string
          description: Name of the sponsorship policy
        description:
          type: string
          description: Description of the sponsorship policy
        isPublic:
          type: boolean
          description: Flag to indicate if the policy is public
        isEnabled:
          type: boolean
          description: Flag to indicate if the policy is enabled
        isApplicableToAllNetworks:
          type: boolean
          description: Flag to indicate if the policy is universal
        enabledChains:
          type: array
          items:
            type: integer
          description: Array of enabled chain IDs
        supportedEPVersions:
          type: array
          items:
            type: string
          description: Array of supported entry point versions
        isPerpetual:
          type: boolean
          description: Flag to indicate if the policy is perpetual
        startTime:
          type: string
          format: date-time
          nullable: true
          description: Optional start date for the policy
        endTime:
          type: string
          format: date-time
          nullable: true
          description: Optional end date for the policy
        globalMaximumApplicable:
          type: boolean
          description: Flag to indicate if the global maximum is applicable
        globalMaximumUsd:
          type: number
          nullable: true
          description: Optional global maximum USD limit
        globalMaximumNative:
          type: number
          nullable: true
          description: Optional global maximum native limit
        globalMaximumOpCount:
          type: number
          nullable: true
          description: Optional global maximum operation count
        perUserMaximumApplicable:
          type: boolean
          description: Flag to indicate if the per user maximum is applicable
        perUserMaximumUsd:
          type: number
          nullable: true
          description: Optional per user maximum USD limit
        perUserMaximumNative:
          type: number
          nullable: true
          description: Optional per user maximum native limit
        perUserMaximumOpCount:
          type: number
          description: Optional per user maximum operation count
        perOpMaximumApplicable:
          type: boolean
          description: Flag to indicate if the per operation maximum is applicable
        perOpMaximumUsd:
          type: number
          nullable: true
          description: Optional per operation maximum USD limit
        perOpMaximumNative:
          type: number
          nullable: true
          description: Optional per operation maximum native limit
        addressAllowList:
          type: array
          items:
            type: string
          nullable: true
          description: Optional array of allowed addresses
        addressBlockList:
          type: array
          items:
            type: string
          nullable: true
          description: Optional array of blocked addresses
        isExpired:
          type: boolean
          description: Flag to indicate if the policy is expired
        isCurrent:
          type: boolean
          description: Flag to indicate if the policy is current
        isApplicable:
          type: boolean
          description: Flag to indicate if the policy is applicable
        createdAt:
          type: string
          format: date-time
          description: Date the policy was created
        updatedAt:
          type: string
          format: date-time
          description: Date the policy was last updated
    UpdateSponsorshipPolicyResponse:
      $ref: '#/components/schemas/UpdateSponsorshipPolicyRequest'

````