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

# Attestation

> Evaluate a transaction against configured policy and return an attestation (chain-name based, supports EVM and Solana)

Request a compliance attestation for a user. The API evaluates the user against your configured policy and returns a signed attestation.

## Request Parameters

| Field               | Type   | Required    | Description                                                                    |
| ------------------- | ------ | ----------- | ------------------------------------------------------------------------------ |
| `from`              | string | Yes         | User's wallet address to evaluate                                              |
| `chain`             | string | Yes         | Chain name (see supported chains below)                                        |
| `verification_hash` | string | Conditional | Your project identifier from the dashboard. Required for offchain integration. |
| `to`                | string | Conditional | Your contract address. Required for onchain integration.                       |
| `data`              | string | No          | Encoded function call data. Required when using `PredicateClient`.             |
| `msg_value`         | string | No          | Transaction value in wei. Required when using `PredicateClient`.               |

<Note>
  Use `verification_hash` for offchain integration (Phase 1). Use `to` with your contract address for onchain integration (Phase 2).
</Note>

## Supported Chains

| Chain           | Value             |
| --------------- | ----------------- |
| Ethereum        | `ethereum`        |
| Base            | `base`            |
| Arbitrum        | `arbitrum`        |
| Hyperliquid     | `hyperliquid`     |
| Plume           | `plume`           |
| BSC             | `bsc`             |
| Plasma          | `plasma`          |
| World           | `worldchain`      |
| Sepolia         | `sepolia`         |
| Solana          | `solana`          |
| MegaETH         | `megaeth`         |
| MegaETH Testnet | `megaeth-testnet` |

***

<Tabs>
  <Tab title="Interface-only">
    Use `verification_hash` to evaluate compliance without a deployed contract.

    #### Request

    ```bash cURL theme={null}
    curl -X POST "https://api.predicate.io/v2/attestation" \
      -H "Content-Type: application/json" \
      -H "x-api-key: $PREDICATE_API_KEY" \
      -d '{
        "verification_hash": "x-abc123def456",
        "from": "0x8ba1f109551bD432803012645Hac136c",
        "chain": "ethereum"
      }'
    ```

    #### Response (Compliant)

    ```json theme={null}
    {
      "policy_id": "policy_abc123def456",
      "policy_name": "Standard AML Compliance",
      "verification_hash": "x-abc123def456",
      "is_compliant": true,
      "attestation": {
        "uuid": "550e8400-e29b-41d4-a716-446655440000",
        "expiration": 1696640400,
        "attester": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
        "signature": "0x1b2c3d4e..."
      }
    }
    ```

    #### Response (Non-Compliant)

    Some policies return a `reason` object when the user is not compliant, providing a machine-readable code and a human-readable message explaining why the evaluation failed. Both the `code` and `message` values are fully customizable when authoring a policy.

    ```json theme={null}
    {
      "policy_id": "x-dev-trm-risk-abc123",
      "policy_name": "TRM Risk Score",
      "verification_hash": "x-abc123def456",
      "is_compliant": false,
      "attestation": {
        "uuid": "550e8400-e29b-41d4-a716-446655440000",
        "expiration": 0,
        "attester": "",
        "signature": ""
      },
      "reason": {
        "code": "trm_high_risk",
        "message": "TRM risk score is 10 which exceeds the maximum allowed of 7"
      }
    }
    ```
  </Tab>

  <Tab title="Onchain Enforcement">
    Use `to` with your contract address or program ID for onchain enforcement.

    <Tabs>
      <Tab title="EVM">
        #### Request (BasicPredicateClient)

        ```bash cURL theme={null}
        curl -X POST "https://api.predicate.io/v2/attestation" \
          -H "Content-Type: application/json" \
          -H "x-api-key: $PREDICATE_API_KEY" \
          -d '{
            "to": "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6",
            "from": "0x8ba1f109551bD432803012645Hac136c",
            "chain": "base"
          }'
        ```

        #### Request (PredicateClient)

        Include `data` and `msg_value` for policies that validate function calls.

        ```bash cURL theme={null}
        curl -X POST "https://api.predicate.io/v2/attestation" \
          -H "Content-Type: application/json" \
          -H "x-api-key: $PREDICATE_API_KEY" \
          -d '{
            "to": "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6",
            "from": "0x8ba1f109551bD432803012645Hac136c",
            "data": "0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d4c9db96c4b4d8b6",
            "msg_value": "0",
            "chain": "base"
          }'
        ```

        #### Response

        ```json theme={null}
        {
          "policy_id": "policy_abc123def456",
          "policy_name": "Standard AML Compliance",
          "verification_hash": "x-abc123def456",
          "is_compliant": true,
          "attestation": {
            "uuid": "550e8400-e29b-41d4-a716-446655440000",
            "expiration": 1696640400,
            "attester": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
            "signature": "0x1b2c3d4e..."
          }
        }
        ```
      </Tab>

      <Tab title="SVM">
        #### Request

        ```bash cURL theme={null}
        curl -X POST "https://api.predicate.io/v2/attestation" \
          -H "Content-Type: application/json" \
          -H "x-api-key: $PREDICATE_API_KEY" \
          -d '{
            "to": "5iejgxCq2vnpiwWpf4qwziVhbX2irmgMEghBrD9tmk5p",
            "from": "8SfpAAUkA4E1ZTSzXiAR51f1iGuVQU4r7kiNUxh7GpVM",
            "chain": "solana"
          }'
        ```

        #### Response

        ```json theme={null}
        {
          "policy_id": "policy_abc123def456",
          "policy_name": "Standard AML Compliance",
          "verification_hash": "x-abc123def456",
          "is_compliant": true,
          "attestation": {
            "uuid": "550e8400-e29b-41d4-a716-446655440000",
            "expiration": 1696640400,
            "attester": "8SfpAAUkA4E1ZTSzXiAR51f1iGuVQU4r7kiNUxh7GpVM",
            "signature": "0x5e4f..."
          }
        }
        ```
      </Tab>
    </Tabs>
  </Tab>
</Tabs>

## Response Fields

| Field                    | Type    | Description                                                                                                 |
| ------------------------ | ------- | ----------------------------------------------------------------------------------------------------------- |
| `policy_id`              | string  | Unique identifier for the policy                                                                            |
| `policy_name`            | string  | Human-readable policy name                                                                                  |
| `verification_hash`      | string  | Project identifier                                                                                          |
| `is_compliant`           | boolean | Whether the user passed the policy evaluation                                                               |
| `attestation`            | object  | Signed attestation to submit onchain                                                                        |
| `attestation.uuid`       | string  | Unique identifier for replay protection                                                                     |
| `attestation.expiration` | number  | Unix timestamp when the attestation expires                                                                 |
| `attestation.attester`   | string  | Address of the Predicate attester                                                                           |
| `attestation.signature`  | string  | Cryptographic signature                                                                                     |
| `reason`                 | object  | Present on non-compliant responses when the policy provides a reason. Not included for compliant responses. |
| `reason.code`            | string  | Machine-readable error code defined by the policy                                                           |
| `reason.message`         | string  | Human-readable explanation of why the evaluation failed                                                     |


## OpenAPI

````yaml POST /v2/attestation
openapi: 3.0.1
info:
  title: Predicate API
  description: API for sending Ethereum-like transactions to the Predicate network.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.predicate.io
security:
  - ApiKeyAuth: []
paths:
  /v2/attestation:
    post:
      description: >-
        Evaluate a transaction against configured policy and return an
        attestation (chain-name based, supports EVM and Solana)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/V2AttestationRequest'
            examples:
              interface-only:
                summary: Interface-only request
                value:
                  verification_hash: x-abc123def456
                  from: 0x8ba1f109551bD432803012645Hac136c
                  chain: ethereum
              evm:
                summary: EVM onchain request
                value:
                  to: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6'
                  from: 0x8ba1f109551bD432803012645Hac136c
                  chain: base
              svm:
                summary: Solana onchain request
                value:
                  to: 5iejgxCq2vnpiwWpf4qwziVhbX2irmgMEghBrD9tmk5p
                  from: 8SfpAAUkA4E1ZTSzXiAR51f1iGuVQU4r7kiNUxh7GpVM
                  chain: solana
      responses:
        '200':
          description: Successfully evaluated and returned attestation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2AttestationResponse'
components:
  schemas:
    V2AttestationRequest:
      type: object
      description: >-
        Transaction details to evaluate for policy compliance and to issue a
        chain-appropriate attestation.
      properties:
        from:
          type: string
          description: >-
            End user's wallet address initiating the transaction. This field is
            used for policy enforcement and compliance checks.
        chain:
          type: string
          description: 'Target blockchain name. Examples: ethereum, sepolia, base, solana.'
        verification_hash:
          type: string
          description: >-
            Your project identifier from the dashboard. Required for
            interface-only integration. Use this OR 'to', not both.
        to:
          type: string
          description: >-
            Your deployed contract or program address. Required for onchain
            enforcement. Use this OR 'verification_hash', not both.
        data:
          type: string
          description: >-
            Encoded transaction payload. Required when using PredicateClient for
            function call validation.
        msg_value:
          type: string
          description: >-
            Native token amount (wei for EVM, lamports for Solana). Required
            when using PredicateClient.
        user_ip:
          type: string
          description: End-user IP address for geolocation-based policy evaluation.
      required:
        - from
        - chain
    V2AttestationResponse:
      type: object
      description: Evaluation result and attestation payload to embed onchain.
      properties:
        policy_id:
          type: string
          description: Identifier of the evaluated policy.
        policy_name:
          type: string
          description: >-
            Human-readable display name of the policy as configured in the
            dashboard.
        verification_hash:
          type: string
          description: >-
            Unique value used to prove contract ownership by setting it as the
            onchain policyID during onboarding.
        is_compliant:
          type: boolean
          description: True if the request satisfied the configured policy.
        attestation:
          type: object
          description: Chain‑appropriate attestation fields for onchain verification.
          properties:
            uuid:
              type: string
              description: Attestation identifier (UUID v4).
            expiration:
              type: integer
              format: int64
              description: Expiration time as Unix timestamp (seconds).
            attester:
              type: string
              description: Attester public key or address.
            signature:
              type: string
              description: >-
                Hex-encoded cryptographic signature over the attestation
                payload. Always 0x-prefixed.
        reason:
          type: object
          description: >-
            Present on non-compliant responses when the policy provides a
            reason. Not included for compliant responses.
          properties:
            code:
              type: string
              description: Machine-readable error code defined by the policy.
            message:
              type: string
              description: Human-readable explanation of why the evaluation failed.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````