operation-history method

Description

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.

Input parameters

Parameter Type Description
type string List of operation types to display (see the table). 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 (see the note).
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.

Operation types:

Type Description
deposition Deposits (income).
payment Payments (expenditure).
incoming-transfers-unaccepted Unaccepted incoming P2P transfers of any type.
Tip.

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:
  1. If both the from and till conditions are set, records are selected for the time period equal to from (or greater) and less than till.
  2. If only the from condition is set, records are selected that have a time later than or equal to from.
  3. If only the till condition is set, records are selected with a time less than till.
  4. If both the from and till 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.

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.

Returns

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 (see Notes).
operations array List of operations.

Operation parameters:

Parameter Type Description
operation_id string Operation ID.
status string

Status of the payment (transfer). Accepts the following values:

  • success - Payment completed successfully.
  • refused - Payment was declined by the recipient or canceled by the sender.
  • in_progress - Payment is not yet complete; the transfer has not been accepted by the recipient, or is waiting for the secret code to be entered.
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:

  • in (income).
  • out (expenditure).
amount amount Operation amount.
label string The payment label. Exists for incoming and outgoing transfers made by other Yandex.Money users that had the label parameter set for the request-payment call.
type string The type of operation.

Possible types of operations:

Type Description
payment-shop Outgoing payment to a merchant
outgoing-transfer Any type of outgoing P2P transfer
deposition Settlement
incoming-transfer Incoming transfer or deferred transfer.
incoming-transfer-protected Incoming transfer with a secret code.

The incoming-trasfer and incoming-trasfer-protected types of operations can be accepted using incoming-trasfer-accept, and rejected using incoming-trasfer-reject.

Tip.

If the value of the details input parameter is set to true, the response will also contain operation-details output parameters for operations.

Operation processing error codes:

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.
Note.

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.

Requesting complete history

Example of requesting the complete history:

POST /api/operation-history HTTP/1.1
Host: money.yandex.ru
Authorization: Bearer 410012345678901.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123
Content-Type: application/x-www-form-urlencoded
Content-Length: 9
 
records=3

Example request for the next pages of the payment history:

POST /api/operation-history HTTP/1.1
Host: money.yandex.ru
Authorization: Bearer 410012345678901.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123
Content-Type: application/x-www-form-urlencoded
Content-Length: 40
 
type=payment&records=20&start_record=120

Example response for the complete history:


{  "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:


{  "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:


{  "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 Yandex.Money user",      "codepro": false,      "details": "Recipient account:\n4100123456789\nAmount: 50.00 RUB",      "type": "outgoing-transfer"    }  ]}

Example response for invalid parameter:

{
   "error": "illegal_param_type"
}