# List Past Orders

<EndpointPage
  breadcrumbs={[
    { label: "Trading", href: "/trading/trading" },
    { label: "Orders", href: "/trading/rest-api/orders" },
    { label: "List Past Orders" },
  ]}
  title="List Past Orders"
  method="POST"
  url="https://api.gemini.com/v1/orders/history"
  description="Retrieve closed order history for an account."
  example={{
    request: {
      method: "POST",
      url: "https://api.gemini.com/v1/orders/history",
      headers: [
        { name: "X-GEMINI-APIKEY", value: "<string>" },
        { name: "X-GEMINI-PAYLOAD", value: "<string>" },
        { name: "X-GEMINI-SIGNATURE", value: "<string>" },
      ],
      body: {
        request: "/v1/orders/history",
        nonce: "<nonce>",
        limit_orders: 50,
      },
    },
  }}
  sections={[
    {
      heading: "Roles",
      children: (
        <>
          <p style={{ margin: "0 0 2px" }}>The API key you use to access this endpoint must have the Trader or Auditor role assigned. See <a href="https://docs.gemini.com/roles#roles" style={{ color: "inherit", textDecorationLine: "underline" }}>Roles</a> for more information.</p>
          <p style={{ margin: 0 }}>The OAuth scope must have <InlineBadge>history:read</InlineBadge> assigned to access this endpoint. See <a href="/authentication/oauth#oauth-scopes" style={{ color: "inherit", textDecorationLine: "underline" }}>OAuth Scopes</a> for more information.</p>
        </>
      ),
    },
    {
      heading: "How to retrieve your order history",
      children: (
        <p style={{ margin: 0 }}>
          To retrieve your full order history walking backwards:
          <ol style={{ margin: "8px 0 0", paddingLeft: 20 }}>
            <li>Initial request: <InlineBadge>POST</InlineBadge> to <InlineBadge>https://api.gemini.com/v1/orders/history</InlineBadge> with a JSON payload including a <InlineBadge>timestamp</InlineBadge> key with value <InlineBadge>0</InlineBadge> and a <InlineBadge>limit_orders</InlineBadge> key with value <InlineBadge>500</InlineBadge>.</li>
            <li>The list is sorted by <InlineBadge>timestamp</InlineBadge> descending. Take the highest timestamp value <InlineBadge>X</InlineBadge> from the first element.</li>
            <li>Create a second request with <InlineBadge>timestamp</InlineBadge> set to <InlineBadge>X+1</InlineBadge> and <InlineBadge>limit_orders</InlineBadge> set to <InlineBadge>500</InlineBadge>.</li>
            <li>Repeat, using the highest timestamp from each response, until an empty list is returned.</li>
          </ol>
        </p>
      ),
    },
    {
      heading: "Break Types",
      children: (
        <p style={{ margin: 0 }}>In the rare event that a trade has been reversed (broken), the trade that is broken will have this flag set. The field will contain one of these values:
          <ul style={{ margin: "8px 0 0", paddingLeft: 20 }}>
            <li><strong>manual</strong> — The trade was reversed manually. All fees, proceeds, and debits associated with the trade have been credited or debited to the account separately. This reported trade must be included for the account balance to be correct.</li>
            <li><strong>full</strong> — The trade was fully broken. The reported trade should not be accounted for. It will be as though the transfer of funds associated with the trade had simply not happened.</li>
          </ul>
        </p>
      ),
    },
    {
      heading: "Headers",
      children: <SpecHeaders operationId="listPastOrders" />,
    },
    {
      heading: "Request Body",
      children: <SpecParams operationId="listPastOrders" />,
    },
    {
      heading: "Responses",
      children: <SpecResponses operationId="listPastOrders" />,
    },
  ]}
/>

<PageNavigation
  prev={{ label: "List Active Orders", href: "/trading/rest-api/orders/list-active-orders" }}
  next={{ label: "List Past Trades", href: "/trading/rest-api/orders/list-past-trades" }}
/>
