---
title: "Get Contract Metadata"
method: GET
path: "/v1/contracts/{chainId}/{address}/metadata"
tags: ["Gateway"]
---

# Get Contract Metadata

`GET /v1/contracts/{chainId}/{address}/metadata`

Retrieves detailed metadata for a specific smart contract from the thirdweb contract metadata service. This includes compilation information, ABI, documentation, and other contract-related metadata. Note: Source code is excluded from the response to keep it lightweight and suitable for programmatic access.

**Authentication**: This endpoint requires backend authentication using the `x-secret-key` header. The secret key should never be exposed publicly.

**Metadata Source**: The metadata is fetched from the thirdweb contract metadata service and includes detailed Solidity compilation information, contract ABI, and developer documentation.

## Path parameters

- `chainId` integer, required — The blockchain network identifier where the contract is deployed.
- `address` string, required — The smart contract address or ENS name.

## Response `200`

Successfully retrieved contract metadata

- object — Contract metadata from the thirdweb contract metadata service.
  - `result` object, required
    - `compiler` object — Compiler information including version.
      - `version` string, required — Solidity compiler version used to compile the contract.
    - `language` string — Programming language of the contract (e.g., 'Solidity').
    - `output` object — Compilation output including ABI and documentation.
      - `abi` unknown[] — Contract ABI (Application Binary Interface) as an array of function/event/error definitions.
        - unknown
      - `devdoc` object — Developer documentation extracted from contract comments.
      - `userdoc` object — User documentation extracted from contract comments.
    - `settings` object — Compilation settings including optimization and target configuration.
      - `compilationTarget` object — Compilation target mapping source file names to contract names.
      - `evmVersion` string — EVM version target for compilation.
      - `libraries` object — Library addresses for linking.
      - `metadata` object — Metadata settings for compilation.
        - `bytecodeHash` string — Hash method used for bytecode metadata.
      - `optimizer` object — Optimizer settings used during compilation.
        - `enabled` boolean — Whether optimizer is enabled.
        - `runs` number — Number of optimizer runs.
      - `remappings` string[] — Import remappings used during compilation.
    - `version` number — Metadata format version.

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication required. The request must include a valid `x-secret-key` header for backend authentication.
- `404` — Contract metadata not found
- `429` — Rate limit exceeded
- `500` — Internal server error

---

[API](https://skmtc.net/thirdweb/apis/thirdweb-api.md) · [All operations](https://skmtc.net/thirdweb/apis/thirdweb-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/thirdweb/thirdweb-api/revisions/fb4cb67da1c7/schema)
