NEAR Protocol Tx API

The Tx API from NEAR Protocol — 1 operation(s) for tx.

OpenAPI Specification

near-tx-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  description: Low-latency indexed account, token, and public-key lookup APIs for wallets and explorers. Embedded portal clients may forward an optional `apiKey` query parameter, but the public FastNEAR API does not require it.
  title: FastNEAR accounts Tx API
  version: 3.0.3
servers:
- description: Mainnet
  url: https://api.fastnear.com
- description: Testnet
  url: https://test.api.fastnear.com
tags:
- name: Tx
paths:
  /tx:
    post:
      description: Queries status of a transaction by hash and returns the final transaction result.
      operationId: tx
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JsonRpcRequest_for_tx'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonRpcResponse_for_RpcTransactionResponse_and_RpcTransactionError'
      tags:
      - Tx
components:
  schemas:
    RpcTransactionError:
      oneOf:
      - properties:
          info:
            type: object
          name:
            enum:
            - INVALID_TRANSACTION
            type: string
        required:
        - name
        - info
        type: object
      - properties:
          name:
            enum:
            - DOES_NOT_TRACK_SHARD
            type: string
        required:
        - name
        type: object
      - properties:
          info:
            properties:
              transaction_hash:
                $ref: '#/components/schemas/CryptoHash'
            required:
            - transaction_hash
            type: object
          name:
            enum:
            - REQUEST_ROUTED
            type: string
        required:
        - name
        - info
        type: object
      - properties:
          info:
            properties:
              requested_transaction_hash:
                $ref: '#/components/schemas/CryptoHash'
            required:
            - requested_transaction_hash
            type: object
          name:
            enum:
            - UNKNOWN_TRANSACTION
            type: string
        required:
        - name
        - info
        type: object
      - properties:
          info:
            properties:
              debug_info:
                type: string
            required:
            - debug_info
            type: object
          name:
            enum:
            - INTERNAL_ERROR
            type: string
        required:
        - name
        - info
        type: object
      - properties:
          name:
            enum:
            - TIMEOUT_ERROR
            type: string
        required:
        - name
        type: object
    StakeAction:
      description: An action which stakes signer_id tokens and setup's validator public key
      properties:
        public_key:
          allOf:
          - $ref: '#/components/schemas/PublicKey'
          description: Validator key which will be used to sign transactions on behalf of signer_id
        stake:
          allOf:
          - $ref: '#/components/schemas/NearToken'
          description: Amount of tokens to stake.
      required:
      - stake
      - public_key
      type: object
    SignedTransaction:
      format: byte
      type: string
    NearToken:
      type: string
    AccessKey:
      description: 'Access key provides limited access to an account. Each access key belongs to some account and

        is identified by a unique (within the account) public key. One account may have large number of

        access keys. Access keys allow to act on behalf of the account by restricting transactions

        that can be issued.

        `account_id,public_key` is a key in the state'
      properties:
        nonce:
          description: 'Nonce for this access key, used for tx nonce generation. When access key is created, nonce

            is set to `(block_height - 1) * 1e6` to avoid tx hash collision on access key re-creation.

            See <https://github.com/near/nearcore/issues/3779> for more details.'
          format: uint64
          minimum: 0
          type: integer
        permission:
          allOf:
          - $ref: '#/components/schemas/AccessKeyPermission'
          description: Defines permissions for this access key.
      required:
      - nonce
      - permission
      type: object
    DeleteAccountAction:
      properties:
        beneficiary_id:
          $ref: '#/components/schemas/AccountId'
      required:
      - beneficiary_id
      type: object
    ReceiptEnumView:
      oneOf:
      - additionalProperties: false
        properties:
          Action:
            properties:
              actions:
                items:
                  $ref: '#/components/schemas/ActionView'
                type: array
              gas_price:
                $ref: '#/components/schemas/NearToken'
              input_data_ids:
                items:
                  $ref: '#/components/schemas/CryptoHash'
                type: array
              is_promise_yield:
                default: false
                type: boolean
              output_data_receivers:
                items:
                  $ref: '#/components/schemas/DataReceiverView'
                type: array
              refund_to:
                anyOf:
                - $ref: '#/components/schemas/AccountId'
                - enum:
                  - null
                  nullable: true
              signer_id:
                $ref: '#/components/schemas/AccountId'
              signer_public_key:
                $ref: '#/components/schemas/PublicKey'
            required:
            - signer_id
            - signer_public_key
            - gas_price
            - output_data_receivers
            - input_data_ids
            - actions
            type: object
        required:
        - Action
        type: object
      - additionalProperties: false
        properties:
          Data:
            properties:
              data:
                default: null
                nullable: true
                type: string
              data_id:
                $ref: '#/components/schemas/CryptoHash'
              is_promise_resume:
                default: false
                type: boolean
            required:
            - data_id
            type: object
        required:
        - Data
        type: object
      - additionalProperties: false
        properties:
          GlobalContractDistribution:
            properties:
              already_delivered_shards:
                items:
                  $ref: '#/components/schemas/ShardId'
                type: array
              code:
                type: string
              id:
                $ref: '#/components/schemas/GlobalContractIdentifier'
              nonce:
                format: uint64
                minimum: 0
                nullable: true
                type: integer
              target_shard:
                $ref: '#/components/schemas/ShardId'
            required:
            - id
            - target_shard
            - already_delivered_shards
            - code
            type: object
        required:
        - GlobalContractDistribution
        type: object
    AccountId:
      $schema: https://json-schema.org/draft/2020-12/schema
      description: 'NEAR Account Identifier.


        This is a unique, syntactically valid, human-readable account identifier on the NEAR network.


        [See the crate-level docs for information about validation.](index.html#account-id-rules)


        Also see [Error kind precedence](AccountId#error-kind-precedence).


        ## Examples


        ```

        use near_account_id::AccountId;


        let alice: AccountId = "alice.near".parse().unwrap();


        assert!("ƒelicia.near".parse::<AccountId>().is_err()); // (ƒ is not f)

        ```'
      title: AccountId
      type: string
    ExecutionOutcomeView:
      properties:
        executor_id:
          allOf:
          - $ref: '#/components/schemas/AccountId'
          description: 'The id of the account on which the execution happens. For transaction this is signer_id,

            for receipt this is receiver_id.'
        gas_burnt:
          allOf:
          - $ref: '#/components/schemas/NearGas'
          description: The amount of the gas burnt by the given transaction or receipt.
        logs:
          description: Logs from this transaction or receipt.
          items:
            type: string
          type: array
        metadata:
          allOf:
          - $ref: '#/components/schemas/ExecutionMetadataView'
          default:
            version: 1
          description: Execution metadata, versioned
        receipt_ids:
          description: Receipt IDs generated by this transaction or receipt.
          items:
            $ref: '#/components/schemas/CryptoHash'
          type: array
        status:
          allOf:
          - $ref: '#/components/schemas/ExecutionStatusView'
          description: Execution status. Contains the result in case of successful execution.
        tokens_burnt:
          allOf:
          - $ref: '#/components/schemas/NearToken'
          description: 'The amount of tokens burnt corresponding to the burnt gas amount.

            This value doesn''t always equal to the `gas_burnt` multiplied by the gas price, because

            the prepaid gas price might be lower than the actual gas price and it creates a deficit.

            `tokens_burnt` also contains the penalty subtracted from refunds, while

            `gas_burnt` only contains the gas that we actually burn for the execution.'
      required:
      - logs
      - receipt_ids
      - gas_burnt
      - tokens_burnt
      - executor_id
      - status
      type: object
    TxExecutionError:
      description: Error returned in the ExecutionOutcome in case of failure
      oneOf:
      - additionalProperties: false
        description: An error happened during Action execution
        properties:
          ActionError:
            $ref: '#/components/schemas/ActionError'
        required:
        - ActionError
        type: object
      - additionalProperties: false
        description: An error happened during Transaction execution
        properties:
          InvalidTxError:
            $ref: '#/components/schemas/InvalidTxError'
        required:
        - InvalidTxError
        type: object
    ExecutionOutcomeWithIdView:
      properties:
        block_hash:
          $ref: '#/components/schemas/CryptoHash'
        id:
          $ref: '#/components/schemas/CryptoHash'
        outcome:
          $ref: '#/components/schemas/ExecutionOutcomeView'
        proof:
          items:
            $ref: '#/components/schemas/MerklePathItem'
          type: array
      required:
      - proof
      - block_hash
      - id
      - outcome
      type: object
    MerklePathItem:
      properties:
        direction:
          $ref: '#/components/schemas/Direction'
        hash:
          $ref: '#/components/schemas/CryptoHash'
      required:
      - hash
      - direction
      type: object
    TransactionNonce:
      oneOf:
      - additionalProperties: false
        description: Simple nonce without index, used by ordinary access keys
        properties:
          Nonce:
            properties:
              nonce:
                format: uint64
                minimum: 0
                type: integer
            required:
            - nonce
            type: object
        required:
        - Nonce
        type: object
      - additionalProperties: false
        description: Nonce with index, used by gas keys
        properties:
          GasKeyNonce:
            properties:
              nonce:
                format: uint64
                minimum: 0
                type: integer
              nonce_index:
                format: uint16
                maximum: 65535
                minimum: 0
                type: integer
            required:
            - nonce
            - nonce_index
            type: object
        required:
        - GasKeyNonce
        type: object
    GasKeyInfo:
      properties:
        balance:
          $ref: '#/components/schemas/NearToken'
        num_nonces:
          format: uint16
          maximum: 65535
          minimum: 0
          type: integer
      required:
      - balance
      - num_nonces
      type: object
    InternalError:
      oneOf:
      - properties:
          info:
            properties:
              error_message:
                type: string
            required:
            - error_message
            type: object
          name:
            enum:
            - INTERNAL_ERROR
            type: string
        required:
        - name
        - info
        type: object
    DeterministicStateInitAction:
      properties:
        deposit:
          $ref: '#/components/schemas/NearToken'
        state_init:
          $ref: '#/components/schemas/DeterministicAccountStateInit'
      required:
      - state_init
      - deposit
      type: object
    ActionsValidationError:
      description: Describes the error for validating a list of actions.
      oneOf:
      - description: The delete action must be a final action in transaction
        enum:
        - DeleteActionMustBeFinal
        type: string
      - additionalProperties: false
        description: The total prepaid gas (for all given actions) exceeded the limit.
        properties:
          TotalPrepaidGasExceeded:
            properties:
              limit:
                $ref: '#/components/schemas/NearGas'
              total_prepaid_gas:
                $ref: '#/components/schemas/NearGas'
            required:
            - total_prepaid_gas
            - limit
            type: object
        required:
        - TotalPrepaidGasExceeded
        type: object
      - additionalProperties: false
        description: The number of actions exceeded the given limit.
        properties:
          TotalNumberOfActionsExceeded:
            properties:
              limit:
                format: uint64
                minimum: 0
                type: integer
              total_number_of_actions:
                format: uint64
                minimum: 0
                type: integer
            required:
            - total_number_of_actions
            - limit
            type: object
        required:
        - TotalNumberOfActionsExceeded
        type: object
      - additionalProperties: false
        description: The total number of bytes of the method names exceeded the limit in a Add Key action.
        properties:
          AddKeyMethodNamesNumberOfBytesExceeded:
            properties:
              limit:
                format: uint64
                minimum: 0
                type: integer
              total_number_of_bytes:
                format: uint64
                minimum: 0
                type: integer
            required:
            - total_number_of_bytes
            - limit
            type: object
        required:
        - AddKeyMethodNamesNumberOfBytesExceeded
        type: object
      - additionalProperties: false
        description: The length of some method name exceeded the limit in a Add Key action.
        properties:
          AddKeyMethodNameLengthExceeded:
            properties:
              length:
                format: uint64
                minimum: 0
                type: integer
              limit:
                format: uint64
                minimum: 0
                type: integer
            required:
            - length
            - limit
            type: object
        required:
        - AddKeyMethodNameLengthExceeded
        type: object
      - description: Integer overflow during a compute.
        enum:
        - IntegerOverflow
        type: string
      - additionalProperties: false
        description: Invalid account ID.
        properties:
          InvalidAccountId:
            properties:
              account_id:
                type: string
            required:
            - account_id
            type: object
        required:
        - InvalidAccountId
        type: object
      - additionalProperties: false
        description: The size of the contract code exceeded the limit in a DeployContract action.
        properties:
          ContractSizeExceeded:
            properties:
              limit:
                format: uint64
                minimum: 0
                type: integer
              size:
                format: uint64
                minimum: 0
                type: integer
            required:
            - size
            - limit
            type: object
        required:
        - ContractSizeExceeded
        type: object
      - additionalProperties: false
        description: The length of the method name exceeded the limit in a Function Call action.
        properties:
          FunctionCallMethodNameLengthExceeded:
            properties:
              length:
                format: uint64
                minimum: 0
                type: integer
              limit:
                format: uint64
                minimum: 0
                type: integer
            required:
            - length
            - limit
            type: object
        required:
        - FunctionCallMethodNameLengthExceeded
        type: object
      - additionalProperties: false
        description: The length of the arguments exceeded the limit in a Function Call action.
        properties:
          FunctionCallArgumentsLengthExceeded:
            properties:
              length:
                format: uint64
                minimum: 0
                type: integer
              limit:
                format: uint64
                minimum: 0
                type: integer
            required:
            - length
            - limit
            type: object
        required:
        - FunctionCallArgumentsLengthExceeded
        type: object
      - additionalProperties: false
        description: An attempt to stake with a public key that is not convertible to ristretto.
        properties:
          UnsuitableStakingKey:
            properties:
              public_key:
                $ref: '#/components/schemas/PublicKey'
            required:
            - public_key
            type: object
        required:
        - UnsuitableStakingKey
        type: object
      - description: The attached amount of gas in a FunctionCall action has to be a positive number.
        enum:
        - FunctionCallZeroAttachedGas
        type: string
      - description: There should be the only one DelegateAction
        enum:
        - DelegateActionMustBeOnlyOne
        type: string
      - additionalProperties: false
        description: 'The transaction includes a feature that the current protocol version

          does not support.


          Note: we stringify the protocol feature name instead of using

          `ProtocolFeature` here because we don''t want to leak the internals of

          that type into observable borsh serialization.'
        properties:
          UnsupportedProtocolFeature:
            properties:
              protocol_feature:
                type: string
              version:
                format: uint32
                minimum: 0
                type: integer
            required:
            - protocol_feature
            - version
            type: object
        required:
        - UnsupportedProtocolFeature
        type: object
      - additionalProperties: false
        properties:
          InvalidDeterministicStateInitReceiver:
            properties:
              derived_id:
                $ref: '#/components/schemas/AccountId'
              receiver_id:
                $ref: '#/components/schemas/AccountId'
            required:
            - receiver_id
            - derived_id
            type: object
        required:
        - InvalidDeterministicStateInitReceiver
        type: object
      - additionalProperties: false
        properties:
          DeterministicStateInitKeyLengthExceeded:
            properties:
              length:
                format: uint64
                minimum: 0
                type: integer
              limit:
                format: uint64
                minimum: 0
                type: integer
            required:
            - length
            - limit
            type: object
        required:
        - DeterministicStateInitKeyLengthExceeded
        type: object
      - additionalProperties: false
        properties:
          DeterministicStateInitValueLengthExceeded:
            properties:
              length:
                format: uint64
                minimum: 0
                type: integer
              limit:
                format: uint64
                minimum: 0
                type: integer
            required:
            - length
            - limit
            type: object
        required:
        - DeterministicStateInitValueLengthExceeded
        type: object
      - additionalProperties: false
        properties:
          GasKeyInvalidNumNonces:
            properties:
              limit:
                format: uint16
                maximum: 65535
                minimum: 0
                type: integer
              requested_nonces:
                format: uint16
                maximum: 65535
                minimum: 0
                type: integer
            required:
            - requested_nonces
            - limit
            type: object
        required:
        - GasKeyInvalidNumNonces
        type: object
      - additionalProperties: false
        properties:
          AddGasKeyWithNonZeroBalance:
            properties:
              balance:
                $ref: '#/components/schemas/NearToken'
            required:
            - balance
            type: object
        required:
        - AddGasKeyWithNonZeroBalance
        type: object
      - description: Gas keys with FunctionCall permission cannot have an allowance set.
        enum:
        - GasKeyFunctionCallAllowanceNotAllowed
        type: string
      - additionalProperties: false
        description: 'The combined number of `DeployContract` and `DeployGlobalContract`

          actions in one receipt exceeded the limit.'
        properties:
          TotalNumberOfDeployActionsExceeded:
            properties:
              limit:
                format: uint64
                minimum: 0
                type: integer
              number_of_deploy_actions:
                format: uint64
                minimum: 0
                type: integer
            required:
            - number_of_deploy_actions
            - limit
            type: object
        required:
        - TotalNumberOfDeployActionsExceeded
        type: object
    FunctionCallError:
      description: 'Serializable version of `near-vm-runner::FunctionCallError`.


        Must never reorder/remove elements, can only add new variants at the end (but do that very

        carefully). It describes stable serialization format, and only used by serialization logic.'
      oneOf:
      - enum:
        - WasmUnknownError
        - _EVMError
        type: string
      - additionalProperties: false
        description: Wasm compilation error
        properties:
          CompilationError:
            $ref: '#/components/schemas/CompilationError'
        required:
        - CompilationError
        type: object
      - additionalProperties: false
        description: 'Wasm binary env link error


          Note: this is only to deserialize old data, use execution error for new data'
        properties:
          LinkError:
            properties:
              msg:
                type: string
            required:
            - msg
            type: object
        required:
        - LinkError
        type: object
      - additionalProperties: false
        description: Import/export resolve error
        properties:
          MethodResolveError:
            $ref: '#/components/schemas/MethodResolveError'
        required:
        - MethodResolveError
        type: object
      - additionalProperties: false
        description: 'A trap happened during execution of a binary


          Note: this is only to deserialize old data, use execution error for new data'
        properties:
          WasmTrap:
            $ref: '#/components/schemas/WasmTrap'
        required:
        - WasmTrap
        type: object
      - additionalProperties: false
        description: 'Note: this is only to deserialize old data, use execution error for new data'
        properties:
          HostError:
            $ref: '#/components/schemas/HostError'
        required:
        - HostError
        type: object
      - additionalProperties: false
        properties:
          ExecutionError:
            type: string
        required:
        - ExecutionError
        type: object
    VersionedDelegateActionPayload:
      description: 'Versions of the delegate action carried by `Action::DelegateV2`. New

        versions add a variant here rather than a new `Action` variant. The variant

        is part of the signed payload, so a signature can''t be ambiguous across

        versions.'
      oneOf:
      - additionalProperties: false
        properties:
          V2:
            $ref: '#/components/schemas/DelegateActionV2'
        required:
        - V2
        type: object
    PublicKey:
      type: string
    FunctionCallAction:
      properties:
        args:
          type: string
        deposit:
          $ref: '#/components/schemas/NearToken'
        gas:
          $ref: '#/components/schemas/NearGas'
        method_name:
          type: string
      required:
      - method_name
      - args
      - gas
      - deposit
      type: object
    JsonRpcRequest_for_tx:
      properties:
        id:
          type: string
        jsonrpc:
          type: string
        method:
          enum:
          - tx
          type: string
        params:
          $ref: '#/components/schemas/RpcTransactionStatusRequest'
      required:
      - jsonrpc
      - id
      - params
      - method
      title: JsonRpcRequest_for_tx
      type: object
    AccountContractView:
      description: 'RPC view of a non-empty [`AccountContract`]. The `AccountContract::None`

        variant is represented externally as a JSON `null` via `Option`, so this

        enum only carries the three "contract is present" cases. Serializes as

        an externally-tagged object:


        - `Local(hash)` → `{"local": "<CryptoHash>"}`

        - `GlobalHash(hash)` → `{"global_hash": "<CryptoHash>"}`

        - `GlobalAccountId(id)` → `{"global_account_id": "<AccountId>"}`


        Mirrors [`AccountContract`] 1:1 (minus `None`) so consumers can preserve

        the distinction between a global-by-hash and global-by-account contract

        without descending into a nested identifier.'
      oneOf:
      - additionalProperties: false
        properties:
          local:
            $ref: '#/components/schemas/CryptoHash'
        required:
        - local
        type: object
      - additionalProperties: false
        properties:
          global_hash:
            $ref: '#/components/schemas/CryptoHash'
        required:
        - global_hash
        type: object
      - additionalProperties: false
        properties:
          global_account_id:
            $ref: '#/components/schemas/AccountId'
        required:
        - global_account_id
        type: object
    ErrorWrapper_for_RpcTransactionError:
      oneOf:
      - properties:
          cause:
            $ref: '#/components/schemas/RpcRequestValidationErrorKind'
          name:
            enum:
            - REQUEST_VALIDATION_ERROR
            type: string
        required:
        - name
        - cause
        type: object
      - properties:
          cause:
            $ref: '#/components/schemas/RpcTransactionError'
          name:
            enum:
            - HANDLER_ERROR
            type: string
        required:
        - name
        - cause
        type: object
      - properties:
          cause:
            $ref: '#/components/schemas/InternalError'
          name:
            enum:
            - INTERNAL_ERROR
            type: string
        required:
        - name
        - cause
        type: object
    MethodResolveError:
      enum:
      - MethodEmptyName
      - MethodNotFound
      - MethodInvalidSignature
      type: string
    DeterministicAccountStateInitV1:
      properties:
        code:
          $ref: '#/components/schemas/GlobalContractIdentifier'
        data:
          additionalProperties:
            type: string
          type: object
      required:
      - code
      - data
      type: object
    ActionErrorKind:
      oneOf:
      - additionalProperties: false
        description: Happens when CreateAccount action tries to create an account with account_id which is already exists in the storage
        properties:
          AccountAlreadyExists:
            properties:
              account_id:
                $ref: '#/components/schemas/AccountId'
            required:
            - account_id
            type: object
        required:
        - AccountAlreadyExists
        type: object
      - additionalProperties: false
        description: Happens when TX receiver_id doesn't exist (but action is not Action::CreateAccount)
        properties:
          AccountDoesNotExist:
            properties:
              account_id:
                $ref: '#/components/schemas/AccountId'
            required:
            - account_id
            type: object
        required:
        - AccountDoesNotExist
        type: object
      - additionalProperties: false
        description: A top-level account ID can only be created by registrar.
        properties:
          CreateAccountOnlyByRegistrar:
            properties:
              account_id:
                $ref: '#/components/schemas/AccountId'
              predecessor_id:
                $ref: '#/components/schemas/AccountId'
              registrar_account_id:
                $ref: '#/components/schemas/AccountId'
            required:
            - account_id
            - registrar_account_id
            - predecessor_id
            type: object
        required:
        - CreateAccountOnlyByRegistrar
        type: object
      - additionalProperties: false
        description: A newly created account must be under a namespace of the creator account
        properties:
          CreateAccountNotAllowed:
            properties:
              account_id:
                $ref: '#/components/schemas/AccountId'
              predecessor_id:
                $ref: '#/components/schemas/AccountId'
            required:
            - account_id
            - predecessor_id
            type: object
        required:
        - CreateAccountNotAllowed
        type: object
      - additionalProperties: false
        description: 'Administrative actions like `DeployContract`, `Stake`, `AddKey`, `DeleteKey`. can be proceed only if sender=receiver

          or the first TX action is a `CreateAccount` action'
        properties:
          ActorNoPermission:
            properties:
              account_id:
                $ref: '#/components/schemas/AccountId'
              actor_id:
                $ref: '#/components/schemas/AccountId'
            required:
            - account_id
            - actor_id
            type: object
        required:
        - ActorNoPermission
        type: object
      - additionalProperties: false
        description: Account tries to remove an access key that doesn't exist
        properties:
          DeleteKeyDoesNotExist:
            properties:
              account_id:
                $ref: '#/components/schemas/AccountId'
              public_key:
                $ref: '#/components/schemas/PublicKey'
            required:
            - account_id
            - public_key
            type: object
        required:
        - DeleteKeyDoesNotExist
        type: object
      - additionalProperties: false
        description: The public key is already used for an existing access key
        properties:
          AddKeyAlreadyExists:
            properties:
              account_id:
                $ref: '#/components/schemas/AccountId'
              public_key:
                $ref: '#/components/schemas/PublicKey'
            required:
            - account_id
            - public_key
            type: object
        required:
        - AddKeyAlrea

# --- truncated at 32 KB (113 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/near/refs/heads/main/openapi/near-tx-api-openapi.yml