# Order

## GET /orders/

> Search orders using a multitude of filters

```json
{"openapi":"3.0.0","info":{"title":"API REST Documentation","version":"6.0-oas3"},"servers":[{"url":"https://api.2checkout.com/rest/6.0"}],"paths":{"/orders/":{"get":{"tags":["Order"],"summary":"Search orders using a multitude of filters","parameters":[{"name":"ApproveStatus","in":"query","description":"Choose the desired status like WAITING, OK, FRAUD, INVALIDDATA","required":false,"style":"form","explode":true,"schema":{"type":"string","enum":["WAITING","OK","FRAUD","INVALIDDATA"]}},{"name":"Newer","in":"query","description":"Needed timestamp. If not provided, will return by default the data for last 7 days.","required":false,"style":"form","explode":true,"schema":{"type":"string"}},{"name":"Status","in":"query","description":"Order status. Some of the available options are COMPLETE, PENDING, CANCELED, REFUND","required":false,"style":"form","explode":true,"schema":{"type":"string","enum":["COMPLETE","PENDING","CANCELED","REFUND"]}},{"name":"StartDate","in":"query","description":"Start date in format Y-m-d. Will overwrite Newer if provided.","required":false,"style":"form","explode":true,"schema":{"type":"string"}},{"name":"EndDate","in":"query","description":"End date in format Y-m-d.","required":false,"style":"form","explode":true,"schema":{"type":"string"}},{"name":"PartnerOrders","in":"query","description":"Decide if it will also include partner orders","required":false,"style":"form","explode":true,"schema":{"type":"boolean"}},{"name":"ExternalRefNo","in":"query","description":"The external reference number of the order","required":false,"style":"form","explode":true,"schema":{"type":"string"}},{"name":"IncludeTestOrders","in":"query","description":"Should test orders be included in the result Values YES -  test orders are included NO - test orders are not included ONLY - only the test orders are included","required":false,"style":"form","explode":true,"schema":{"type":"string"}},{"name":"Page","in":"query","description":"Needed page","required":false,"style":"form","explode":true,"schema":{"type":"string"}},{"name":"Limit","in":"query","description":"Number of results per page","required":false,"style":"form","explode":true,"schema":{"type":"integer"}}],"responses":{"201":{"description":"Created","content":{"application/json":{}}}}}}}}
```

## GET /orders/0/sale/

> Get order reference by sale id

```json
{"openapi":"3.0.0","info":{"title":"API REST Documentation","version":"6.0-oas3"},"servers":[{"url":"https://api.2checkout.com/rest/6.0"}],"paths":{"/orders/0/sale/":{"get":{"tags":["Order"],"summary":"Get order reference by sale id","parameters":[{"in":"query","name":"SaleId","description":"Unique code that identifies a sale","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Get order reference by sale id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderReference"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderReferenceSaleBadRequest"}}}}}}}},"components":{"schemas":{"OrderReference":{"type":"string"},"OrderReferenceSaleBadRequest":{"type":"object","properties":{"error_code":{"type":"string"},"message":{"type":"string"}}}}}}
```

## GET /orders/0/invoice/

> Get order reference by invoice id

```json
{"openapi":"3.0.0","info":{"title":"API REST Documentation","version":"6.0-oas3"},"servers":[{"url":"https://api.2checkout.com/rest/6.0"}],"paths":{"/orders/0/invoice/":{"get":{"tags":["Order"],"summary":"Get order reference by invoice id","parameters":[{"name":"Accept","in":"header","required":true,"style":"simple","explode":false,"schema":{"type":"string","default":"application/json","enum":["application/json"]}},{"name":"X-Avangate-Authentication","in":"header","description":"Authentication header","required":true,"style":"simple","explode":false,"schema":{"type":"string"}},{"name":"InvoiceId","in":"query","description":"Unique code that identifies an invoice","required":true,"style":"form","explode":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get order reference by invoice id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderReference"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderReferenceInvoiceBadRequest"}}}}}}}},"components":{"schemas":{"OrderReference":{"type":"string"},"OrderReferenceInvoiceBadRequest":{"type":"object","properties":{"error_code":{"type":"string"},"message":{"type":"string"}}}}}}
```

## GET /orders/{OrderReference}/

> Retrieve an order by reference

```json
{"openapi":"3.0.0","info":{"title":"API REST Documentation","version":"6.0-oas3"},"servers":[{"url":"https://api.2checkout.com/rest/6.0"}],"paths":{"/orders/{OrderReference}/":{"get":{"tags":["Order"],"summary":"Retrieve an order by reference","parameters":[{"name":"Accept","in":"header","required":true,"style":"simple","explode":false,"schema":{"type":"string","default":"application/json","enum":["application/json"]}},{"name":"X-Avangate-Authentication","in":"header","description":"Authentication header","required":true,"style":"simple","explode":false,"schema":{"type":"string"}},{"name":"OrderReference","in":"path","description":"Reference number for approved/paid orders.","required":true,"style":"simple","explode":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{}}}}}}}}
```

## Cancel a purchase order

> Cancel order with purchase order type

```json
{"openapi":"3.0.0","info":{"title":"API REST Documentation","version":"6.0-oas3"},"servers":[{"url":"https://api.2checkout.com/rest/6.0"}],"paths":{"/orders/{OrderReference}/":{"delete":{"tags":["Order"],"summary":"Cancel a purchase order","description":"Cancel order with purchase order type","parameters":[{"name":"Accept","in":"header","required":true,"style":"simple","explode":false,"schema":{"type":"string","default":"application/json","enum":["application/json"]}},{"name":"X-Avangate-Authentication","in":"header","description":"Authentication header","required":true,"style":"simple","explode":false,"schema":{"type":"string"}},{"name":"OrderReference","in":"path","description":"Reference number for purchase order type orders.","required":true,"style":"simple","explode":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{}}},"400":{"description":"Invalid data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/inline_response_400"}}}},"404":{"description":"Invalid data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/inline_response_404"}}}}}}}},"components":{"schemas":{"inline_response_400":{"type":"object","properties":{"error_code":{"type":"string"},"message":{"type":"string"}}},"inline_response_404":{"type":"object","properties":{"error_code":{"type":"string"},"message":{"type":"string"}}}}}}
```

## POST /orders/{OrderReference}/upload

> Order form upload

```json
{"openapi":"3.0.0","info":{"title":"API REST Documentation","version":"6.0-oas3"},"servers":[{"url":"https://api.2checkout.com/rest/6.0"}],"paths":{"/orders/{OrderReference}/upload":{"post":{"tags":["Order"],"summary":"Order form upload","parameters":[{"name":"X-Avangate-Authentication","in":"header","description":"Authentication header","required":true,"style":"simple","explode":false,"schema":{"type":"string"}},{"name":"Accept","in":"header","required":true,"style":"simple","explode":false,"schema":{"type":"string","enum":["application/json"]}},{"name":"OrderReference","in":"path","description":"Unique, system-generated order identifier.","required":true,"style":"simple","explode":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ordersUpload"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{}}},"400":{"description":"Invalid data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/inline_response_400"}}}}}}}},"components":{"schemas":{"ordersUpload":{"type":"object","properties":{"FileName":{"type":"string"},"ClientTime":{"type":"string"},"File":{"type":"string"}}},"inline_response_400":{"type":"object","properties":{"error_code":{"type":"string"},"message":{"type":"string"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.2checkout.com/api-reference/reference/order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
