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

# addPolicy

> Creates a new policy with the provided details.

Example values you can use to demo the API:

```json theme={null}
{
    "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,
    "globalMaximumNative": 1000,
    "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 post /addPolicy
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:
  /addPolicy:
    post:
      summary: addPolicy
      description: Creates a new policy with the provided details.
      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/AddPolicyRequest'
      responses:
        '201':
          description: Policy created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SponsorshipPolicy'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: API key is required in header
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Wallet address does not match for the API key
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Failed to create sponsorship policy
components:
  schemas:
    AddPolicyRequest:
      type: object
      properties:
        walletAddress:
          type: string
          example: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
        name:
          type: string
          example: Sample Policy
        description:
          type: string
          example: This is a sample policy
        isPublic:
          type: boolean
        isEnabled:
          type: boolean
        isApplicableToAllNetworks:
          type: boolean
        enabledChains:
          type: array
          items:
            type: integer
        supportedEPVersions:
          type: array
          items:
            type: string
        isPerpetual:
          type: boolean
        startTime:
          type: string
          format: date-time
        endTime:
          type: string
          format: date-time
        globalMaximumApplicable:
          type: boolean
        globalMaximumUsd:
          type: number
        globalMaximumNative:
          type: number
        globalMaximumOpCount:
          type: number
        perUserMaximumApplicable:
          type: boolean
        perUserMaximumUsd:
          type: number
        perUserMaximumNative:
          type: number
        perUserMaximumOpCount:
          type: number
        perOpMaximumApplicable:
          type: boolean
        perOpMaximumUsd:
          type: number
        perOpMaximumNative:
          type: number
      required:
        - walletAddress
        - name
        - isPublic
        - isEnabled
    SponsorshipPolicy:
      type: object
      properties:
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        id:
          type: integer
        walletAddress:
          type: string
        name:
          type: string
        description:
          type: string
        isPublic:
          type: boolean
        isEnabled:
          type: boolean
        isApplicableToAllNetworks:
          type: boolean
        enabledChains:
          type: array
          items:
            type: integer
        supportedEPVersions:
          type: array
          items:
            type: string
        isPerpetual:
          type: boolean
        startTime:
          type: string
          format: date-time
        endTime:
          type: string
          format: date-time
        globalMaximumApplicable:
          type: boolean
        globalMaximumUsd:
          type: string
        globalMaximumNative:
          type: string
        globalMaximumOpCount:
          type: integer
        perUserMaximumApplicable:
          type: boolean
        perUserMaximumUsd:
          type: string
        perUserMaximumNative:
          type: string
        perUserMaximumOpCount:
          type: integer
        perOpMaximumApplicable:
          type: boolean
        perOpMaximumUsd:
          type: string
        perOpMaximumNative:
          type: string
        addressAllowList:
          type: array
          items:
            type: string
          nullable: true
        addressBlockList:
          type: array
          items:
            type: string
          nullable: true

````