Operation-history method
This method allows viewing the full or partial history of operations in page mode. History records are displayed in reverse chronological order (from most recent to oldest).
Required permissions:
operation-history
.Request
Parameter | Type | Description |
---|---|---|
type | string | List of operation types to display (see the table). Possible values:
Types in the list are separated by a space. If omitted, all operations are displayed. |
label | string | Filtering payments by the label value. Payments are selected that have the specified value for the label parameter in the request-payment call. |
from | datetime | Output operations from a timestamp (operations that were equal to the from value or later than it). If omitted, all operations are displayed. |
till | datetime | Output operations to a timestamp (operations that were earlier than the till value). If omitted, all operations are displayed. |
start_record | string | If this parameter is present, displays all operations starting from the number start_record . Operations are numbered starting from 0 . Learn more about list pagination |
records | int | Page size, number of history records in response. Accepted values: from 1 to 100 ; by default 30 . |
details | boolean | Show operation details. By default, false . To display operation details, the operation-details permission is required. |
Example of requesting the complete history
POST /api/operation-history HTTP/1.1 Host: yoomoney.ru Authorization: Bearer 410012345678901.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123 Content-Type: application/x-www-form-urlencoded Content-Length: 9 records=3
The logic used for filtering history records
History records are filtered by the conditions:
- type of operation;
- payment label;
- time period.
All the conditions are additive, meaning each condition adds further restriction.
Rules for selecting data by time period:
- If both the
from
andtill
conditions are set, records are selected for the time period equal tofrom
(or greater) and less thantill
. - If only the
from
condition is set, records are selected that have a time later than or equal tofrom
. - If only the
till
condition is set, records are selected with a time less thantill
. - If both the
from
andtill
conditions are omitted, records are selected without time restrictions.
If the operation history contains a large number of records, the list of operations is displayed in page mode. The first page of the history is displayed by default. If there are additional pages, the
next_record
parameter appears in the response (this parameter is omitted if there is only a single page). To display the next page of the history, repeat the request with the same parameters and add the start_record
parameter, specifying the value from the next_record
parameter of the previous response.Example request for the next pages of the payment history
POST /api/operation-history HTTP/1.1 Host: yoomoney.ru Authorization: Bearer 410012345678901.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123 Content-Type: application/x-www-form-urlencoded Content-Length: 40 type=payment&records=20&start_record=120
To get a larger selection of records in the time period, form a request with the
from
and till
conditions, get the first page of the history, then form requests for the subsequent pages of the history with the same values for the from
and till
parameters, as well as the start_record
parameter with the value that was obtained from the next_record
parameter in the response for the previous page of the history.Response
The method returns the following parameters:
Parameter | Type | Description |
---|---|---|
error | string | Error code. Present if an error occurred when executing the request. |
next_record | string | The number of the first history record on the next page. Present if there is another page in the history operations. Learn more about list pagination |
operations | array | List of operations. |
Operation parameters
Parameter | Type | Description |
---|---|---|
operation_id | string | Operation ID. |
status | string | Status of the payment (transfer). Possible values:
|
datetime | datetime | Operation timestamp (date and time). |
title | string | Brief description of the operation (usually contains the merchant name or source of deposit). |
pattern_id | string | The ID of the pattern used for making the payment. Present only for payments. |
direction | string | Direction of financial transaction. Can take the values:
|
amount | amount | Operation amount. |
label | string | The payment label. Exists for incoming and outgoing transfers made by other YooMoney users that had the label parameter set for the request-payment call. |
type | string | The type of operation. Possible values:
|
If the value of the
details
input parameter is set to true
, the response will also contain operation-details output parameters for operations.Example response for the complete history
JSON
{ "next_record": "4", "operations": [ { "operation_id": "1234567", "status": "success", "pattern_id": "2904", "direction": "out", "amount": 500.00, "datetime": "2011-07-11T20:43:00.000+03:00", "title": "Payment for ADSL access to company XXX", "type": "payment-shop" }, { "operation_id": "1234568", "status": "success", "pattern_id": "2901", "direction": "out", "amount": 300.00, "datetime": "2011-07-10T20:43:00.000+03:00", "title": "Deposit to mobile phone account YYY", "type": "payment-shop" }, { "operation_id": "1234569", "status": "success", "direction": "in", "amount": 1000.00, "datetime": "2011-07-10T20:40:00.000+03:00", "title": "Bank ZZZ, deposit", "type": "deposit" } ] }
Example response with details on operations when paying a merchant
JSON
{ "next_record": "2", "operations": [ { "operation_id": "1234567", "status": "success", "pattern_id": "2904", "direction": "out", "amount": 500.00, "datetime": "2011-07-11T20:43:00.000+04:00", "title": "Payment for ADSL access to company XXX", "details": "Prepayment for ADSL internet access to company XXX\nSubscriber account number: \n1234567/89\nCredited amount: 500.00\nTransaction number: 2000002967767", "type": "payment-shop" } ] }
Example response with details of the operation for an outgoing transfer to another user
JSON
{ "next_record": "2", "operations": [ { "operation_id": "1234567", "status": "success", "pattern_id": "p2p", "direction": "out", "amount": 50.25, "datetime": "2011-07-11T20:43:00.000+04:00", "title": "Transfer to account 4100123456789", "recipient": "4100123456789", "recipient_type": "account", "message": "Buy bagels", "comment": "Transfer to YooMoney user", "codepro": false, "details": "Recipient account:\n4100123456789\nAmount: 50.00 RUB", "type": "outgoing-transfer" } ] }
Error codes
If an error occurs, its code is returned:
Code | Description |
---|---|
illegal_param_type | Invalid value for the type parameter. |
illegal_param_start_record | Invalid value for the start_record parameter. |
illegal_param_records | Invalid value for the records parameter. |
illegal_param_label | Invalid value for the label parameter. |
illegal_param_from | Invalid value for the from parameter. |
illegal_param_till | Invalid value for the till parameter. |
All other values | Technical error; repeat the operation again later. |
Example response for invalid parameter
JSON
{ "error": "illegal_param_type" }