# Batch out and query Open batch

## Get open batch&#x20;

> Retrieve the list of open batches available for the terminal.

```json
{"openapi":"3.0.1","info":{"title":"Batches","version":"2.0"},"paths":{"/rest/v2/batches/open":{"get":{"tags":["Batch out and query Open batch"],"summary":"Get open batch ","description":"Retrieve the list of open batches available for the terminal.","operationId":"getOpenBatch","parameters":[{"name":"api-key","in":"header","description":"An access API key issued to you by Xplor Pay.","required":true},{"name":"refund-count","description":"Total number of refund transactions in the batch."},{"name":"refund-total","description":"Total number of refund transactions in the batch."},{"name":"sales-count","description":"Total number of sale transactions in the batch."},{"name":"sales-total","description":"Total dollar amount of sales in the batch"},{"name":"net-amount","description":"Total amount of transactions in the batch."},{"name":"total-count","description":"Total number of transactions in the batch."},{"name":"confirmation-code","description":"Confirmation code for the settled batch."},{"name":"settled","description":"Date and time when the batch was settled."},{"name":"status","description":"The status of the batch."}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearentBatchResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ClearentBatchResponsePayload"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}}}}}},"components":{"schemas":{"ClearentBatchResponsePayload":{"type":"object","properties":{"batch":{"$ref":"#/components/schemas/Payload"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"payload","xml":{"name":"payload"}},"Payload":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the batch."},"status":{"type":"string","description":"Current status of the batch. Available statuses: Open, Close, Pending, Failed.","enum":["OPEN","CLOSED"]},"settled":{"type":"string","description":"Date and time when the batch was settled."},"refund-count":{"type":"string","description":"Total number of refund transactions processed in the batch."},"refund-total":{"type":"string","description":"Total amount refunded in the batch."},"sales-count":{"type":"string","description":"Total number of sales transactions processed in the batch."},"sales-total":{"type":"string","description":"Total amount of all sale transactions in the batch."},"net-amount":{"type":"string","description":"Net amount after processing sale and refund transactions, in currency format."},"total-count":{"type":"string","description":"Total number of transactions, including sales and refunds."},"confirmation-code":{"type":"string","description":"The batch confirmation code."},"merchant-id":{"type":"string","description":"Identifier for the merchant associated with the batch."},"terminal-id":{"type":"string","description":"Identifier of the terminal that processed the batch."},"terminal-name":{"type":"string","description":"Name of the terminal."},"date-opened":{"type":"string","description":"Date when the batch was opened."},"switch-batch-id":{"type":"string","description":"Identifier used by the payment switch for the batch."}},"description":"Batches","xml":{"name":"batch"}},"ErrorPayloadResponsePayload":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/ErrorPayload"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"Payload","xml":{"name":"payload"}},"ErrorPayload":{"type":"object","properties":{"error-message":{"type":"string","description":"Describes the reason for the error."},"result-code":{"type":"string","description":"Numeric code that identifies the type of error returned by the request."},"time-stamp":{"type":"string","description":"Date and time when the error occurred, ISO 8601 format (UTC)."}},"xml":{"name":"error"}}}}}
```

## Close open batch

> Close the open batch for the terminal. Open batches can be closed manually through this API or automatically through the payment gateway or by configuring Merchant Account Settings.

```json
{"openapi":"3.0.1","info":{"title":"Batches","version":"2.0"},"paths":{"/rest/v2/batches/open":{"put":{"tags":["Batch out and query Open batch"],"summary":"Close open batch","description":"Close the open batch for the terminal. Open batches can be closed manually through this API or automatically through the payment gateway or by configuring Merchant Account Settings.","operationId":"closeOpenBatch","parameters":[{"name":"api-key","in":"header","description":"An access API key issued to you by Xplor Pay.","required":true}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncomingBatchRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClearentBatchResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ClearentBatchResponsePayload"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"401":{"description":"Unauthorized.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"403":{"description":"Forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"404":{"description":"Not Found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"500":{"description":"Server Error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}}}}}},"components":{"schemas":{"IncomingBatchRequest":{"type":"object","properties":{"lastBatchClosedRequiredInResponse":{"type":"boolean","description":"Indicates whether the response must include details about the last batch that was closed.","readOnly":true},"software-type":{"type":"string","description":"Identifies the type of software that initiated the batch close request."}},"description":"Request payload for closing the batch","xml":{"name":"batch-validation"}},"ClearentBatchResponsePayload":{"type":"object","properties":{"batch":{"$ref":"#/components/schemas/Payload"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"payload","xml":{"name":"payload"}},"Payload":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the batch."},"status":{"type":"string","description":"Current status of the batch. Available statuses: Open, Close, Pending, Failed.","enum":["OPEN","CLOSED"]},"settled":{"type":"string","description":"Date and time when the batch was settled."},"refund-count":{"type":"string","description":"Total number of refund transactions processed in the batch."},"refund-total":{"type":"string","description":"Total amount refunded in the batch."},"sales-count":{"type":"string","description":"Total number of sales transactions processed in the batch."},"sales-total":{"type":"string","description":"Total amount of all sale transactions in the batch."},"net-amount":{"type":"string","description":"Net amount after processing sale and refund transactions, in currency format."},"total-count":{"type":"string","description":"Total number of transactions, including sales and refunds."},"confirmation-code":{"type":"string","description":"The batch confirmation code."},"merchant-id":{"type":"string","description":"Identifier for the merchant associated with the batch."},"terminal-id":{"type":"string","description":"Identifier of the terminal that processed the batch."},"terminal-name":{"type":"string","description":"Name of the terminal."},"date-opened":{"type":"string","description":"Date when the batch was opened."},"switch-batch-id":{"type":"string","description":"Identifier used by the payment switch for the batch."}},"description":"Batches","xml":{"name":"batch"}},"ErrorPayloadResponsePayload":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/ErrorPayload"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"Payload","xml":{"name":"payload"}},"ErrorPayload":{"type":"object","properties":{"error-message":{"type":"string","description":"Describes the reason for the error."},"result-code":{"type":"string","description":"Numeric code that identifies the type of error returned by the request."},"time-stamp":{"type":"string","description":"Date and time when the error occurred, ISO 8601 format (UTC)."}},"xml":{"name":"error"}}}}}
```


---

# 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.xplorpay.com/api-reference/api/payments/batches/batch-out-and-query-open-batch.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.
