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

# Verify Contract with Source Code

> Verify a contract with its source code and compilation information. Returns a guid for checking verification status.



## OpenAPI

````yaml /openapi-specs/pro-rpc-api-universal.json get /v2/api?module=contract&action=verify
openapi: 3.1.0
info:
  title: 'Blockscout PRO API: RPC and ETH RPC'
  version: 2.0.0
  description: >
    Blockscout's Etherscan-compatible RPC API and standard ETH JSON-RPC methods,
    served from the multichain PRO API.


    ## Base URL


    All requests go to `https://api.blockscout.com`. Choose the network with
    `chain_id` (for example `1` for Ethereum or `8453` for Base).


    ## Authentication


    A PRO API key is required on every request, including the free tier. Get one
    at [dev.blockscout.com](https://dev.blockscout.com).

    Send it as the `apikey` query parameter or as an `Authorization: Bearer
    YOUR_KEY` header. See [API rate
    limits](https://docs.blockscout.com/rate-limits) for plan limits.


    Requests without a key are not served: the API responds with HTTP `402`. To
    call without an API key, pay per call with [x402
    payments](https://docs.blockscout.com/devs/x402-payments).


    ## RPC API (module and action)


    Etherscan-style requests. Pass `chain_id`, `module` and `action`:


    ```

    https://api.blockscout.com/v2/api?chain_id=1&module=account&action=balance&address=0x...&apikey=YOUR_KEY

    ```


    The same calls are also available at
    `https://api.blockscout.com/{chain_id}/api?module=...&action=...`.


    ## ETH RPC API (JSON-RPC)


    Standard Ethereum JSON-RPC methods use `POST` requests:


    ```

    POST https://api.blockscout.com/{chain_id}/json-rpc

    Content-Type: application/json

    Authorization: Bearer YOUR_KEY


    {"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}

    ```


    ## Migrating from Etherscan


    Replace the base URL with `https://api.blockscout.com/v2/api` and rename
    `chainid` to `chain_id`. Module and action names are the same for most
    calls.
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  contact:
    name: Blockscout Community
    url: https://discord.gg/blockscout
servers:
  - url: https://api.blockscout.com
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Account
    description: Account-related endpoints
  - name: Block
    description: Block-related endpoints
  - name: Contract
    description: Smart contract-related endpoints
  - name: Logs
    description: Event logs endpoints
  - name: Stats
    description: Network statistics endpoints
  - name: Token
    description: Token-related endpoints
  - name: Transaction
    description: Transaction-related endpoints
  - name: ETH RPC
    description: Ethereum JSON-RPC compatible endpoints
externalDocs:
  url: https://docs.blockscout.com/devs/apis/rpc
paths:
  /v2/api?module=contract&action=verify:
    get:
      tags:
        - Contract
      summary: Verify Contract with Source Code
      description: >-
        Verify a contract with its source code and compilation information.
        Returns a guid for checking verification status.
      operationId: contract-verify
      parameters:
        - $ref: '#/components/parameters/chain_id_query'
        - $ref: '#/components/parameters/module_contract'
        - in: query
          name: action
          required: true
          schema:
            type: string
            enum:
              - verify
          description: Action name (must be 'verify')
        - in: query
          name: addressHash
          schema:
            $ref: '#/components/schemas/AddressHash'
          required: true
          description: Contract address hash
        - in: query
          name: name
          schema:
            type: string
          required: true
          description: Contract name
        - in: query
          name: compilerVersion
          schema:
            type: string
          required: true
          description: Compiler version
        - in: query
          name: optimization
          schema:
            type: string
          required: true
          description: Whether optimizations enabled (0 is false 1 is true)
        - in: query
          name: contractSourceCode
          schema:
            type: string
          required: true
          description: Contract source code
        - in: query
          name: constructorArguments
          schema:
            type: string
          required: false
          description: Constructor arguments
        - in: query
          name: autodetectConstructorArguments
          schema:
            type: boolean
          required: false
          description: Auto-detect constructor arguments
        - in: query
          name: evmVersion
          schema:
            type: string
          required: false
          description: EVM version
        - in: query
          name: optimizationRuns
          schema:
            type: integer
          required: false
          description: Number of optimization runs
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ResponseOK'
                  - $ref: '#/components/schemas/ResponseNOTOK'
              example:
                message: OK
                result: guid-string-here
                status: '1'
          headers:
            x-credits-remaining:
              description: >-
                Number of credits remaining in your plan. Resets daily on the
                free plan, monthly otherwise.
              schema:
                type: integer
            x-ratelimit-limit:
              description: >-
                Available requests per second with your plan. Returns -1 on
                internal error.
              schema:
                type: integer
            x-ratelimit-remaining:
              description: >-
                Remaining rate limit based on your queries. Returns -1 on
                internal error.
              schema:
                type: integer
            x-ratelimit-reset:
              description: >-
                Time in milliseconds until the rate limit resets. Returns -1 on
                internal error.
              schema:
                type: integer
      externalDocs:
        url: https://docs.blockscout.com/devs/apis/rpc/contract
components:
  parameters:
    chain_id_query:
      name: chain_id
      in: query
      required: true
      description: The ID of the blockchain
      schema:
        type: string
      example: '1'
    module_contract:
      name: module
      in: query
      required: true
      schema:
        type: string
        enum:
          - contract
      description: Module name (must be 'contract')
  schemas:
    AddressHash:
      type: string
      pattern: ^0x[a-fA-F0-9]{40}$
      example: '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'
      description: 40-character hexadecimal address hash with 0x prefix
    ResponseOK:
      type: object
      properties:
        status:
          type: string
          enum:
            - '1'
          description: Status code (1 = OK)
        message:
          type: string
          example: OK
          description: Response message
    ResponseNOTOK:
      type: object
      properties:
        status:
          type: string
          enum:
            - '0'
          description: Status code (0 = Error)
        message:
          type: string
          example: NOTOK
          description: Error message
        result:
          type: string
          nullable: true
          description: Error details
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      description: API key passed as a Bearer token in the Authorization header.
      scheme: bearer
      type: http
    apiKeyAuth:
      description: API key passed as the `apikey` query parameter.
      in: query
      name: apikey
      type: apiKey

````

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