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

# Orderbook API

> REST API for interacting with the CoW Protocol orderbook — quotes, order submission, retrieval, and cancellation

export const InlineResource = ({value, copyValue, href, chain, explorerHref, explorerType = "address", explorerSuffix = "", showCopy = true, showExplorer = false, openInNewTab}) => {
  const explorerBases = {
    arbitrum: "https://arbiscan.io",
    arbitrum_one: "https://arbiscan.io",
    avalanche: "https://snowscan.xyz",
    base: "https://basescan.org",
    bnb: "https://bscscan.com",
    ethereum: "https://etherscan.io",
    gnosis: "https://gnosisscan.io",
    ink: "https://explorer.inkonchain.com",
    linea: "https://lineascan.build",
    mainnet: "https://etherscan.io",
    optimism: "https://optimistic.etherscan.io",
    plasma: "https://plasmascan.to",
    polygon: "https://polygonscan.com",
    sepolia: "https://sepolia.etherscan.io",
    xdai: "https://gnosisscan.io"
  };
  const isExternalUrl = (candidate = "") => (/^https?:\/\//i).test(candidate);
  const isHexAddress = (candidate = "") => (/^0x[a-fA-F0-9]{40}$/).test(candidate);
  const normalizeUrl = (candidate = "") => {
    if (!candidate) {
      return "";
    }
    if (candidate.startsWith("/") || candidate.startsWith("#") || isExternalUrl(candidate)) {
      return candidate;
    }
    return `https://${candidate}`;
  };
  const compactUrl = (candidate = "") => {
    const withoutProtocol = candidate.replace(/^https?:\/\//i, "");
    if (withoutProtocol.length <= 40) {
      return withoutProtocol;
    }
    const [host, ...segments] = withoutProtocol.split("/");
    if (!segments.length) {
      return `${withoutProtocol.slice(0, 20)}...${withoutProtocol.slice(-12)}`;
    }
    const tail = segments.length >= 2 ? `${segments[segments.length - 2]}/${segments[segments.length - 1]}` : segments[segments.length - 1];
    return `${host}/.../${tail}`;
  };
  const resolvedExplorerHref = (() => {
    if (explorerHref) {
      return explorerHref;
    }
    if (!chain || !value) {
      return "";
    }
    const base = explorerBases[chain];
    if (!base) {
      return "";
    }
    return `${base}/${explorerType}/${value}${explorerSuffix}`;
  })();
  const resolvedHref = normalizeUrl(href || "");
  const primaryHref = resolvedHref || (showExplorer ? resolvedExplorerHref : "");
  const primaryTarget = openInNewTab ?? (primaryHref ? isExternalUrl(primaryHref) : false);
  const shouldCompactValue = isExternalUrl(value || "") || isExternalUrl(primaryHref);
  const displayValue = shouldCompactValue ? compactUrl(value) : value;
  const contentClassName = ["inline-resource__value", shouldCompactValue ? "inline-resource__value--compact" : "", isHexAddress(value || "") ? "inline-resource__value--address" : ""].filter(Boolean).join(" ");
  const setButtonState = (button, state, label) => {
    if (!button) {
      return;
    }
    button.dataset.state = state;
    button.setAttribute("aria-label", label);
    button.title = label;
    if (button.__copyTimer) {
      window.clearTimeout(button.__copyTimer);
      button.__copyTimer = null;
    }
    if (state === "idle") {
      return;
    }
    button.__copyTimer = window.setTimeout(() => {
      button.dataset.state = "idle";
      button.setAttribute("aria-label", "Copy value");
      button.title = "Copy value";
    }, 1200);
  };
  const fallbackCopy = text => {
    if (typeof document === "undefined") {
      return false;
    }
    const input = document.createElement("textarea");
    input.value = text;
    input.setAttribute("readonly", "");
    input.style.left = "-9999px";
    input.style.position = "absolute";
    document.body.appendChild(input);
    input.select();
    let copied = false;
    try {
      copied = document.execCommand("copy");
    } catch {
      copied = false;
    }
    document.body.removeChild(input);
    return copied;
  };
  const copyText = async (text, button) => {
    if (!text) {
      setButtonState(button, "copied", "Nothing to copy");
      return;
    }
    try {
      if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
        await navigator.clipboard.writeText(text);
        setButtonState(button, "copied", "Copied");
        return;
      }
    } catch {}
    const copied = fallbackCopy(text);
    setButtonState(button, copied ? "copied" : "idle", copied ? "Copied" : "Copy failed");
  };
  const content = <code className={contentClassName} title={value}>
      {displayValue}
    </code>;
  return <span className="inline-resource">
      {primaryHref ? <a className="inline-resource__link" href={primaryHref} rel={primaryTarget ? "noreferrer noopener" : undefined} target={primaryTarget ? "_blank" : undefined} title={value}>
          {content}
        </a> : content}

      {showCopy || showExplorer && resolvedExplorerHref && resolvedExplorerHref !== primaryHref ? <span className="inline-resource__actions">
          {showCopy ? <button aria-label="Copy value" className="inline-resource__action" data-state="idle" onClick={event => copyText(copyValue || value, event.currentTarget)} title="Copy value" type="button">
              <span className="inline-resource__icon inline-resource__icon--copy">
                <CopyIcon />
              </span>
              <span className="inline-resource__icon inline-resource__icon--check">
                <CheckIcon />
              </span>
            </button> : null}

          {showExplorer && resolvedExplorerHref && resolvedExplorerHref !== primaryHref ? <a aria-label="Open in explorer" className="inline-resource__action" href={resolvedExplorerHref} rel="noreferrer noopener" target="_blank" title="Open in explorer">
              <span className="inline-resource__icon">
                <ExternalLinkIcon />
              </span>
            </a> : null}
        </span> : null}
    </span>;
};

The Orderbook API is the primary interface for interacting with CoW Protocol's order management system.

## Start Here

If you are integrating rather than just looking up a schema:

* [API Integration Guide](/cow-protocol/howto/integrate/api) — the full quote → sign → submit → monitor flow
* [Quickstart: Raw API (cURL)](/cow-protocol/tutorials/quickstart-curl) — the most copy-pasteable raw HTTP walkthrough
* [Testing Your Integration](/cow-protocol/howto/integrate/testing) — Sepolia to barn to production rollout
* [TypeScript `OrderBookApi`](/cow-sdk/api/order-book-api) and [Python `OrderBookApi`](/cow-py/api/order-book) — SDK access to the same Orderbook workflows

## Base URLs

| Network          | Production                                                                                        | Staging                                                                                                     |
| ---------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| **Ethereum**     | <InlineResource value="https://api.cow.fi/mainnet" href="https://api.cow.fi/mainnet" />           | <InlineResource value="https://barn.api.cow.fi/mainnet" href="https://barn.api.cow.fi/mainnet" />           |
| **Gnosis Chain** | <InlineResource value="https://api.cow.fi/xdai" href="https://api.cow.fi/xdai" />                 | <InlineResource value="https://barn.api.cow.fi/xdai" href="https://barn.api.cow.fi/xdai" />                 |
| **Arbitrum One** | <InlineResource value="https://api.cow.fi/arbitrum_one" href="https://api.cow.fi/arbitrum_one" /> | <InlineResource value="https://barn.api.cow.fi/arbitrum_one" href="https://barn.api.cow.fi/arbitrum_one" /> |
| **Base**         | <InlineResource value="https://api.cow.fi/base" href="https://api.cow.fi/base" />                 | <InlineResource value="https://barn.api.cow.fi/base" href="https://barn.api.cow.fi/base" />                 |
| **Avalanche**    | <InlineResource value="https://api.cow.fi/avalanche" href="https://api.cow.fi/avalanche" />       | <InlineResource value="https://barn.api.cow.fi/avalanche" href="https://barn.api.cow.fi/avalanche" />       |
| **Polygon**      | <InlineResource value="https://api.cow.fi/polygon" href="https://api.cow.fi/polygon" />           | <InlineResource value="https://barn.api.cow.fi/polygon" href="https://barn.api.cow.fi/polygon" />           |
| **BNB**          | <InlineResource value="https://api.cow.fi/bnb" href="https://api.cow.fi/bnb" />                   | <InlineResource value="https://barn.api.cow.fi/bnb" href="https://barn.api.cow.fi/bnb" />                   |
| **Linea**        | <InlineResource value="https://api.cow.fi/linea" href="https://api.cow.fi/linea" />               | <InlineResource value="https://barn.api.cow.fi/linea" href="https://barn.api.cow.fi/linea" />               |
| **Plasma**       | <InlineResource value="https://api.cow.fi/plasma" href="https://api.cow.fi/plasma" />             | <InlineResource value="https://barn.api.cow.fi/plasma" href="https://barn.api.cow.fi/plasma" />             |
| **Ink**          | <InlineResource value="https://api.cow.fi/ink" href="https://api.cow.fi/ink" />                   | <InlineResource value="https://barn.api.cow.fi/ink" href="https://barn.api.cow.fi/ink" />                   |
| **Sepolia**      | <InlineResource value="https://api.cow.fi/sepolia" href="https://api.cow.fi/sepolia" />           | <InlineResource value="https://barn.api.cow.fi/sepolia" href="https://barn.api.cow.fi/sepolia" />           |

## Key Endpoints

### Quotes

* [`POST /api/v1/quote`](/api-reference/quote-a-price-and-fee-for-the-specified-order-parameters) — Get a price quote for a trade

<Note>
  `POST /api/v1/quote` returns the base order parameters in `quote`, plus quote metadata such as `expiration` and `id`. If your integration applies client-side slippage or partner fees before signing, see the [API Integration Guide](/cow-protocol/howto/integrate/api) for the full amount-adjustment flow.
</Note>

### Orders

* [`POST /api/v1/orders`](/api-reference/create-a-new-order) — Submit a signed order
* [`GET /api/v1/orders/{UID}`](/api-reference/get-existing-order-from-uid) — Get order by UID
* [`DELETE /api/v1/orders/{UID}`](/api-reference/cancel-an-order-by-marking-it-invalid-with-a-timestamp) — Cancel an order
* [`GET /api/v1/account/{owner}/orders`](/api-reference/get-orders-of-one-user-paginated) — Get orders for an account

### Trades

* [`GET /api/v2/trades`](/api-reference/get-existing-trades-paginated) — Get paginated trades (preferred; filter by `owner` or `orderUid`)
* [`GET /api/v1/trades`](/api-reference/get-existing-trades-unpaginated) — Deprecated trades endpoint

### Auction

* [`GET /api/v1/auction`](/api-reference/get-the-current-batch-auction) — Get the current batch auction
* [`GET /api/v1/solver_competition/{auction_id}`](/api-reference/get-information-about-a-solver-competition) — Get solver competition results

## Interactive Reference

Browse the interactive Orderbook endpoint docs directly in this site under **Orderbook Endpoints** in the left navigation. Those pages are generated from the upstream OpenAPI specification, so users can inspect parameters, schemas, and playground requests without leaving `docs.cow.bleu.builders`.

If you want the most common raw API references directly, start with [`POST /api/v1/quote`](/api-reference/quote-a-price-and-fee-for-the-specified-order-parameters), [`POST /api/v1/orders`](/api-reference/create-a-new-order), [`GET /api/v1/orders/{UID}`](/api-reference/get-existing-order-from-uid), and [`GET /api/v2/trades`](/api-reference/get-existing-trades-paginated).

If you need the upstream spec directly, use <InlineResource value="https://raw.githubusercontent.com/cowprotocol/services/main/crates/orderbook/openapi.yml" href="https://raw.githubusercontent.com/cowprotocol/services/main/crates/orderbook/openapi.yml" />.

## SDK Access

For programmatic access, you can use either SDK instead of calling the HTTP API directly:

* [TypeScript `OrderBookApi`](/cow-sdk/api/order-book-api) for quotes, orders, trades, and app-data endpoints
* [Python `OrderBookApi`](/cow-py/api/order-book) for the same Orderbook workflows in `cow-py`

For the raw HTTP flow, start with the [API Integration Guide](/cow-protocol/howto/integrate/api).
