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

# marketListingExtensionCode

> Get what is needed to write or edit a market's listing extension: code Redo runs for each variant in the market to override the price it calculated, or whether the variant is published. Returns the contract's TypeScript type definitions, starter code and a sample input. Send `marketId` to also get that market's current code. Set the code with `listingExtensionCode` on upsertMarket. A market id from another account, or one that does not exist, is null.

**Required scopes:** [`markets_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-markets_read)

**Store must have one of:** `LANDED_COST`

## Arguments

**marketId** `ID`

A market to read the current listing extension of. Omit to get only the contract and starter code.

## Returns

**marketListingExtensionCode** `[MarketListingExtensionCode](/docs/api-reference/v3/reference/markets/market-listing-extension-code)`

What is needed to write or edit a market's listing extension: the market listing contract, starter code, a sample input, and optionally one market's current code.

**fields**

**contractId** `String!` *required*

The market listing contract every listing extension is checked against.

**marketCode** `String`

The requested market's current listing extension source. Null when no market was requested or the market has no listing extension.

**sampleInput** `String!` *required*

A representative `Input` value as JSON: one variant in one destination country, with the price and listing decision Redo calculated.

**starterCode** `String!` *required*

A minimal working listing extension to start from.

**typeDefinitions** `String!` *required*

TypeScript declarations of the contract's `Input` and `Output`. Code that does not type-check against these is rejected by upsertMarket.

## Example

```graphql theme={null}
query {
  marketListingExtensionCode(marketId: "...") {
    contractId
    marketCode
    sampleInput
    starterCode
    typeDefinitions
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.