> ## Documentation Index
> Fetch the complete documentation index at: https://razorpay-881012b3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch All Orders

> Fetch all Orders using Razorpay Orders API.

<div style={{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.35rem 0.9rem",border:"1px solid rgba(128,128,128,0.28)",borderRadius:"0.5rem",padding:"0.45rem 0.75rem",margin:"0 0 1.25rem",fontSize:"0.875rem"}}>
  <span style={{fontWeight:600}}>Available in</span>
  <span>🇮🇳 India</span>
  <span>🇸🇬 Singapore</span>
  <span>🇺🇸 United States</span>
</div>

Use this endpoint to retrieve the details of all the orders you created. In this example, **count and skip query parameters** have been used. You can invoke this API without these query parameters as well.

<RequestExample>
  ```bash Curl theme={null}
  curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]\
  -X GET https://api.razorpay.com/v1/orders?count=2&skip=1
  ```

  ```java Java theme={null}
  RazorpayClient razorpay = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

  JSONObject params = new JSONObject();
  params.put("count","1");

  List<Order> order = razorpay.orders.fetchAll(params);
  ```

  ```python Python theme={null}
  # do easy_install razorpay or
  #    pip install razorpay
  import razorpay
  client = razorpay.Client(auth=("YOUR_ID", "YOUR_SECRET"))

  client.order.all(option)
  ```

  ```php PHP theme={null}
  $api = new Api($key_id, $secret);

  $api->order->all($options);
  ```

  ```ruby Ruby theme={null}
  require "razorpay"
  Razorpay.setup('YOUR_KEY_ID', 'YOUR_SECRET')

  option = {"count":1}

  Razorpay::Order.all(option)
  ```

  ```javascript Node.js theme={null}
  var instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })

  instance.orders.all(option)
  ```

  ```go Go theme={null}
  import ( razorpay "github.com/razorpay/razorpay-go" )
  client := razorpay.NewClient("YOUR_KEY_ID", "YOUR_SECRET")

  options := map[string]interface{}{
    "count": 1,
  }
  body, err := client.Order.All(options, nil)
  ```

  ```csharp .NET theme={null}
  RazorpayClient client = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

  Dictionary<string, object> orderRequest = new Dictionary<string, object>();
  orderRequest.Add("count","1");

  List<Order> order = client.Order.All(orderRequest);
  ```

  ```bash CLI theme={null}
  razorpay orders list \
    --count 10 \
    --skip 0 \
    --from 1776754530 \
    --to 1776758130 \
    --status paid
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "entity": "collection",
    "count": 2,
    "items": [
      {
        "id": "order_EKzX2WiEWbMxmx",
        "entity": "order",
        "amount": 1234,
        "amount_paid": 0,
        "amount_due": 1234,
        "currency": "USD",
        "receipt": "Receipt No. 1",
        "offer_id": null,
        "status": "created",
        "attempts": 0,
        "notes": [],
        "created_at": 1582637108
      },
      {
        "id": "order_EAI5nRfThga2TU",
        "entity": "order",
        "amount": 100,
        "amount_paid": 0,
        "amount_due": 100,
        "currency": "USD",
        "receipt": "Receipt No. 1",
        "offer_id": null,
        "status": "created",
        "attempts": 0,
        "notes": [],
        "created_at": 1580300731
      }
    ]
  }
  ```

  ```json Failure theme={null}
  {
    "error": {
      "code": "BAD_REQUEST_ERROR",
      "description": "The api key provided is invalid",
      "source": "NA",
      "step": "NA",
      "reason": "NA",
      "metadata": {}
    }
  }
  ```
</ResponseExample>

## Query Parameters

<ParamField query="authorized" type="integer">
  Possible values:

  * `1` : Retrieves Orders for which payments have been authorized. Payment and order states differ. Know more about [payment states](/docs/us/payments/payments#payment-life-cycle).
  * `0` : Retrieves orders for which payments have not been authorized.
</ParamField>

<ParamField query="receipt" type="string">
  Retrieves the orders that contain the provided value for receipt.
</ParamField>

<ParamField query="from" type="integer">
  Timestamp (in Unix format) from when the orders should be fetched.
</ParamField>

<ParamField query="to" type="integer">
  Timestamp (in Unix format) up till when orders are to be fetched.
</ParamField>

<ParamField query="count" type="integer">
  The number of orders to be fetched. The default value is 10. The maximum value is 100. This can be used for pagination, in combination with `skip`.
</ParamField>

<ParamField query="skip" type="integer">
  The number of orders to be skipped. The default value is `0`. This can be used for pagination, in combination with `count`.
</ParamField>

<ParamField query="expand[]" type="array">
  Used to retrieve additional information about the payment. Using this parameter will cause a sub-entity to be added to the response. Supported values are:

  * `payments`: Returns a collection of all payments made for each order.
  * `payments.card`: Returns the card details of each payment made for each order.
  * `transfers`: Returns a collection of transfers created for each order. <br />For more information about creating transfers using orders, refer to the [Route](/docs/us/api/payments/route) section of the [Route API](/docs/us/webhooks/route) documentation.
  * `virtual_account`: Returns the virtual account details created for each order. <br />For more information about creating Virtual Accounts, refer to the [Smart Collect API](/docs/us/api/payments/smart-collect)
</ParamField>

## Response Parameters

<ResponseField name="id" type="string">
  The unique identifier of the order.
</ResponseField>

<ResponseField name="amount" type="integer">
  The amount for which the order was created, in currency subunits. For example, for an amount of , enter `29500`.
</ResponseField>

<ResponseField name="entity" type="string">
  Name of the entity. Here, it is `order`.
</ResponseField>

<ResponseField name="amount_paid" type="integer">
  The amount paid against the order.
</ResponseField>

<ResponseField name="amount_due" type="integer">
  The amount pending against the order.
</ResponseField>

<ResponseField name="currency" type="string" required>
  ISO code for the currency in which you want to accept the payment. The default length is 3 characters. Refer to the [list of supported currencies](/docs/us/payments/international-payments#supported-currencies).
</ResponseField>

<ResponseField name="receipt" type="string">
  Receipt number that corresponds to this order. Can have a maximum length of 40 characters and has to be unique.
</ResponseField>

<ResponseField name="status" type="string">
  The status of the order. Possible values:

  * `created`: When you create an order it is in the `created` state. It stays in this state till a payment is attempted on it.
  * `attempted`: An order moves from `created` to `attempted` state when a payment is first attempted on it. It remains in the `attempted` state till one payment associated with that order is captured.
  * `paid`: After the successful capture of the payment, the order moves to the `paid` state. No further payment requests are permitted once the order moves to the `paid` state. The order stays in the `paid` state even if the payment associated with the order is refunded.
</ResponseField>

<ResponseField name="attempts" type="integer">
  The number of payment attempts, successful and failed, that have been made against this order.
</ResponseField>

<ResponseField name="notes" type="json object">
  Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, `"note_key": "Beam me up Scotty”`.
</ResponseField>

<ResponseField name="created_at" type="integer">
  Indicates the Unix timestamp when this order was created.
</ResponseField>

<ResponseField name="offer_id" type="string">
  Unique identifier of the offer associated with this order.
</ResponseField>

<ResponseField name="token" type="object">
  The recurring-payment token created when the order was authorised on a subscription / recurring flow. Present on orders that resulted in a token-bearing payment.
</ResponseField>

<ResponseField name="auth_type" type="string">
  The authentication type used to create the token. One of `3ds`, `otp`, `aadhaar`, or `physical` for emandate / `mandate_otp` for UPI.
</ResponseField>

<ResponseField name="expire_at" type="integer">
  Unix timestamp when the token expires.
</ResponseField>

<ResponseField name="failure_reason" type="string">
  Human-readable reason if the token-creation flow failed. `null` on success.
</ResponseField>

<ResponseField name="first_payment_amount" type="integer">
  Amount of the first recurring payment, in the smallest currency unit (paise for INR).
</ResponseField>

<ResponseField name="frequency" type="string">
  Frequency of the recurring debit. One of `as_presented`, `daily`, `weekly`, `monthly`, `yearly`, etc.
</ResponseField>

<ResponseField name="max_amount" type="integer">
  Maximum amount that can be debited per cycle, in the smallest currency unit (paise for INR).
</ResponseField>

<ResponseField name="recurring_status" type="string">
  Lifecycle state of the recurring token. One of `initiated`, `confirmed`, `rejected`, `cancelled`, `paused`, or `expired`.
</ResponseField>

## Errors

<AccordionGroup>
  <Accordion
    title="The API `<key/secret>
` provided is invalid."
  >
    **Code:** `400`

    The API credentials passed in the API call differ from the ones generated on the Dashboard. Possible reasons:

    * Different keys for test mode and live modes.
    * Expired API key.

    **Solution:** The API keys must be active and entered correctly with no whitespace before or after the keys.
  </Accordion>

  <Accordion title="The count must be at least 1.">
    **Code:** `400`

    `count=0` (or omitted with explicit zero) passed in the query string.

    **Solution:** Pass `count` as a positive integer between 1 and 100.
  </Accordion>

  <Accordion title="The count may not be greater than 100.">
    **Code:** `400`

    `count` value above 100 in the query string. The Orders list endpoint caps per-page results at 100.

    **Solution:** Use a `count` of 100 or fewer. For larger datasets, paginate using the `skip` parameter.
  </Accordion>

  <Accordion title="The count must be an integer.">
    **Code:** `400`

    `count` query parameter is non-numeric (for example, `count=abc`).

    **Solution:** Pass `count` as a positive integer.
  </Accordion>

  <Accordion title="The from must be an integer.">
    **Code:** `400`

    `from` query parameter is not a UNIX-epoch integer (for example, an ISO date string was passed).

    **Solution:** Pass `from` as a UNIX-epoch integer (for example, `1700000000`), not a human-readable date.
  </Accordion>

  <Accordion title="Value of each expand must be one of following types.">
    **Code:** `400`

    An unsupported value was passed in the `expand[]` query parameter.

    **Solution:** Only the following values are accepted in `expand[]`: `payments`, `payments.card`, `virtual_account`, `transfers`, `offers`.
  </Accordion>
</AccordionGroup>
