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

# Sign a serialized EVM transaction with the agent's EVM key

> Needs `native.evm.sign_transaction`, which gives full control of the EVM address. Nothing is broadcast; the caller sends the signed transaction. Requires `X-Grant-Token` for a live grant and is refused while the agent is frozen; `destinations`, `budget`, `timelock_ms`, `schedule` and `owner_approval` do not apply. Recorded in history as type `native`. Wherever `X-Grant-Token` is required, a `public_key` grant may send `X-Grant-Proof` instead (never both): a JWT its key signs for this grant ID and request (URL, method, body and Idempotency-Key). The proof is spent on first use. A retry signs a new proof for the same grant ID and Idempotency-Key. A refused proof reads `grant_proof_invalid`.



## OpenAPI

````yaml https://api.agentsonintents.com/openapi.json post /v1/agents/{agent_id}/native/evm/sign-transaction
openapi: 3.1.0
info:
  title: NEAR Intents Agent API
  version: 1.0.0
  description: >-
    Backend API for AI agents that trade on NEAR Intents under an owner-signed
    policy.


    The Agent API is an experimental, mainnet-only beta. You and your users may
    lose all assets used with it, or lose access to them. It is operated by NEAR
    Technologies Limited.


    Before an owner signs `agent_create`, show the Owner Terms, OutLayer's terms
    and the required risk notice, and keep evidence of acceptance. Show the
    notice again before the owner funds the wallet. `preview.summary` ends with
    the notice.


    Authenticate with `X-API-Key`. Create and revoke keys at
    partners.near-intents.org; each expires after 365 days. Keep the key on your
    backend.


    Owner actions use generate-intent → owner wallet signs `intent.payload`
    unchanged → submit-intent → GET /v1/status. Agent actions (swap, withdraw,
    transfer, …) need no owner signature, only `X-Grant-Token` for a live owner
    grant (who may act), or `X-Grant-Proof` signed by a `public_key` grant's key
    for each request; the account policy decides what every grant may do, and
    return a `correlation_id` for GET /v1/status.


    The agent's account is its confidential balance: swaps, limit orders,
    transfers, deposit addresses, withdrawals and balance reads use it by
    default. The legacy public balance can only be emptied, by shield or a
    withdrawal with `confidential: false`; any other request on it is refused
    with `public_balance_exit_only`.


    Errors are JSON:API documents. Every field, parameter and error code is
    snake_case. Branch on `errors[].code`, never on `title`. `UNCERTAIN` means
    the outcome is not yet proven: keep polling the same `correlation_id` and
    never resubmit under a new `Idempotency-Key`. `PENDING_DEPOSIT` is a deposit
    address waiting for funds; a withdrawal's bridge leg reads `PROCESSING`.
    `NEEDS_REVIEW` stops routine polling: inspect `details.reason`, never retry,
    then use `refresh=true` after provider/manual resolution.
servers:
  - url: https://api.agentsonintents.com
security: []
tags:
  - name: Owner intents
  - name: Status
  - name: Agents
  - name: Policy
  - name: Grants
  - name: Approvals
  - name: Executions
  - name: Native accounts
  - name: Meta
paths:
  /v1/agents/{agent_id}/native/evm/sign-transaction:
    post:
      tags:
        - Native accounts
      summary: Sign a serialized EVM transaction with the agent's EVM key
      description: >-
        Needs `native.evm.sign_transaction`, which gives full control of the EVM
        address. Nothing is broadcast; the caller sends the signed transaction.
        Requires `X-Grant-Token` for a live grant and is refused while the agent
        is frozen; `destinations`, `budget`, `timelock_ms`, `schedule` and
        `owner_approval` do not apply. Recorded in history as type `native`.
        Wherever `X-Grant-Token` is required, a `public_key` grant may send
        `X-Grant-Proof` instead (never both): a JWT its key signs for this grant
        ID and request (URL, method, body and Idempotency-Key). The proof is
        spent on first use. A retry signs a new proof for the same grant ID and
        Idempotency-Key. A refused proof reads `grant_proof_invalid`.
      operationId: nativeEvmSignTransaction
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[0-9a-f]{64}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                chain:
                  type: string
                  enum:
                    - ethereum
                    - polygon
                    - base
                    - arbitrum
                    - optimism
                    - bsc
                    - avalanche
                    - hyperevm
                    - hood
                unsigned_tx:
                  type: string
                  maxLength: 262144
                  pattern: ^0x[0-9a-fA-F]+$
              required:
                - chain
                - unsigned_tx
              additionalProperties: false
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  correlation_id:
                    type: string
                    pattern: ^op_[A-Za-z0-9_-]{43}$
                  chain:
                    type: string
                    enum:
                      - near
                      - ethereum
                      - polygon
                      - base
                      - arbitrum
                      - optimism
                      - bsc
                      - avalanche
                      - hyperevm
                      - hood
                      - solana
                  account_id:
                    type: string
                  signature:
                    type: string
                required:
                  - correlation_id
                  - chain
                  - account_id
                  - signature
                additionalProperties: false
        '400':
          description: >-
            Error document. Documented codes: `agent_grant_required`,
            `grant_proof_invalid`, `policy_not_ready`, `native_method_denied`,
            `authorization_stale`, `wallet_frozen`, `rate_limited`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDocument'
        '401':
          description: >-
            Error document. Documented codes: `agent_grant_required`,
            `grant_proof_invalid`, `policy_not_ready`, `native_method_denied`,
            `authorization_stale`, `wallet_frozen`, `rate_limited`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDocument'
        '403':
          description: >-
            Error document. Documented codes: `agent_grant_required`,
            `grant_proof_invalid`, `policy_not_ready`, `native_method_denied`,
            `authorization_stale`, `wallet_frozen`, `rate_limited`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDocument'
        '404':
          description: >-
            Error document. Documented codes: `agent_grant_required`,
            `grant_proof_invalid`, `policy_not_ready`, `native_method_denied`,
            `authorization_stale`, `wallet_frozen`, `rate_limited`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDocument'
        '409':
          description: >-
            Error document. Documented codes: `agent_grant_required`,
            `grant_proof_invalid`, `policy_not_ready`, `native_method_denied`,
            `authorization_stale`, `wallet_frozen`, `rate_limited`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDocument'
        '410':
          description: >-
            Error document. Documented codes: `agent_grant_required`,
            `grant_proof_invalid`, `policy_not_ready`, `native_method_denied`,
            `authorization_stale`, `wallet_frozen`, `rate_limited`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDocument'
        '429':
          description: >-
            Error document. Documented codes: `agent_grant_required`,
            `grant_proof_invalid`, `policy_not_ready`, `native_method_denied`,
            `authorization_stale`, `wallet_frozen`, `rate_limited`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDocument'
        '502':
          description: >-
            Error document. Documented codes: `agent_grant_required`,
            `grant_proof_invalid`, `policy_not_ready`, `native_method_denied`,
            `authorization_stale`, `wallet_frozen`, `rate_limited`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDocument'
        '503':
          description: >-
            Error document. Documented codes: `agent_grant_required`,
            `grant_proof_invalid`, `policy_not_ready`, `native_method_denied`,
            `authorization_stale`, `wallet_frozen`, `rate_limited`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDocument'
      security:
        - ApiKey: []
          GrantToken: []
        - ApiKey: []
          GrantProof: []
components:
  schemas:
    ErrorDocument:
      type: object
      properties:
        errors:
          minItems: 1
          type: array
          items:
            type: object
            properties:
              status:
                type: string
                pattern: ^[1-5][0-9]{2}$
              code:
                type: string
                pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$
              layer:
                type: string
                enum:
                  - request
                  - auth
                  - grant
                  - policy
                  - budget
                  - balance
                  - provider
                  - api
              title:
                type: string
              detail:
                type: string
              source:
                type: object
                properties:
                  pointer:
                    type: string
                required:
                  - pointer
                additionalProperties: false
              meta:
                type: object
                properties:
                  retryable:
                    type: boolean
                  available_at:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                  min_amount:
                    type: string
                    pattern: ^[0-9]{1,78}$
                  available_amount:
                    type: string
                    pattern: ^[0-9]{1,78}$
                required:
                  - retryable
                additionalProperties: false
            required:
              - status
              - code
              - layer
              - title
            additionalProperties: false
        meta:
          type: object
          properties:
            request_id:
              type: string
          additionalProperties: false
      required:
        - errors
        - meta
      additionalProperties: false
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
    GrantToken:
      type: apiKey
      in: header
      name: X-Grant-Token
      description: >-
        Token of the owner grant a delegated request runs under. The partner
        creates it and the owner signs its commitment; keep it on your backend.
    GrantProof:
      type: apiKey
      in: header
      name: X-Grant-Proof
      description: >-
        For a `public_key` grant, instead of `X-Grant-Token`: a JWT (compact
        JWS) the grant's key signs for this one request, so no bearer token
        crosses the wire. `alg` is `EdDSA` for an Ed25519 key, `ES256` for
        P-256; `iss` and `sub` are the key's RFC 9278 thumbprint URI; `grant_id`
        is the exact live grant ID, kept fixed on retries; `aud` is this API's
        origin plus the request path, without query or fragment, as one string;
        `htm` is the method, uppercase; `body_sha256` is the lowercase hex
        SHA-256 of the exact body bytes (of zero bytes when there is no body);
        `idempotency_key` is the request's `Idempotency-Key` exactly as sent,
        and absent when it sends none; `exp` is at most five minutes after
        `iat`; `jti` is 16 to 256 characters and spent on first use. Refusals
        read `grant_proof_invalid` (401).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.