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

# settle



## OpenAPI

````yaml POST /settle
openapi: 3.1.0
info:
  title: Algen API
  description: Some important api listed in there
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://asdo.algen.network
security: []
paths:
  /settle:
    post:
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                properties:
                  x402Version:
                    $ref: '#/components/schemas/X402Version'
                  paymentPayload:
                    $ref: '#/components/schemas/x402PaymentPayload'
                  paymentRequirements:
                    $ref: '#/components/schemas/x402PaymentRequirements'
                required:
                  - x402Version
                  - paymentPayload
                  - paymentRequirements
            examples:
              example:
                value:
                  x402Version: 1
                  paymentPayload:
                    x402Version: 1
                    scheme: exact
                    network: mesherX
                    payload:
                      signature: >-
                        0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480
                      authorization:
                        from: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                        to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                        value: '1000000000000000000'
                        validAfter: '1716150000'
                        validBefore: '1716150000'
                        nonce: '0x1234567890abcdef1234567890abcdef12345678'
                  paymentRequirements:
                    scheme: exact
                    network: mesherX
                    maxAmountRequired: '1000000'
                    resource: https://api.example.com/premium/resource/123
                    description: Premium API access for data analysis
                    mimeType: application/json
                    outputSchema:
                      data: string
                    payTo: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                    maxTimeoutSeconds: 10
                    asset: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                    extra:
                      gasLimit: '1000000'
      responses:
        '200':
          description: Successfully settled payment on the x402 protocol.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    success:
                      type: boolean
                      description: Indicates whether the payment settlement is successful.
                      example: false
                    errorReason:
                      $ref: '#/components/schemas/x402SettleErrorReason'
                    payer:
                      type: string
                      description: >-
                        The onchain address of the client paying for the
                        resource.
                      pattern: >-
                        ^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
                      example: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                    transaction:
                      type: string
                      description: The settlement transaction hash.
                      pattern: >-
                        ^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
                      example: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                    network:
                      type: string
                      description: The network where settlement occurred.
                      example: mesherX
                  required:
                    - success
                    - payer
                    - transaction
                    - network
              examples:
                example:
                  value:
                    success: false
                    errorReason: insufficient_funds
                    payer: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                    transaction: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
                    network: mesherX
        '400':
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      servers:
        - url: https://x402.algen.network/facilitator
          description: POST to settle x402 payments.
components:
  schemas:
    X402Version:
      type: integer
      description: The version of the x402 protocol.
      enum:
        - 1
      example: 1
    x402PaymentPayload:
      type: object
      description: The x402 protocol payment payload attached to X-PAYMENT header.
      properties:
        x402Version:
          $ref: '#/components/schemas/X402Version'
        scheme:
          type: string
          enum:
            - exact
          example: exact
        network:
          type: string
          enum:
            - mesherX
            - mesherX-testnet
          example: mesherX
        payload:
          type: object
          oneOf:
            - $ref: '#/components/schemas/x402ExactEvmPayload'
          example:
            signature: '0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480'
            authorization:
              from: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
              to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
              value: '1000000000000000000'
              validAfter: '1716150000'
              validBefore: '1716150000'
              nonce: '0x1234567890abcdef1234567890abcdef12345678'
      required:
        - x402Version
        - scheme
        - network
        - payload
      example:
        x402Version: 1
        scheme: exact
        network: mesherX
        payload:
          signature: '0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480'
          authorization:
            from: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
            to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
            value: '1000000000000000000'
            validAfter: '1716150000'
            validBefore: '1716150000'
            nonce: '0x1234567890abcdef1234567890abcdef12345678'
    x402PaymentRequirements:
      type: object
      description: The payment requirements expected by the resource server.
      properties:
        scheme:
          type: string
          enum:
            - exact
          example: exact
        network:
          type: string
          enum:
            - mesherX
            - mesherX-testnet
          example: mesherX
        maxAmountRequired:
          type: string
          example: '1000000'
        resource:
          $ref: '#/components/schemas/Url'
          example: https://api.example.com/premium/resource/123
        description:
          type: string
          example: Premium API access for data analysis
        mimeType:
          type: string
          example: application/json
        outputSchema:
          type: object
          additionalProperties: true
          example:
            data: string
        payTo:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
          example: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
        maxTimeoutSeconds:
          type: integer
          example: 10
        asset:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
          example: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
        extra:
          type: object
          additionalProperties: true
          example:
            gasLimit: '1000000'
      required:
        - scheme
        - network
        - maxAmountRequired
        - resource
        - description
        - mimeType
        - payTo
        - asset
        - maxTimeoutSeconds
    x402SettleErrorReason:
      type: string
      description: The reason the payment settlement errored on the x402 protocol.
      enum:
        - insufficient_funds
        - invalid_scheme
        - invalid_network
        - invalid_x402_version
        - invalid_payment_requirements
        - invalid_payload
        - invalid_exact_evm_payload_authorization_value
        - invalid_exact_evm_payload_authorization_valid_after
        - invalid_exact_evm_payload_authorization_valid_before
        - invalid_exact_evm_payload_authorization_typed_data_message
        - invalid_exact_evm_payload_authorization_from_address_kyt
        - invalid_exact_evm_payload_authorization_to_address_kyt
        - invalid_exact_evm_payload_signature_address
        - settle_exact_svm_block_height_exceeded
        - settle_exact_svm_transaction_confirmation_timed_out
      example: insufficient_funds
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    x402ExactEvmPayload:
      type: object
      title: x402ExactEvmPayload
      description: >-
        The x402 protocol exact scheme payload for EVM networks. Implemented
        using ERC-3009.
      properties:
        signature:
          type: string
          description: >-
            The EIP-712 hex-encoded signature of the ERC-3009 authorization
            message.
          example: '0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480'
        authorization:
          type: object
          description: The authorization data for the ERC-3009 message.
          properties:
            from:
              type: string
              pattern: ^0x[0-9a-fA-F]{40}$
              description: 0x-prefixed, checksum EVM address of the sender.
              example: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
            to:
              type: string
              pattern: ^0x[0-9a-fA-F]{40}$
              description: 0x-prefixed, checksum EVM address of the recipient.
              example: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
            value:
              type: string
              description: Value of the payment in atomic units.
              example: '1000000000000000000'
            validAfter:
              type: string
              description: Unix timestamp after which payment is valid.
              example: '1716150000'
            validBefore:
              type: string
              description: Unix timestamp before which payment is valid.
              example: '1716150000'
            nonce:
              type: string
              description: Hex-encoded nonce of the payment.
              example: '0x1234567890abcdef1234567890abcdef12345678'
          required:
            - from
            - to
            - value
            - validAfter
            - validBefore
            - nonce
          example:
            from: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
            to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
            value: '1000000000000000000'
            validAfter: '1716150000'
            validBefore: '1716150000'
            nonce: '0x1234567890abcdef1234567890abcdef12345678'
      required:
        - signature
        - authorization
      example:
        signature: '0xf3746613c2d920b5fdabc0856f2aeb2d4f88ee6037b8cc5d04a71a4462f13480'
        authorization:
          from: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
          to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
          value: '1000000000000000000'
          validAfter: '1716150000'
          validBefore: '1716150000'
          nonce: '0x1234567890abcdef1234567890abcdef12345678'
    Url:
      type: string
      format: uri
      minLength: 11
      maxLength: 2048
      pattern: ^https://.*$
      description: A valid HTTPS URL.
      example: https://example.com

````