---
title: "GetMarketIdByName"
method: POST
path: "/market_service.v1.MarketService/GetMarketIdByName"
tags: ["Markets"]
---

# GetMarketIdByName

`POST /market_service.v1.MarketService/GetMarketIdByName`

## Request

- Base URL: `https://api.fairground.fi`
- URL: `https://api.fairground.fi/market_service.v1.MarketService/GetMarketIdByName`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/fairground/apis/fairground-fi-api/docs/market_service.v1.MarketService/GetMarketIdByName/post.ts> (a function with typed inputs; its response is checked against the schema)

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`.

## Headers

- `Connect-Protocol-Version` 1, required: Define the version of the Connect protocol. If omitted, use 1.
- `Connect-Timeout-Ms` number: Define the timeout, in ms

## Request body

- MarketServiceV1GetMarketIdByNameRequest
  - `assetSymbol` string, required: Underlying asset symbol, e.g. `"BTC"`. Matched case-insensitively and trimmed.
  - `quoteSymbol` string, nullable: 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.

## Response `200`

Success

- MarketServiceV1GetMarketIdByNameResponse
  - `marketId` string, int64: Resolved on-chain market identifier.

---

[API](https://skmtc.dev/fairground/apis/fairground-fi-api.md) - [All operations](https://skmtc.dev/fairground/apis/fairground-fi-api/llms.txt) - [OpenAPI document](https://skmtc.dev/fairground/apis/fairground-fi-api/revisions/be66e6dc0ac0?raw)
