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

# Upload contract template

> Upload a new contract template. This contract template will be available for the workspace



## OpenAPI

````yaml https://docs.fireblocks.com/api/v1/swagger.yaml post /tokenization/templates
openapi: 3.0.0
info:
  title: Fireblocks API
  description: >
    Fireblocks provides a suite of applications to manage digital asset
    operations and a complete development platform to build your business on the
    blockchain.


    - Visit our website for more information: [Fireblocks
    Website](https://fireblocks.com)

    - Visit our developer docs: [Fireblocks
    DevPortal](https://developers.fireblocks.com)
  version: 1.6.2
  contact:
    email: developers@fireblocks.com
servers:
  - url: https://api.fireblocks.io/v1
    description: Fireblocks Production Environment Base URL
  - url: https://sandbox-api.fireblocks.io/v1
    description: Fireblocks Sandbox Environment Base URL
security: []
paths:
  /tokenization/templates:
    post:
      tags:
        - Contract Templates
      summary: Upload contract template
      description: >-
        Upload a new contract template. This contract template will be available
        for the workspace
      operationId: uploadContractTemplate
      parameters:
        - $ref: '#/components/parameters/X-Idempotency-Key'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractUploadRequest'
      responses:
        '201':
          description: Contract was uploaded successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractTemplateDto'
        default:
          $ref: '#/components/responses/Error'
      x-codeSamples:
        - lang: TypeScript
          source: >-
            const response: Promise<FireblocksResponse<ContractTemplateDto>> =
            fireblocks.contractTemplates.uploadContractTemplate(contractTemplatesApiUploadContractTemplateRequest);
        - lang: Java
          source: >-
            CompletableFuture<ApiResponse<ContractTemplateDto>> response =
            fireblocks.contractTemplates().uploadContractTemplate(contractUploadRequest,
            idempotencyKey);
        - lang: Python
          source: >-
            response =
            fireblocks.contract_templates.upload_contract_template(contract_upload_request,
            idempotency_key);
components:
  parameters:
    X-Idempotency-Key:
      name: Idempotency-Key
      in: header
      description: >-
        A unique identifier for the request. If the request is sent multiple
        times with the same idempotency key, the server will return the same
        response as the first request. The idempotency key is valid for 24
        hours.
      required: false
      schema:
        type: string
  schemas:
    ContractUploadRequest:
      type: object
      properties:
        name:
          type: string
          example: My Contract
          description: The name of the contract template
        description:
          type: string
          example: an ERC20 implementation
          description: A short description of the contract template
        longDescription:
          type: string
          example: |
            a full ERC20 implementation, containing the following:

             - mint
             - burn
          description: |-
            A full description of the contract template. May contain 
             to break the lines
        bytecode:
          type: string
          description: >-
            The compiled artifact of this smart contract. Used for deployment of
            this contract template
        sourcecode:
          type: string
          description: The source code of the contract. Optional.
        type:
          enum:
            - FUNGIBLE_TOKEN
            - NON_FUNGIBLE_TOKEN
            - NON_TOKEN
            - TOKEN_EXTENSION
            - TOKEN_UTILITY
          type: string
          example: FUNGIBLE_TOKEN
          description: The type of the contract template
        docs:
          example:
            details: >-
              This contract implements an upgradeable proxy. It is upgradeable
              because calls are delegated to an implementation address that can
              be changed. This address is stored in storage in the location
              specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so
              that it doesn't conflict with the storage layout of the
              implementation behind the proxy.
            errors:
              ERC1967NonPayable():
                - details: An upgrade function sees `msg.value > 0` that may be lost.
            events:
              Upgraded(address):
                details: Emitted when the implementation is upgraded.
            kind: dev
            methods:
              constructor:
                details: >-
                  Initializes the upgradeable proxy with an initial
                  implementation specified by `implementation`. If `_data` is
                  nonempty, it's used as data in a delegate call to
                  `implementation`. This will typically be an encoded function
                  call, and allows initializing the storage of the proxy like a
                  Solidity constructor. Requirements: - If `data` is empty,
                  `msg.value` must be zero.
            version: 1
          description: >-
            A `natspec` compliant documentation json. Can be retrieved from the
            output json after compilation
          allOf:
            - $ref: '#/components/schemas/ContractDoc'
        abi:
          type: array
          example:
            - inputs:
                - internalType: address
                  name: implementation
                  type: address
                - internalType: bytes
                  name: _data
                  type: bytes
              stateMutability: payable
              type: constructor
          description: >-
            The abi of the contract template. Necessary for displaying and for
            after deployment encoding
          items:
            $ref: '#/components/schemas/AbiFunction'
        attributes:
          example:
            useCases:
              - Stablecoin
              - CBDC
            standards:
              - ERC-20
              - ERC-1400
            auditor:
              name: MyAuditor
              imageURL: https://my-images.com/my-image.jpg
              link: https://my-auditor.com/my-audit-report
          description: >-
            The attributes related to this contract template. It will be
            displayed in the tokenization page
          allOf:
            - $ref: '#/components/schemas/ContractAttributes'
        protocol:
          type: string
          enum:
            - ETH
            - SOL
          example: ETH
          description: The protocol that the template will be used for
      required:
        - name
        - description
        - bytecode
        - abi
        - type
    ContractTemplateDto:
      type: object
      properties:
        id:
          type: string
          example: b70701f4-d7b1-4795-a8ee-b09cdb5b850d
          description: The unique identifier of the contract template
        name:
          type: string
          example: My Contract
          description: The name of the contract template
        description:
          type: string
          example: an ERC20 implementation
          description: A short description of the contract template
        longDescription:
          type: string
          example: |
            a full ERC20 implementation, containing the following:

             - mint
             - burn
          description: |-
            A full description of the contract template. May contain 
             to break the lines
        abi:
          type: array
          example:
            - inputs:
                - internalType: address
                  name: implementation
                  type: address
                - internalType: bytes
                  name: _data
                  type: bytes
              stateMutability: payable
              type: constructor
          description: >-
            The abi of the contract template. Necessary for displaying and for
            after deployment encoding
          items:
            $ref: '#/components/schemas/AbiFunction'
        attributes:
          example:
            useCases:
              - Stablecoin
              - CBDC
            standards:
              - ERC-20
              - ERC-1400
            auditor:
              name: MyAuditor
              imageURL: https://my-images.com/my-image.jpg
              link: https://my-auditor.com/my-audit-report
          description: >-
            The attributes related to this contract template. It will be
            displayed in the tokenization page
          allOf:
            - $ref: '#/components/schemas/ContractAttributes'
        docs:
          example:
            details: >-
              This contract implements an upgradeable proxy. It is upgradeable
              because calls are delegated to an implementation address that can
              be changed. This address is stored in storage in the location
              specified by https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so
              that it doesn't conflict with the storage layout of the
              implementation behind the proxy.
            errors:
              ERC1967NonPayable():
                - details: An upgrade function sees `msg.value > 0` that may be lost.
            events:
              Upgraded(address):
                details: Emitted when the implementation is upgraded.
            kind: dev
            methods:
              constructor:
                details: >-
                  Initializes the upgradeable proxy with an initial
                  implementation specified by `implementation`. If `_data` is
                  nonempty, it's used as data in a delegate call to
                  `implementation`. This will typically be an encoded function
                  call, and allows initializing the storage of the proxy like a
                  Solidity constructor. Requirements: - If `data` is empty,
                  `msg.value` must be zero.
            version: 1
          description: >-
            A `natspec` compliant documentation json. Can be retrieved from the
            output json after compilation
          allOf:
            - $ref: '#/components/schemas/ContractDoc'
        owner:
          type: string
          example: b70701f4-d7b1-4795-a8ee-b09cdb5b850d
          description: >-
            The workspace id of the owner of this contract template. If it's a
            private contract, only this workspace will be allowed to deploy it
        vendor:
          description: >-
            The details of the vendor of this contract template. Applicable only
            for public contract templates
          allOf:
            - $ref: '#/components/schemas/VendorDto'
        isPublic:
          type: boolean
          example: true
          description: >-
            Is this a contract that is viewable by all fireblocks's users or is
            it visible only for this workspace
        canDeploy:
          type: boolean
          example: true
          description: >-
            True if the workspace allowed to deploy this contract, false
            otherwise
        type:
          enum:
            - FUNGIBLE_TOKEN
            - NON_FUNGIBLE_TOKEN
            - NON_TOKEN
            - TOKEN_EXTENSION
            - TOKEN_UTILITY
          type: string
          example: FUNGIBLE_TOKEN
          description: The type of the contract template
        implementationContractId:
          type: string
        initializationPhase:
          enum:
            - ON_DEPLOYMENT
            - POST_DEPLOYMENT
          type: string
      required:
        - id
        - name
        - description
        - abi
        - isPublic
        - initializationPhase
    ContractDoc:
      type: object
      properties:
        details:
          type: string
          example: A token that can be minted and burned
          description: A description of the contract
        events:
          type: string
          example: >-
            Upgraded(address): {"details": "Emitted when the implementation is
            upgraded."}
          description: A description of the contract`s events
        kind:
          type: string
          example: dev
          description: Is it devdoc or userdoc
        methods:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/FunctionDoc'
          example:
            constructor:
              details: Initializes the contract
          description: The description of the contract functions
        version:
          type: number
          example: 1
          description: The version of the contract
      required:
        - kind
        - methods
        - version
    AbiFunction:
      type: object
      properties:
        name:
          type: string
          example: mint
          description: The name of the contract function as it appears in the ABI
        stateMutability:
          type: string
          example: pure
          enum:
            - pure
            - view
            - nonpayable
            - payable
          description: >-
            The state mutability of the contract function as it appears in the
            ABI
        type:
          type: string
          example: constructor
          description: The type of the function
          enum:
            - constructor
            - function
            - error
            - event
            - receive
            - fallback
        inputs:
          description: The parameters that this function/constructor posses
          items:
            $ref: '#/components/schemas/Parameter'
          type: array
        outputs:
          description: The parameters that this 'read' function returns
          items:
            $ref: '#/components/schemas/Parameter'
          type: array
        description:
          type: string
          description: The documentation of this function (if has any)
      required:
        - type
    ContractAttributes:
      type: object
      properties:
        useCases:
          type: array
          items:
            type: string
        standards:
          type: array
          items:
            type: string
        auditor:
          $ref: '#/components/schemas/AuditorData'
      required:
        - useCases
        - standards
        - auditor
    VendorDto:
      type: object
      properties:
        id:
          type: string
          example: b70701f4-d7b1-4795-a8ee-b09cdb5b4453
          description: The unique identifier of the vendor of this contract template
        name:
          type: string
          example: Fireblocks
          description: The name of the vendor of this contract template
      required:
        - id
        - name
    ErrorSchema:
      type: object
      properties:
        message:
          type: string
        code:
          type: number
    FunctionDoc:
      type: object
      properties:
        details:
          type: string
          description: A description of the function
        params:
          type: object
          additionalProperties:
            type: string
          description: A description of the function parameters
        returns:
          type: object
          additionalProperties:
            type: string
          description: A description of the function return values. only for read functions
    Parameter:
      type: object
      properties:
        name:
          type: string
          example: _name
          description: The name of the parameter as it appears in the ABI
        description:
          type: string
          example: The name of the token
          description: >-
            A description of the parameter, fetched from the devdoc of this
            contract
        internalType:
          type: string
          example: string
          description: The internal type of the parameter as it appears in the ABI
        type:
          type: string
          example: string
          description: The type of the parameter as it appears in the ABI
        components:
          type: array
          items:
            $ref: '#/components/schemas/Parameter'
      required:
        - name
        - type
    AuditorData:
      type: object
      properties:
        name:
          type: string
        imageURL:
          type: string
        link:
          type: string
      required:
        - name
        - imageURL
        - link
  responses:
    Error:
      description: Error Response
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorSchema'
  headers:
    X-Request-ID:
      schema:
        type: string
      description: >-
        Unique ID correlated to the API request. Please provide it in any
        support ticket you create or on Github issues related to Fireblocks SDKs

````