---
updatedAt: 2026-03-05T10:56:24.000Z
agentTools:
  projectIndex: https://docs.tatum.io/llms.txt
---

# view_code - Near

Returns the contract code (Wasm binary) deployed to the account. Please note that the returned code will be encoded in base64.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "view_code - Near",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://{near-network}.gateway.tatum.io",
      "description": "RPC Gateway - Recommended",
      "variables": {
        "near-network": {
          "enum": [
            "near-mainnet",
            "near-testnet"
          ],
          "default": "near-mainnet"
        }
      }
    },
    {
      "url": "https://api.tatum.io/v3/blockchain/node/{near-network}",
      "description": "Deprecated",
      "variables": {
        "near-network": {
          "enum": [
            "near-mainnet",
            "near-testnet"
          ],
          "default": "near-mainnet"
        }
      }
    }
  ],
  "x-sandbox": {
    "category": {
      "type": {
        "name": "category",
        "type": "string",
        "enum": [
          "core",
          "bundler",
          "nft",
          "token",
          "transfers",
          "transaction-receipts",
          "gas-manager",
          "trace",
          "debug",
          "gas-optimized-transactions",
          "private-transactions",
          "notify",
          "transaction-simulation"
        ]
      },
      "value": "core"
    }
  },
  "paths": {
    "/": {
      "post": {
        "x-readme": {
          "samples-languages": [
            "shell",
            "javascript",
            "python",
            "java",
            "php"
          ]
        },
        "summary": "view_code - Near",
        "description": "Returns the contract code (Wasm binary) deployed to the account. Please note that the returned code will be encoded in base64.\n",
        "tags": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer",
                        "default": 1
                      },
                      "jsonrpc": {
                        "type": "string",
                        "default": "2.0"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "properties": {
                      "method": {
                        "default": "query",
                        "type": "string"
                      },
                      "params": {
                        "type": "object",
                        "properties": {
                          "request_type": {
                            "type": "string",
                            "enum": [
                              "view_code"
                            ],
                            "default": "view_code",
                            "description": "The type of query request to retrieve contract code."
                          },
                          "finality": {
                            "type": "string",
                            "enum": [
                              "optimistic",
                              "near-final",
                              "final"
                            ],
                            "default": "final",
                            "description": "Specifies the finality of the state."
                          },
                          "account_id": {
                            "type": "string",
                            "description": "The NEAR account ID whose contract code should be retrieved.",
                            "example": "contract.rpc-examples.testnet"
                          }
                        }
                      }
                    },
                    "required": [
                      "params"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the contract code (Wasm binary) deployed to the account. Please note that the returned code will be encoded in base64.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jsonrpc": {
                      "type": "string",
                      "example": "2.0"
                    },
                    "id": {
                      "type": "string",
                      "example": "dontcare"
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "block_hash": {
                          "type": "string",
                          "description": "The hash of the block at which the contract code was retrieved.",
                          "example": "bxucHpnP8VsiB3pLvA7DpBwri9x1DCZxVfBNkrdWbqn"
                        },
                        "block_height": {
                          "type": "integer",
                          "description": "The height of the block at which the contract code was retrieved.",
                          "example": 187441984
                        },
                        "code_base64": {
                          "type": "string",
                          "description": "The WebAssembly (WASM) contract code encoded in base64.",
                          "example": "AGFzbQEAAAABugEbYAJ/fwF/YAN/f38Bf2ACf38AYAN/..."
                        },
                        "hash": {
                          "type": "string",
                          "description": "The hash of the contract code.",
                          "example": "GVvBFWDPNmomMwXH4LvQW2cRaZJ8N6gxsdBhbJ8ReVJf"
                        }
                      }
                    }
                  },
                  "example": {
                    "jsonrpc": "2.0",
                    "id": "dontcare",
                    "result": {
                      "block_hash": "bxucHpnP8VsiB3pLvA7DpBwri9x1DCZxVfBNkrdWbqn",
                      "block_height": 187441984,
                      "code_base64": "AGFzbQEAAAABugEbYAJ/fwF/YAN/f38Bf2ACf38AYAN/...",
                      "hash": "GVvBFWDPNmomMwXH4LvQW2cRaZJ8N6gxsdBhbJ8ReVJf"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "X-API-Key": []
          }
        ],
        "operationId": "rpc-near-view_code"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "X-API-Key": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header",
        "description": "Your **API key** is used to identify your account & your plan, including the number of API calls per second and total monthly calls you have.\n\nEach key is for individual use only.\n\nIf you don't have a key already you can [Sign up for a Free Tatum account](https://co.tatum.io/signup) to get two keys (testnet and mainnet), allowing up to 5 API calls per second and 1,000,000 Credits.\n\nFor testing purposes, you can use the following key which only works inside docs and has limited functionality (e.g. you cannot create virtual accounts or notification subscriptions with it):\n* t-66a730ccccfd17001c479705-2f597d14ad7543f289a03418\n\nFor more details on limits and plans, [click here](https://docs.tatum.io/docs/plans-limits).\n"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```