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

# Verify contract via similarity search

> Starts a verification job that searches the Sourcify database for contracts whose
runtime bytecode is similar to the contract deployed at the given address. The job will
attempt to verify against each candidate until a match is found or the candidate list is exhausted.




## OpenAPI

````yaml /smart-contract-verification-api.yaml post /v2/verify/similarity/{chainId}/{address}
openapi: 3.1.0
info:
  version: 2.1.0
  title: Sourcify APIv2
  description: >-
    Welcome to the Sourcify's APIv2.


    Important differences between the deprecated legacy API and the new APIv2:

    - **Ticketing**: The verfication requests resolve into tickets/verification
    jobs. 
      - Previously the verification happened during the HTTP request, which resulted in timeouts if compilation took longer
    - **Standard JSON as default**: In the current design we take the standard
    JSON format as our main verification endpoint. Other methods such as
    "multi-file" or "single-file" should be handled by frontends or tooling to
    format into std-json. We still support verification with metadata at
    `/v2/verify/metadata`.

    - **Lean API**: We keep the number of endpoints minimal compared to v1. We
    won't have a session API. 

    - **Detailed contract response**: Prev. we only returned contract files of a
    contract. Now we can return details at `/contract/{chainId}/{address}`.


    By submitting source code for verification, you grant Sourcify (and the
    Argot Collective) a non-exclusive, worldwide, irrevocable, royalty-free
    licence to reproduce, store, and publicly display the submitted source code
    for the purposes of verification, archival, and public inspection.
  license:
    name: MIT
    url: https://github.com/argotorg/sourcify/blob/master/LICENSE
  contact:
    name: Sourcify
    url: https://sourcify.dev
    email: hello@sourcify.dev
servers:
  - url: https://sourcify.dev/server
    description: Production server
security: []
tags:
  - name: Contract Lookup
    description: API v2 - Tools and endpoints for looking up contract information
  - name: Verify Contracts
    description: API v2 - Submit a contract for verification
  - name: Verification Jobs
    description: API v2 - Check the status of a verification job
  - name: Other
    description: General server endpoints
paths:
  /v2/verify/similarity/{chainId}/{address}:
    post:
      tags:
        - Verify Contracts
      summary: Verify contract via similarity search
      description: >
        Starts a verification job that searches the Sourcify database for
        contracts whose

        runtime bytecode is similar to the contract deployed at the given
        address. The job will

        attempt to verify against each candidate until a match is found or the
        candidate list is exhausted.
      operationId: verify-similarity
      parameters:
        - name: chainId
          in: path
          description: The chainId number of the EVM chain
          required: true
          schema:
            type: string
            pattern: ^\d+$
            minLength: 1
            maxLength: 20
            example: '11155111'
        - name: address
          in: path
          description: >-
            Contract's 20 byte address in hex string with the 0x prefix. Case
            insensitive.
          required: true
          schema:
            type: string
            pattern: (\b0x[a-fA-F0-9]{40}\b)
            minLength: 42
            maxLength: 42
            example: '0x2738d13E81e30bC615766A0410e7cF199FD59A83'
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              type: object
              properties:
                creationTransactionHash:
                  allOf:
                    - type: string
                      title: Keccak256
                      pattern: (\b0x[a-f0-9]{64}\b)
                      example: >-
                        0xb6ee9d528b336942dd70d3b41e2811be10a473776352009fd73f85604f5ed206
                    - description: >-
                        The hash of the transaction that created this contract.
                        Optional.
      responses:
        '202':
          description: >-
            Successfully submitted the verification. The server started to
            process the verification. 


            You can follow the verification status via the returned
            `verificationId` at `GET /v2/verify/{verificationId}`
          content:
            application/json:
              schema:
                type: object
                title: VerificationJob
                properties:
                  verificationId:
                    type: string
                    format: uuid
                required:
                  - verificationId
        '400':
          description: Bad request from the client
          content:
            application/json:
              schema:
                type: object
                title: GenericErrorResponse
                properties:
                  customCode:
                    type: string
                    description: A string token to indicate the reason of the error
                    example: unsupported_chain
                  message:
                    type: string
                    description: The reasoning of the error
                    example: >-
                      The chain with chainId 3153212 is not supported for
                      verification
                  errorId:
                    type: string
                    format: uuid
                required:
                  - customCode
                  - message
                  - errorId
                examples:
                  - customCode: unsupported_chain
                    message: The chain with chainId 9429413 is not supported
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192
              examples:
                Example 1:
                  value:
                    customCode: unsupported_chain
                    message: The chain with chainId 9429413 is not supported
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192
        '409':
          description: The contract is already verified
          content:
            application/json:
              schema:
                type: object
                title: GenericErrorResponse
                properties:
                  customCode:
                    type: string
                    description: A string token to indicate the reason of the error
                    example: unsupported_chain
                  message:
                    type: string
                    description: The reasoning of the error
                    example: >-
                      The chain with chainId 3153212 is not supported for
                      verification
                  errorId:
                    type: string
                    format: uuid
                required:
                  - customCode
                  - message
                  - errorId
                examples:
                  - customCode: unsupported_chain
                    message: The chain with chainId 9429413 is not supported
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192
              examples:
                already_verified:
                  value:
                    customCode: already_verified
                    message: >-
                      Contract 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 on
                      chain 31337 is already verified with runtimeMatch and
                      creationMatch both being exact matches.
                    errorId: 23aaf52e-168a-4cfa-8463-65ddfb792efc
        '429':
          description: The contract is already being verified
          content:
            application/json:
              schema:
                type: object
                title: GenericErrorResponse
                properties:
                  customCode:
                    type: string
                    description: A string token to indicate the reason of the error
                    example: unsupported_chain
                  message:
                    type: string
                    description: The reasoning of the error
                    example: >-
                      The chain with chainId 3153212 is not supported for
                      verification
                  errorId:
                    type: string
                    format: uuid
                required:
                  - customCode
                  - message
                  - errorId
                examples:
                  - customCode: unsupported_chain
                    message: The chain with chainId 9429413 is not supported
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192
              examples:
                duplicate_verification_request:
                  value:
                    customCode: duplicate_verification_request
                    message: >-
                      Contract 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 on
                      chain 31337 is already being verified.
                    errorId: 23aaf52e-168a-4cfa-8463-65ddfb792efc
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                title: GenericErrorResponse
                properties:
                  customCode:
                    type: string
                    description: A string token to indicate the reason of the error
                    example: unsupported_chain
                  message:
                    type: string
                    description: The reasoning of the error
                    example: >-
                      The chain with chainId 3153212 is not supported for
                      verification
                  errorId:
                    type: string
                    format: uuid
                required:
                  - customCode
                  - message
                  - errorId
                examples:
                  - customCode: unsupported_chain
                    message: The chain with chainId 9429413 is not supported
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192
              examples:
                Example 1:
                  value:
                    customCode: internal_error
                    message: Something went wrong
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192

````