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

# Mint shares

> Deposit funds and receive equal YES and NO shares for a market

Minting creates new shares for a binary market. You deposit funds and receive an equal number of YES and NO shares (a complementary pair). The cost per pair equals the market's base unit (e.g., \$1.00 per YES+NO pair in USD markets). Minting does not affect market prices since it creates both sides equally.

This is useful when you want to sell one side on the order book while keeping the other, or when you want to provide liquidity.

## Authentication

Write authentication required — `X-Public-Key`, `X-Timestamp`, and `X-Signature` headers. See the [Authentication guide](/authentication).

## Path parameters

<ParamField path="marketId" type="string" required>
  UUID of the market.
</ParamField>

## Request body

<ParamField body="quantity" type="number" required>
  Amount to use for the mint operation in the selected `currency`. For example,
  `quantity: 100, currency: "NGN"` means "spend 100 NGN to mint". Must be
  greater than 0.
</ParamField>

<ParamField body="currency" type="string">
  `USD` (default) or `NGN`.
</ParamField>

<Info>
  Request `quantity` is a wallet amount in the provided currency. The response
  `quantity` is the normalized share quantity minted.
</Info>

## Example request

<CodeGroup>
  ```bash cURL theme={null}
  PUBLIC_KEY="pk_live_abcdef123456"
  SECRET_KEY="sk_live_secret789xyz"
  TIMESTAMP=$(date +%s)
  METHOD="POST"
  URL_PATH="/v1/pm/markets/b2c3d4e5-f6a7-8901-bcde-f12345678901/mint"
  BODY='{"quantity":10,"currency":"USD"}'

  BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 -hex 2>/dev/null | sed 's/.*= //')
  PAYLOAD="${TIMESTAMP}.${METHOD}.${URL_PATH}.${BODY_HASH}"
  SIGNATURE=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$SECRET_KEY" -binary | base64)

  curl -X POST "https://relay.bayse.markets${URL_PATH}" \
    -H "X-Public-Key: ${PUBLIC_KEY}" \
    -H "X-Timestamp: ${TIMESTAMP}" \
    -H "X-Signature: ${SIGNATURE}" \
    -H "Content-Type: application/json" \
    -d "$BODY"
  ```

  ```javascript Node.js theme={null}
  import crypto from 'crypto';

  const publicKey = 'pk_live_abcdef123456';
  const secretKey = 'sk_live_secret789xyz';
  const timestamp = Math.floor(Date.now() / 1000);
  const method = 'POST';
  const path = '/v1/pm/markets/b2c3d4e5-f6a7-8901-bcde-f12345678901/mint';
  const body = JSON.stringify({
    quantity: 10,
    currency: 'USD',
  });

  const bodyHash = crypto.createHash('sha256').update(body).digest('hex');
  const payload = `${timestamp}.${method}.${path}.${bodyHash}`;
  const signature = crypto
    .createHmac('sha256', secretKey)
    .update(payload)
    .digest('base64');

  const response = await fetch(`https://relay.bayse.markets${path}`, {
    method,
    headers: {
      'X-Public-Key': publicKey,
      'X-Timestamp': timestamp.toString(),
      'X-Signature': signature,
      'Content-Type': 'application/json',
    },
    body,
  });
  const result = await response.json();
  ```

  ```python Python theme={null}
  import hmac, hashlib, base64, json, time, requests

  public_key = 'pk_live_abcdef123456'
  secret_key = 'sk_live_secret789xyz'
  timestamp = int(time.time())
  method = 'POST'
  path = '/v1/pm/markets/b2c3d4e5-f6a7-8901-bcde-f12345678901/mint'
  body = json.dumps({
      'quantity': 10,
      'currency': 'USD',
  })

  body_hash = hashlib.sha256(body.encode()).hexdigest()
  payload = f'{timestamp}.{method}.{path}.{body_hash}'
  signature = base64.b64encode(
      hmac.new(secret_key.encode(), payload.encode(), hashlib.sha256).digest()
  ).decode()

  resp = requests.post(
      f'https://relay.bayse.markets{path}',
      headers={
          'X-Public-Key': public_key,
          'X-Timestamp': str(timestamp),
          'X-Signature': signature,
          'Content-Type': 'application/json',
      },
      data=body,
  )
  result = resp.json()
  ```

  ```go Go theme={null}
  import (
      "crypto/hmac"
      "crypto/sha256"
      "encoding/base64"
      "encoding/hex"
      "fmt"
      "strconv"
      "strings"
      "time"
  )

  timestamp := time.Now().Unix()
  method := "POST"
  urlPath := "/v1/pm/markets/b2c3d4e5-f6a7-8901-bcde-f12345678901/mint"
  body := []byte(`{"quantity":10,"currency":"USD"}`)

  bodySum := sha256.Sum256(body)
  bodyHash := hex.EncodeToString(bodySum[:])
  payload := fmt.Sprintf("%d.%s.%s.%s", timestamp, method, urlPath, bodyHash)
  mac := hmac.New(sha256.New, []byte("sk_live_secret789xyz"))
  mac.Write([]byte(payload))
  signature := base64.StdEncoding.EncodeToString(mac.Sum(nil))

  req, _ := http.NewRequest("POST", "https://relay.bayse.markets"+urlPath, strings.NewReader(string(body)))
  req.Header.Set("X-Public-Key", "pk_live_abcdef123456")
  req.Header.Set("X-Timestamp", strconv.FormatInt(timestamp, 10))
  req.Header.Set("X-Signature", signature)
  req.Header.Set("Content-Type", "application/json")
  resp, _ := http.DefaultClient.Do(req)
  ```
</CodeGroup>

## Response

<ResponseField name="operationId" type="string">
  UUID of the mint operation.
</ResponseField>

<ResponseField name="marketId" type="string">
  UUID of the market.
</ResponseField>

<ResponseField name="quantity" type="number">
  Normalized share quantity minted.
</ResponseField>

<ResponseField name="outcome1Price" type="number">
  Current price of outcome 1 (YES). Returned for convenience — minting does not change market prices.
</ResponseField>

<ResponseField name="outcome2Price" type="number">
  Current price of outcome 2 (NO). Returned for convenience — minting does not change market prices.
</ResponseField>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "operationId": "d4e5f6a7-b8c9-0123-defa-456789012345",
    "marketId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "quantity": 10,
    "outcome1Price": 0.65,
    "outcome2Price": 0.35
  }
  ```
</ResponseExample>
