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

# createSessions

> Learn how to use the createSessions JSON-RPC method.

## Contextualizing `createSessions`

* `createSessions` will generate transactions (or UserOperation objects and hashes, according to the fee payment mechanism) for initializing a session key within predefined parameters. It takes:
  * Account config object:
    * `name` - string.
    * `version` - string.
    * `ownerAddress` - string.
    * `biconomyApiKey` - (optional), string. It should only be used if you'd like to use a Biconomy Paymaster.
  * Array of sessions:
    * Session object:
      * `validUntil` - integer.
      * `validAfter` - integer.
      * `sessionValidationModule` - string.
      * `sessionKeyDataInAbi` (alternative: `sessionKeyData`) - array.

***

## Query example

```json JSON theme={null}
{
    "chainId": 80001,
    "jsonrpc": "2.0",
    "id": "f7423e6b-0f69-4b96-8d1e-dcd485f8c2eb",
    "method": "particle_aa_createSessions",
    "params": [
        { "name": "BICONOMY", "version": "2.0.0", "ownerAddress": "0xc19dd1f3e212b39a30036EF3DE3F83dEf5a66E41" },
        [
            {
                "validUntil": 0,
                "validAfter": 0,
                "sessionValidationModule": "0x4b7f018Fa27a97b6a17b6d4d8Cb3c0e2D9340133",
                "sessionKeyDataInAbi": [ // or use sessionKeyData to replace
                    ["address", "address", "address", "uint256"],
                    [
                        "0x1dacDa1087C4048774bEce7784EB8EC4CfBeDB2c",
                        "0x909E30bdBCb728131E3F8d17150eaE740C904649",
                        "0x11D266772b85C2C5D4f84A41ca3E08e9f04Fb5D3",
                        1
                    ]
                ]
            }
        ]
    ]
}
```


## OpenAPI

````yaml openapi-aa POST /#particle_aa_createSessions
openapi: 3.0.0
info:
  title: Particle Network Account Abstraction RPC
  version: 1.0.0
servers:
  - url: https://rpc.particle.network/evm-chain
security:
  - BasicAuth: []
paths:
  /#particle_aa_createSessions:
    post:
      summary: createSessions
      operationId: particle_aa_createSessions
      requestBody:
        description: Request to create sessions.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSessionsRequest'
      responses:
        '200':
          description: Successful response with created session details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSessionsResponse'
components:
  schemas:
    CreateSessionsRequest:
      allOf:
        - $ref: '#/components/schemas/RPCRequest'
        - type: object
          properties:
            method:
              enum:
                - particle_aa_createSessions
            params:
              type: array
              description: Parameters for creating sessions.
              items:
                type: object
                oneOf:
                  - properties:
                      name:
                        type: string
                        description: Session name.
                        example: Example Session
                      version:
                        type: string
                        description: Session version.
                        example: '1.0'
                      ownerAddress:
                        type: string
                        description: Owner address.
                        example: 0xOwnerAddress
                  - type: array
                    items:
                      type: object
                      properties:
                        validUntil:
                          type: integer
                          description: Session validity end timestamp.
                          example: 1700000000
                        validAfter:
                          type: integer
                          description: Session validity start timestamp.
                          example: 1600000000
                        sessionValidationModule:
                          type: string
                          description: Session validation module.
                          example: 0xValidationModule
                        sessionKeyDataInAbi:
                          type: array
                          description: Session key data in ABI format.
                          items:
                            oneOf:
                              - type: array
                                items:
                                  type: string
                              - type: array
                                items:
                                  type: string
    CreateSessionsResponse:
      allOf:
        - $ref: '#/components/schemas/RPCResponse'
        - type: object
          properties:
            result:
              type: object
              properties:
                verifyingPaymasterGasless:
                  type: object
                  description: Gasless fee quote.
                verifyingPaymasterNative:
                  type: object
                  description: Native token fee quote.
                tokenPaymaster:
                  type: object
                  description: Token fee quote.
                sessions:
                  type: array
                  description: Array of session objects.
                  items:
                    type: object
                transactions:
                  type: array
                  description: Array of transaction objects.
                  items:
                    type: object
    RPCRequest:
      type: object
      required:
        - jsonrpc
        - id
        - method
        - params
      properties:
        jsonrpc:
          type: string
          default: '2.0'
          description: Version of the JSON-RPC protocol, should be 2.0.
          example: '2.0'
        id:
          type: integer
          default: 1
          description: The request identifier.
          example: 1
        method:
          type: string
          description: API method being called.
        params:
          type: array
          description: Parameters for the API method call.
    RPCResponse:
      type: object
      required:
        - jsonrpc
        - id
        - result
      properties:
        jsonrpc:
          type: string
          default: '2.0'
          description: Version of the JSON-RPC protocol, should be 2.0.
          example: '2.0'
        id:
          type: integer
          default: 1
          description: The request identifier.
          example: 1
        result:
          anyOf:
            - $ref: '#/components/schemas/AnyValue'
        chainId:
          type: integer
          description: The blockchain chain ID.
          example: 80001
    AnyValue:
      anyOf:
        - type: string
        - type: number
        - type: integer
        - type: boolean
        - type: object
        - type: array
          items: {}
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic

````