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

# Create Market

> Deploy a new market where users can take Based or Cringe positions

<Note>
  This is a smart contract write function. The curl example shown is for illustration. To call this function, use web3 libraries (ethers.js, viem, web3.py) or JSON-RPC directly.
</Note>


## OpenAPI

````yaml POST /protocol/createMarket
openapi: 3.0.3
info:
  title: Based Protocol Smart Contracts API
  description: >-
    OpenAPI specification for the Based Protocol - a bidirectional perpetual
    markets platform built for EVM blockchains. The protocol allows users to
    create binary markets where participants can take "Based" (positive) or
    "Cringe" (negative) positions using the Based Market mechanism.
  version: 1.0.0
  license:
    name: LicenseRef-Proprietary
servers:
  - url: https://mainnet.base.org
    description: Base Mainnet (default RPC endpoint)
security: []
tags:
  - name: BasedProtocol
    description: Operations related to the main protocol contract
  - name: BasedMarket
    description: Operations for individual markets
  - name: BasedMarketRouter
    description: Router operations with safety checks and deadline protection
paths:
  /protocol/createMarket:
    post:
      tags:
        - BasedProtocol
      summary: Create a new market
      description: Deploy a new market where users can take Based or Cringe positions
      operationId: createMarket
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMarketRequest'
      responses:
        '200':
          description: Market created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateMarketResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateMarketRequest:
      type: object
      required:
        - creator
      properties:
        creator:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Address that will receive creator fees
    CreateMarketResponse:
      type: object
      properties:
        marketAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Address of the newly created market
        marketCounter:
          type: integer
          format: uint64
          description: Counter/ID of the created market
        transactionHash:
          type: string
          pattern: ^0x[a-fA-F0-9]{64}$
          description: Transaction hash of the market creation
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
        code:
          type: integer
          description: Error code
        details:
          type: object
          description: Additional error details

````