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

# GetMarketIdByName

> Resolves an asset/quote symbol pair to its numeric market ID.
 `asset_symbol` is required and fails with `INVALID_ARGUMENT` if
 blank; an unknown asset/quote combination returns `NOT_FOUND`.



## OpenAPI

````yaml /developers/api-reference/openapi.yaml post /market_service.v1.MarketService/GetMarketIdByName
openapi: 3.1.0
info:
  title: Fairground.Fi API
  description: |
    API for the Fairground Perpetuals trading platform.

    This API uses ConnectRPC which accepts JSON over HTTP POST requests.
    All service endpoints follow the pattern: `/package.ServiceName/MethodName`
  version: 1.0.0
  contact:
    name: Forte Service Company
    url: https://github.com/Forte-Service-Company-Ltd/perpetuals-api-server
  license:
    name: Proprietary
    identifier: UNLICENSED
servers:
  - url: https://api.fairground.fi
    description: Production API server
security:
  - bearerAuth: []
tags:
  - name: Trades
    description: Wallet trade/fill history
  - name: Markets
    description: Market configuration and summary endpoints
  - name: Orderbook
    description: Orderbook data retrieval
  - name: Orders
    description: Order management operations
  - name: Portfolio
    description: Aggregated per-wallet portfolio data
  - name: Positions
    description: Position management operations
  - name: Prices
    description: Oracle price and historical price data
paths:
  /market_service.v1.MarketService/GetMarketIdByName:
    post:
      tags:
        - Markets
      summary: GetMarketIdByName
      description: |-
        Resolves an asset/quote symbol pair to its numeric market ID.
         `asset_symbol` is required and fails with `INVALID_ARGUMENT` if
         blank; an unknown asset/quote combination returns `NOT_FOUND`.
      operationId: market_service.v1.MarketService.GetMarketIdByName
      parameters:
        - name: Connect-Protocol-Version
          in: header
          required: true
          schema:
            $ref: '#/components/schemas/connect-protocol-version'
        - name: Connect-Timeout-Ms
          in: header
          schema:
            $ref: '#/components/schemas/connect-timeout-header'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/market_service.v1.GetMarketIdByNameRequest'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/market_service.v1.GetMarketIdByNameResponse
              example:
                marketId: '1'
components:
  schemas:
    connect-protocol-version:
      type: number
      title: Connect-Protocol-Version
      enum:
        - 1
      description: Define the version of the Connect protocol. If omitted, use 1.
      const: 1
      default: 1
    connect-timeout-header:
      type: number
      title: Connect-Timeout-Ms
      description: Define the timeout, in ms
    market_service.v1.GetMarketIdByNameRequest:
      type: object
      properties:
        assetSymbol:
          type: string
          title: asset_symbol
          description: >-
            Underlying asset symbol, e.g. `"BTC"`. Matched case-insensitively
            and trimmed.
        quoteSymbol:
          type:
            - string
            - 'null'
          title: quote_symbol
          description: |-
            Quote symbol, e.g. `"PERP"`. Optional, but omitting
            it looks up a market named exactly by `assetSymbol` alone (e.g.
            `"BTC"`) rather than `"BTC-PERP"`, which may not resolve to any
            real market.
      title: GetMarketIdByNameRequest
      required:
        - assetSymbol
      additionalProperties: false
    market_service.v1.GetMarketIdByNameResponse:
      type: object
      properties:
        marketId:
          type: string
          title: market_id
          format: int64
          description: Resolved on-chain market identifier.
      title: GetMarketIdByNameResponse
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````